2024-01-23, 10:34 PM
(This post was last modified: 2024-01-23, 10:42 PM by JoeyG1973. Edited 1 time in total.)
Going to throw my interesting discovery in here.
This is happening when I play a 4k steam with subtitles. It's a .mkv and I thought that having the subtitles extracted would reduce the load, but to no avail. Guess that subtitles are added to the video stream on the fly, which now that I think about it, is exactly what is happening. Still it makes no sense why I have such a high cpu load. I have a Nvidia P400 and before I got CUDA setup working with Jellyfin if I played the same stream with subtitles, it simply would lock up and not play, which makes sense considering I am rocking a "Intel® Core i7-4790 CPU @ 3.60GHz". I know it is working because nvidia-smi says as much.
I would have thought that having all this transcoding off loaded to the GPU would not have impacted the CPU as much as it does.
All this said, videos play smooth with subtitles in 4k on my local network. Not something I can say worked with Plex. Same setup with Plex and it was constantly buffering on the client end.
Running straight on Fedora 39.
root@gpm:~# rpm -qa | grep jellyfin
jellyfin-firewalld-10.8.13-1.fc39.noarch
jellyfin-server-10.8.13-1.fc39.x86_64
jellyfin-web-10.8.13-1.fc39.noarch
jellyfin-10.8.13-1.fc39.x86_64
I also hacked /etc/jellyfin/encoding.xml to use the jellyfin-ffmpeg portable I got from here https://github.com/jellyfin/jellyfin-ffmpeg/releases however it doesn't seem that much more efficient than the one that comes with Fedora 39. And yes you need to hack it into that file because it is not something that you can change from the UI. Added the following 2 lines.
<EncoderAppPath>/usr/local/jellyfin-ffmpeg/ffmpeg</EncoderAppPath>
<EncoderAppPathDisplay>/usr/local/jellyfin-ffmpeg/ffmpeg</EncoderAppPathDisplay>
I want to know why the CPU is still screaming even with the work being offloaded to the GPU. To add to this after about 15-30 minutes of playing the stream, the ffmpeg just goes away until I stop the client playback and start again. The box is still snappy though even with all of this CPU load.
Any thoughts on this?
Running top and I can clearly see that ffmpeg is trying to break the box.
htop doesn't look much better
This is the full command that is running:
This is happening when I play a 4k steam with subtitles. It's a .mkv and I thought that having the subtitles extracted would reduce the load, but to no avail. Guess that subtitles are added to the video stream on the fly, which now that I think about it, is exactly what is happening. Still it makes no sense why I have such a high cpu load. I have a Nvidia P400 and before I got CUDA setup working with Jellyfin if I played the same stream with subtitles, it simply would lock up and not play, which makes sense considering I am rocking a "Intel® Core i7-4790 CPU @ 3.60GHz". I know it is working because nvidia-smi says as much.
I would have thought that having all this transcoding off loaded to the GPU would not have impacted the CPU as much as it does.
All this said, videos play smooth with subtitles in 4k on my local network. Not something I can say worked with Plex. Same setup with Plex and it was constantly buffering on the client end.
Running straight on Fedora 39.
root@gpm:~# rpm -qa | grep jellyfin
jellyfin-firewalld-10.8.13-1.fc39.noarch
jellyfin-server-10.8.13-1.fc39.x86_64
jellyfin-web-10.8.13-1.fc39.noarch
jellyfin-10.8.13-1.fc39.x86_64
I also hacked /etc/jellyfin/encoding.xml to use the jellyfin-ffmpeg portable I got from here https://github.com/jellyfin/jellyfin-ffmpeg/releases however it doesn't seem that much more efficient than the one that comes with Fedora 39. And yes you need to hack it into that file because it is not something that you can change from the UI. Added the following 2 lines.
<EncoderAppPath>/usr/local/jellyfin-ffmpeg/ffmpeg</EncoderAppPath>
<EncoderAppPathDisplay>/usr/local/jellyfin-ffmpeg/ffmpeg</EncoderAppPathDisplay>
I want to know why the CPU is still screaming even with the work being offloaded to the GPU. To add to this after about 15-30 minutes of playing the stream, the ffmpeg just goes away until I stop the client playback and start again. The box is still snappy though even with all of this CPU load.
Any thoughts on this?
Code:
root@gpm:~# nvidia-smi
Tue Jan 23 17:27:39 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 545.29.06 Driver Version: 545.29.06 CUDA Version: 12.3 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 Quadro P400 Off | 00000000:01:00.0 Off | N/A |
| 43% 53C P0 N/A / N/A | 192MiB / 2048MiB | 12% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 380547 C /usr/local/jellyfin-ffmpeg/ffmpeg 188MiB |
+---------------------------------------------------------------------------------------+
Running top and I can clearly see that ffmpeg is trying to break the box.
htop doesn't look much better
This is the full command that is running:
Code:
root@gpm:~# ps -eaf | grep 380547
jellyfin 380547 283992 99 17:27 ? 00:22:28 /usr/local/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -ss 01:53:21.000 -init_hw_device cuda=cu:0 -filter_hw_device cu -autorotate 0 -canvas_size 2582x1080 -i file:/mnt/data/media/movies/Dune (2021)/Dune.2021.PROPER.UHD.BluRay.2160p.10bit.DoVi.2Audio.TrueHDAtmos.7.1.x265-b.mkv -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:2 -map -0:0 -codec:v:0 h264_nvenc -preset p1 -b:v 54566883 -maxrate 54566883 -bufsize 109133766 -g:v:0 72 -keyint_min:v:0 72 -filter_complex [0:5]scale=s=3840x1606:flags=fast_bilinear[sub];[0:0]setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,min(3840\,1606*a))/2)*2:trunc(min(max(iw/a\,ih)\,min(3840/a\,1606))/2)*2,format=yuv420p[main];[main][sub]overlay=eof_action=endall:shortest=1:repeatlast=0 -start_at_zero -codec:a:0 copy -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 2267 -hls_segment_filename /var/lib/jellyfin/transcodes/b98168691b3c4e21493476b9dd6e04c4%d.ts -hls_playlist_type vod -hls_list_size 0 -y /var/lib/jellyfin/transcodes/b98168691b3c4e21493476b9dd6e04c4.m3u8