![]() |
Limit ffmpeg CPU usage (no Hardware decoding/encoding) - 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: Limit ffmpeg CPU usage (no Hardware decoding/encoding) (/t-limit-ffmpeg-cpu-usage-no-hardware-decoding-encoding) |
Limit ffmpeg CPU usage (no Hardware decoding/encoding) - I-G-1-1 - 2025-02-11 Normally I'm using hardware (VAAPI) transcoding but there is a device (iPhone) that always trigger CPU conversion from my h.265 mkv media: Code: [/color][color=#000000]Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_vaapi))[/color] I tought that wasn't a problem as is a single user and the CPU is an i5-6300U capable to perform the job. Instead after a while the CPU transcoding completely lock the system and the server become unresponsive and I can't even ssh to the server to kill the process. So I'm trying to limit ffmpeg CPU usage during transcoding. I stopped Jellyfin (sudo systemctl stop jellyfin) edited /etc/jellyfin/encoding.xml from Code: <EncoderAppPathDisplay>/usr/lib/jellyfin-ffmpeg/ffmpeg</EncoderAppPathDisplay> to Code: <EncoderAppPathDisplay>/usr/bin/nice -n 19 /usr/lib/jellyfin-ffmpeg/ffmpeg</EncoderAppPathDisplay> and restarted jellyfin. This isn't working as the line revert back to automatically <EncoderAppPathDisplay>/usr/lib/jellyfin-ffmpeg/ffmpeg</EncoderAppPathDisplay>. is there any way I could limit ffmpeg CPU usage to 80% to avoid system become unresponsive? Thanks for the help RE: Limit ffmpeg CPU usage (no Hardware decoding/encoding) - TheDreadPirate - 2025-02-11 Making changes to the encoder is no longer supported starting with 10.9. Primarily due to security issues in ffmpeg that would not be fixed if custom ffmpeg binaries were allow. The CPU usage you are seeing is from the AUDIO being transcoded. This will ALWAYS happen on the CPU. What you can do is enable transcode throttling IN JELLYFIN. Dashboard > Playback > Transcoding. Scroll down to the bottom and check "Throttle Transcodes". That should pause ffmpeg after it gets 3 minutes ahead of playback (by default). RE: Limit ffmpeg CPU usage (no Hardware decoding/encoding) - I-G-1-1 - 2025-02-11 Thanks for the answer. I knew that for security reason I cannot change the ffmpeg path from the webUI and I was ok with that. However I tought that as root of my server I could change /etc/jellyfin/encoding.xml Sorry but this seems an A p p l e move: "my dear user, I know better than you what you could do with your hardware: no option for you". Can I use "/etc/systemd/system/jellyfin.service.d/override.conf" to pass --ffmpeg path to the Jellyfin executable? Code: ExecStart = /usr/bin/jellyfin $JELLYFIN_WEB_OPT $JELLYFIN_FFMPEG_OPT $JELLYFIN_SERVICE_OPT $JELLYFIN_NOWEBAPP_OPT $JELLYFIN_ADDITIONAL_OPTS What I have to change in ExecStart? Thanks RE: Limit ffmpeg CPU usage (no Hardware decoding/encoding) - TheDreadPirate - 2025-02-11 You could modify the environment to override. I think $JELLYFIN_FFMPEG_OPT is defined in /etc/default/jellyfin. But also give transcode throttling a try. We used to make it easy to modify the ffmpeg path but, again, there was a not insignificant security vulnerability in ffmpeg. We backported the patch into jellyfin-ffmpeg, but then came the conversation about users running custom ffmpegs for the lulz. We figured that not making it easy would prevent "for the lulz" users from changing the ffmpeg path, but still allowing the change to be made via the environment file would allow power users to still make a change. RE: Limit ffmpeg CPU usage (no Hardware decoding/encoding) - I-G-1-1 - 2025-02-11 At the end I gave up on trying to add nice/cpulimit to the ffmpeg executable. Instead I added to /etc/systemd/system/jellyfin.service.d/override.conf: Code: [Unit] I still need to test "transcode throttling". Thanks for the help |