Jellyfin FFMPEG isn't using the correct number of threads - 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: Jellyfin FFMPEG isn't using the correct number of threads (/t-jellyfin-ffmpeg-isn-t-using-the-correct-number-of-threads) |
Jellyfin FFMPEG isn't using the correct number of threads - khatharsis - 2024-11-15 Exactly what the title says. I have 8 cores, and I want to limit jellyfin's usage to 2 or 4 cores. However, even though jellyfin-ffmpeg *does* have the -threads 2 option in the cmdline, it's using all 8 of my cores I've attached a screen to show I'm not saying bollocs. Here's the full cmdline for the jellyfin-ffmpeg command, idk why it's missing spaces, but it isn't supposed to.Code: /usr/lib/jellyfin-ffmpeg/ffmpeg-analyzeduration200M-probesize1G-ss00:10:09.000-ifile:/<path to file>.mkv-map_metadata-1-map_chapters-1-threads2-map0:0-map0:1-codec:v:0libx265-tag:v:0hvc1-presetveryfast-crf28-maxrate3371143-bufsize6742286-profile:v:0main-x265-params:0subme=3:me RE: Jellyfin FFMPEG isn't using the correct number of threads - TheDreadPirate - 2024-11-15 libx264 and libx265 don't encode the same way. When threads is set with libx264 each frame is sliced into that many threads. libx265 does not work by slicing frames. They have a concept called WPP. https://x265.readthedocs.io/en/stable/threading.html#wavefront-parallel-processing When threads is set in libx265, each WPP is assigned that many threads. Depending on the resolution of the video, the number of WPPs can vary. In my testing, a 480i video had 8 WPPs and a 4K video had 34 WPPs. So setting threads to 1 on that 480i video would result in 8 threads. One per WPP. And 34 threads for the 4K video. Quote:chris@rat-trap: /media/storage2/rips/wip/Dune$ ffmpeg -y -init_hw_device vaapi=va:,driver=iHD,kernel_driver=i915 -hide_banner -stats -fflags +genpts+igndts -loglevel error -i Dune_t00.mkv -map_chapters 0 -map 0:v -c:v libx265 -threads 1 -c:a libopus -vbr on -compression_level 10 -application audio -map 0:a:1 -map 0:a:3 -map 0:a:0 -map 0:a:2 -c:s copy -map 0:s:0 -map 0:s:1 -map '0:t?' -disposition:s 0 -max_muxing_queue_size 2048 -max_interleave_delta 0 -avoid_negative_ts disabled test.mkv RE: Jellyfin FFMPEG isn't using the correct number of threads - khatharsis - 2024-11-16 Oh wow ! Thanks for the answer ! That seems really arbitrary though ? That means that trying to transcode a 4k video on a 48 threads machine would yield better results with threads=1 than threads=2, since having more threads than your system has will actually slow things down... Would you know of any way to solve this ? I don't want my server to get overloaded every time I have to transcode some subtitles... I was thinking of using a docker rather than going bare-metal, but I've heard it leads to some issues if I ever want to use GPUs later down the line RE: Jellyfin FFMPEG isn't using the correct number of threads - TheDreadPirate - 2024-11-16 Using Docker with GPUs does not cause "problems". It just takes a little extra configuration. The temporary solution is to disable HEVC encoding for transcodes and only allow H264 encoding so that you get the system load you're expecting. The long time solution is to get a GPU to handle transcoding. |