Jellyfin Forum
High CPU usage when audio transcoding? - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: High CPU usage when audio transcoding? (/t-high-cpu-usage-when-audio-transcoding)

Pages: 1 2


High CPU usage when audio transcoding? - FuzzyJelly - 2024-10-30

Got a bit of an odd one; seems as though I'm getting massive CPU spikes when playing files that need to have their audio transcoded. For example - if I watch a file on my TV, everything is direct play but if I try from my browser it's playing the video fine but transcoding the audio. Normally this wouldn't have done anything significant but now it causes Jellyfin to come to a crawl and eventually pause the video altogether and can only be fixed by restarting the application / container.

I've never had an issue in previous versions but seems as though maybe this version (10.10.0) caused it? It's entirely possible something else is causing this but I can 100% reproduce this by playing a file from a browser (have tried both Edge and Firefox, as well as Windows and MacOS)

JF: 10.10.0
Setup: Docker
OS: Synology

(screenshot attached is from Portainer)


RE: High CPU usage when audio transcoding? - TheDreadPirate - 2024-10-30

Can you share the ffmpeg log?


RE: High CPU usage when audio transcoding? - FuzzyJelly - 2024-10-30

I was doing a lot of testing earlier so hopefully this is the right log: https://pastebin.com/08SEUam8 (FFmpeg.DirectStream-2024-10-30_16-47-34.....)


RE: High CPU usage when audio transcoding? - TheDreadPirate - 2024-10-30

What kind of CPU does your server have? It shouldn't require that much CPU power to transcode stereo DD+/TrueHD. Unless something else was causing high IO latency, which can inflate apparent CPU usage.


RE: High CPU usage when audio transcoding? - FuzzyJelly - 2024-10-31

Apologies for the late reply - CPU is a AMD Ryzen V1500B (Synology 1821+) and hasn't had issues before. I did have a scan running yesterday, which likely skewed the results but here is a fresh log after scanning completed if it makes a difference: https://pastebin.com/wftAaiGF.

I do see a a few files that are {things we don't talk about - TDP} but none are the files I'm trying to watch. Would that have a difference?


RE: High CPU usage when audio transcoding? - TheDreadPirate - 2024-10-31

After speaking with the devs, the theory is that changes in ffmpeg7 made ffmpeg itself significantly more multi-threaded than it was with ffmpeg6.

I did some audio-only transcode testing (also TrueHD to AAC) and the difference in CPU usage between ffmpeg6 and 7 was not small. Not significant for my system, but could be significant for other systems. My testing with ffmpeg6 had CPU usage about about 105-110% (one thread fully utilized, one thread lightly utilized). With ffmpeg7 it was around 160-170% (one thread fully utilized, three threads 15-30% utilized). But was also transcoding about 40-50% faster.

And since your CPU is also 4 cores/8 threads and of similar performance to my 12100, I don't see why your system is struggling.


RE: High CPU usage when audio transcoding? - FuzzyJelly - 2024-10-31

I thought it may have been due to my Gluetun enabled apps (not sure how else to phrase that) since they were doing a lot of disk read operations but I killed that and saw similar behavior in Jellyfin


RE: High CPU usage when audio transcoding? - FuzzyJelly - 2024-11-03

I'm still not sure why this is happening. Even after I close Jellyfin post-CPU spike, the container still pulls CPU and RAM while idling. The only things I can think of now would be to try having JF be the ONLY container running to test it further or see if downgrading fixes it (likely the better of the two for long term use)


RE: High CPU usage when audio transcoding? - FuzzyJelly - 2024-11-03

Just an update - issue is still present in 10.10.1.

One surprising thing I noticed; when playing an HEVC file on an iPhone (official JF iOS app btw) the CPU usage was half of that of an x264 file. Very strange and confusing Face-with-raised-eyebrow


RE: High CPU usage when audio transcoding? - TheDreadPirate - 2024-11-03

Is Jellyfin's DB and transcode directory on a HDD or SSD?