Transcoding issue: Stuttering due to non-constant CPU load renders transcoding unusable
some builds ago the transcoding was improved in a way that now the CPU "speed" can be selected. That's a good point, but the transcoding itself "breaks" in a strange way.
Before, the CPU utilization was quite equal over the time and all was fine. My Mediaserver-VM runs with 6 out of 8 allowed VCores on a Dual Xeon E5430 server, Plex works like a charm and demonstrates that there is pretty enough transcoding power.
But what TVH does currently, is a bit strange. I have a "Road" profile which transcodes down to 2MBit/s. When selecting a HD station, the transcoding does this:
- It utilizes the CPU with 600% (so all six cores at full load) for a short time
- Then the TVH process is not even visible in TOP in the first ranks, very low CPU ... stream goes on
- The stream stutters, picture gets "grey" in VLC on the IPad (direct WiFi connection!), CPU goes to 600% again for a short time, stream continues
- CPU load not noticeable
- Stream stutters, Picture grey, 600% load
- And so on
I have no idea how this is implemented, but it seems TVH decodes some 10-15 seconds with max CPU into a buffer, then does nothing. When the buffer runs out, it panics and tries to decode again with max CPU, but the buffer runs out before the new decoded data is there, hence the stutter and "grey" picture.
During these very short max CPU use even subscribers using a local simple "pass" profile with basically no CPU load will get problems. Also recordings (pass!) will be affected as a result of the full CPU utilization.
Updated by Marco Jakobs over 5 years ago
EDIT: Following a hint in the forum here: https://tvheadend.org/boards/5/topics/21595?r=21604 I've created a tvheadend.service with these settings:
That seems to solve most of the problems, CPU utilization is constant now, around 180% for transcoding HD to 2MBit, 60% for SD (Setting: ultrafast).