VOD and Series are being software transcoded
Opened this issue · 11 comments
Thank you for the work. It is very useful to have Xtream API working with Jellyfin.
I noticed that VOD and Series are always being transcoded, despite the codec being fully supported on the client side. The transcoding is also software-based and not taking advantage of the hardware. The LiveTV is working as expected and direct plays on the client.
Here is a snippet of the log generated during transcoding:
/videos/8529e4ee-612e-1588-eee8-16703a294115/hls1/main/0.ts
{"Protocol":1,"Id":"831599","Path":"http://..................","EncoderPath":null,"EncoderProtocol":1,"Type":0,"Container":null,"Size":null,"Name":"default","IsRemote":true,"ETag":null,"RunTimeTicks":33998400000,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"OpenToken":null,"RequiresClosing":false,"LiveStreamId":null,"BufferMs":null,"RequiresLooping":false,"SupportsProbing":true,"VideoType":null,"IsoType":null,"Video3DFormat":null,"MediaStreams":[],"MediaAttachments":[],"Formats":[],"Bitrate":null,"Timestamp":null,"RequiredHttpHeaders":{},"TranscodingUrl":null,"TranscodingSubProtocol":null,"TranscodingContainer":null,"AnalyzeDurationMs":null,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null}
/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -init_hw_device vaapi=va:,driver=iHD,kernel_driver=i915 -init_hw_device qsv=qs@va -filter_hw_device qs -autorotate 0 -i "http://......." -map_metadata -1 -map_chapters -1 -threads 2 -sn -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/config/transcodes/bdbe5804cc6e346935537e30bd5f90fe%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/config/transcodes/bdbe5804cc6e346935537e30bd5f90fe.m3u8"
ffmpeg version 5.1.3-Jellyfin Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-libs=-lfftw3f --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
Input #0, matroska,webm, from 'http://.......':
Metadata:
title : 1. kapitola
encoder : libebml v1.4.2 + libmatroska v1.6.4
creation_time : 2022-11-27T18:24:58.000000Z
Duration: 00:56:39.84, start: 0.000000, bitrate: 1692 kb/s
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
Metadata:
BPS : 1306136
DURATION : 00:56:38.020000000
NUMBER_OF_FRAMES: 81471
NUMBER_OF_BYTES : 554784704
_STATISTICS_WRITING_APP: mkvmerge v68.0.0 ('The Curtain') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-27 18:24:58
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(ger): Audio: eac3, 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
BPS : 128000
DURATION : 00:56:39.840000000
NUMBER_OF_FRAMES: 106245
NUMBER_OF_BYTES : 54397440
_STATISTICS_WRITING_APP: mkvmerge v68.0.0 ('The Curtain') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-27 18:24:58
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:2(eng): Audio: eac3, 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
BPS : 128000
DURATION : 00:56:39.840000000
NUMBER_OF_FRAMES: 106245
NUMBER_OF_BYTES : 54397440
_STATISTICS_WRITING_APP: mkvmerge v68.0.0 ('The Curtain') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-27 18:24:58
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:3(pol): Audio: eac3, 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
BPS : 128000
DURATION : 00:56:39.840000000
NUMBER_OF_FRAMES: 106245
NUMBER_OF_BYTES : 54397440
_STATISTICS_WRITING_APP: mkvmerge v68.0.0 ('The Curtain') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-27 18:24:58
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:4(cze): Subtitle: subrip (default)
Metadata:
BPS : 69
DURATION : 00:55:48.554000000
NUMBER_OF_FRAMES: 852
NUMBER_OF_BYTES : 29258
_STATISTICS_WRITING_APP: mkvmerge v68.0.0 ('The Curtain') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-27 18:24:58
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:5(ger): Subtitle: subrip (default)
Metadata:
BPS : 78
DURATION : 00:53:03.932000000
NUMBER_OF_FRAMES: 761
NUMBER_OF_BYTES : 31305
_STATISTICS_WRITING_APP: mkvmerge v68.0.0 ('The Curtain') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-27 18:24:58
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:6(ger): Subtitle: subrip (default)
Metadata:
BPS : 0
DURATION : 00:52:19.678000000
NUMBER_OF_FRAMES: 7
NUMBER_OF_BYTES : 361
_STATISTICS_WRITING_APP: mkvmerge v68.0.0 ('The Curtain') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-27 18:24:58
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:7(eng): Subtitle: subrip (default)
Metadata:
BPS : 77
DURATION : 00:53:18.570000000
NUMBER_OF_FRAMES: 948
NUMBER_OF_BYTES : 31117
_STATISTICS_WRITING_APP: mkvmerge v68.0.0 ('The Curtain') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-27 18:24:58
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:8(hun): Subtitle: subrip (default)
Metadata:
BPS : 66
DURATION : 00:55:48.679000000
NUMBER_OF_FRAMES: 853
NUMBER_OF_BYTES : 27791
_STATISTICS_WRITING_APP: mkvmerge v68.0.0 ('The Curtain') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-27 18:24:58
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:9(pol): Subtitle: subrip (default)
Metadata:
BPS : 67
DURATION : 00:55:46.143000000
NUMBER_OF_FRAMES: 769
NUMBER_OF_BYTES : 28256
_STATISTICS_WRITING_APP: mkvmerge v68.0.0 ('The Curtain') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-27 18:24:58
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:10(slo): Subtitle: subrip (default)
Metadata:
BPS : 67
DURATION : 00:55:46.051000000
NUMBER_OF_FRAMES: 848
NUMBER_OF_BYTES : 28301
_STATISTICS_WRITING_APP: mkvmerge v68.0.0 ('The Curtain') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-27 18:24:58
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (eac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x555b6b8eba80] using SAR=1/1
[libx264 @ 0x555b6b8eba80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x555b6b8eba80] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x555b6b8eba80] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=2 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, hls, to '/config/transcodes/bdbe5804cc6e346935537e30bd5f90fe.m3u8':
Metadata:
encoder : Lavf59.27.100
Stream #0:0: Video: h264, yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 90k tbn (default)
Metadata:
encoder : Lavc59.37.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc59.37.100 aac
frame= 1 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x
frame= 46 fps=0.0 q=0.0 size=N/A time=00:00:01.53 bitrate=N/A speed=2.53x
frame= 54 fps= 48 q=28.0 size=N/A time=00:00:01.79 bitrate=N/A speed= 1.6x
frame= 78 fps= 48 q=28.0 size=N/A time=00:00:02.85 bitrate=N/A speed=1.75x
frame= 100 fps= 47 q=28.0 size=N/A time=00:00:03.88 bitrate=N/A speed=1.82x
frame= 121 fps= 46 q=28.0 size=N/A time=00:00:04.77 bitrate=N/A speed= 1.8x
frame= 141 fps= 45 q=28.0 size=N/A time=00:00:05.56 bitrate=N/A speed=1.76x
frame= 161 fps= 44 q=28.0 size=N/A time=00:00:06.25 bitrate=N/A speed= 1.7x
frame= 180 fps= 43 q=28.0 size=N/A time=00:00:07.01 bitrate=N/A speed=1.68x
frame= 201 fps= 43 q=28.0 size=N/A time=00:00:08.55 bitrate=N/A speed=1.81x
frame= 231 fps= 44 q=28.0 size=N/A time=00:00:09.34 bitrate=N/A speed=1.79x
frame= 262 fps= 46 q=28.0 size=N/A time=00:00:10.60 bitrate=N/A speed=1.85x
frame= 289 fps= 46 q=28.0 size=N/A time=00:00:11.52 bitrate=N/A speed=1.85x
[hls @ 0x555b6b8fd400] Opening '/config/transcodes/bdbe5804cc6e346935537e30bd5f90fe0.ts' for writing
frame= 311 fps= 46 q=28.0 size=N/A time=00:00:12.54 bitrate=N/A speed=1.85x
frame= 336 fps= 46 q=25.0 size=N/A time=00:00:13.82 bitrate=N/A speed= 1.9x
[hls @ 0x555b6b8fd400] Opening '/config/transcodes/bdbe5804cc6e346935537e30bd5f90fe1.ts' for writing
Surprisingly, it is converting from h264 to h264 via software...
Did some random samples, and I could not reproduce it. The transcoding itself is all handled by Jellyfin, so you might have to open an issue upstream. GPU is used on my end when the codecs are available.
@Kevinjil Thank you for the answer. I'll check further and see what could be causing the problem. I'll close the issue if you cannot reproduce it.... I'm using Jellyfin 10.8.10 in a Docker container. What is the version you are targeting?
@Kevinjil I tried to play the same video locally (video downloaded and placed on the movies library) and remotely (using the plugin VOD).
When I played locally, Jellyfin correctly decoded and encoded using hardware, but when playing VOD Jellyfin used software decoding and decoding. I noticed that the command used to call ffmpeg
are different in the logs. Here is for the video played locally:
/videos/95c57f0f-03ce-90f1-029e-cf9aa704a62c/hls1/main/0.ts
{"Protocol":0,"Id":"e4a8fdaff7aa270ac3515efef6adb012","Path":"/media/video/Movies/video.mkv","EncoderPath":null,"EncoderProtocol":null,"Type":0,"Container":"mkv,webm","Size":5966264832,"Name":"2160P","IsRemote":false,"ETag":"913c2199bd921c9773f10631341a4b12","RunTimeTicks":74741866496,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"OpenToken":null,"RequiresClosing":false,"LiveStreamId":null,"BufferMs":null,"RequiresLooping":false,"SupportsProbing":true,"VideoType":0,"IsoType":null,"Video3DFormat":null,"MediaStreams":[{"Codec":"hevc","CodecTag":null,"Language":null,"ColorRange":null,"ColorSpace":"bt709","ColorTransfer":"bt709","ColorPrimaries":"bt709","DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/1000","CodecTimeBase":null,"Title":null,"VideoRange":"SDR","VideoRangeType":"SDR","VideoDoViTitle":null,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"DisplayTitle":"4K HEVC SDR","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":6385994,"BitDepth":10,"RefFrames":1,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":true,"IsForced":false,"Height":1608,"Width":3840,"AverageFrameRate":23.976025,"RealFrameRate":23.976025,"Profile":"Main 10","Type":1,"AspectRatio":"2.40:1","Index":0,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":"yuv420p10le","Level":150,"IsAnamorphic":null},{"Codec":"aac","CodecTag":null,"Language":null,"ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/1000","CodecTimeBase":null,"Title":null,"VideoRange":null,"VideoRangeType":null,"VideoDoViTitle":null,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"DisplayTitle":"AAC - 5.1 - Default","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":"5.1","BitRate":320000,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":6,"SampleRate":48000,"IsDefault":true,"IsForced":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":"LC","Type":0,"AspectRatio":null,"Index":1,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null},{"Codec":"subrip","CodecTag":null,"Language":"eng","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/1000","CodecTimeBase":null,"Title":null,"VideoRange":null,"VideoRangeType":null,"VideoDoViTitle":null,"LocalizedUndefined":"Undefined","LocalizedDefault":"Default","LocalizedForced":"Forced","LocalizedExternal":"External","DisplayTitle":"Eng - Default - SUBRIP","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":true,"IsForced":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":2,"AspectRatio":null,"Index":2,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null},{"Codec":"subrip","CodecTag":null,"Language":"eng","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/1000","CodecTimeBase":null,"Title":"SDH","VideoRange":null,"VideoRangeType":null,"VideoDoViTitle":null,"LocalizedUndefined":"Undefined","LocalizedDefault":"Default","LocalizedForced":"Forced","LocalizedExternal":"External","DisplayTitle":"SDH - Eng - SUBRIP","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":2,"AspectRatio":null,"Index":3,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null},{"Codec":"subrip","CodecTag":null,"Language":"spa","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/1000","CodecTimeBase":null,"Title":"Latin American","VideoRange":null,"VideoRangeType":null,"VideoDoViTitle":null,"LocalizedUndefined":"Undefined","LocalizedDefault":"Default","LocalizedForced":"Forced","LocalizedExternal":"External","DisplayTitle":"Latin American - Spa - SUBRIP","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":2,"AspectRatio":null,"Index":4,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null},{"Codec":"subrip","CodecTag":null,"Language":"fre","ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/1000","CodecTimeBase":null,"Title":"Canadian","VideoRange":null,"VideoRangeType":null,"VideoDoViTitle":null,"LocalizedUndefined":"Undefined","LocalizedDefault":"Default","LocalizedForced":"Forced","LocalizedExternal":"External","DisplayTitle":"Canadian - Fre - SUBRIP","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":2,"AspectRatio":null,"Index":5,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null}],"MediaAttachments":[],"Formats":[],"Bitrate":6705994,"Timestamp":null,"RequiredHttpHeaders":{},"TranscodingUrl":null,"TranscodingSubProtocol":null,"TranscodingContainer":null,"AnalyzeDurationMs":null,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null}
/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -init_hw_device vaapi=va:,driver=iHD,kernel_driver=i915 -init_hw_device qsv=qs@va -filter_hw_device qs -hwaccel qsv -hwaccel_output_format qsv -c:v hevc_qsv -autorotate 0 -i file:"/media/video/Movies/video.mkv" -autoscale 0 -map_metadata -1 -map_chapters -1 -threads 2 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_qsv -preset 7 -look_ahead 0 -b:v 10643323 -maxrate 10643323 -bufsize 21286646 -profile:v:0 high -level 51 -g:v:0 72 -keyint_min:v:0 72 -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale_qsv=format=nv12" -codec:a:0 libfdk_aac -ac 2 -ab 384000 -ar 48000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/config/transcodes/1e6a73932c2bb74e561a456ed615380f%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/config/transcodes/1e6a73932c2bb74e561a456ed615380f.m3u8"
...
Stream mapping:
Stream #0:0 -> #0:0 (hevc (hevc_qsv) -> h264 (h264_qsv))
Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
and here for the VOD:
/videos/10db48e1-bff3-02d6-f2f1-c70dd6c14df1/hls1/main/0.ts
{"Protocol":1,"Id":"798495","Path":"http://.../video.mkv","EncoderPath":null,"EncoderProtocol":1,"Type":0,"Container":null,"Size":null,"Name":"default","IsRemote":true,"ETag":null,"RunTimeTicks":74741870000,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"OpenToken":null,"RequiresClosing":false,"LiveStreamId":null,"BufferMs":null,"RequiresLooping":false,"SupportsProbing":true,"VideoType":null,"IsoType":null,"Video3DFormat":null,"MediaStreams":[],"MediaAttachments":[],"Formats":[],"Bitrate":null,"Timestamp":null,"RequiredHttpHeaders":{},"TranscodingUrl":null,"TranscodingSubProtocol":null,"TranscodingContainer":null,"AnalyzeDurationMs":null,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null}
/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -init_hw_device vaapi=va:,driver=iHD,kernel_driver=i915 -init_hw_device qsv=qs@va -filter_hw_device qs -autorotate 0 -i "http://.../video.mkv" -map_metadata -1 -map_chapters -1 -threads 2 -sn -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/config/transcodes/46230cb9736be8cd70c7a98e1dcdcc02%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/config/transcodes/46230cb9736be8cd70c7a98e1dcdcc02.m3u8"
...
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Jellyfin is not adding a few arguments to make the hardware acceleration work properly in VOD. I tried to change the server version to 10.8.4 and saw no difference. For testing, I added the movie link to the m3u file I use for LiveTV in Jellyfin, and the hardware acceleration worked well for encoding (not decoding). Here is part of the log:
/videos/71d336d5-ab8f-27a1-9e28-72a363b8d66b/live.m3u8
{"Protocol":1,"Id":"446910e0d37d4ce9791051afecac56d5","Path":"http://.../video.mkv","EncoderPath":null,"EncoderProtocol":null,"Type":0,"Container":"mkv,webm","Size":5966264869,"Name":null,"IsRemote":true,"ETag":null,"RunTimeTicks":null,"ReadAtNativeFramerate":false,"IgnoreDts":true,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":false,"SupportsDirectPlay":false,"IsInfiniteStream":true,"RequiresOpening":true,"OpenToken":null,"RequiresClosing":true,"LiveStreamId":"a17c75760a04e99b68cf766e11316e1c_09efa0d56b934a82adec00a87b837fb0_446910e0d37d4ce9791051afecac56d5","BufferMs":null,"RequiresLooping":true,"SupportsProbing":true,"VideoType":null,"IsoType":null,"Video3DFormat":null,"MediaStreams":[{"Codec":"hevc","CodecTag":null,"Language":null,"ColorRange":"tv","ColorSpace":"bt709","ColorTransfer":"bt709","ColorPrimaries":"bt709","DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/1000","CodecTimeBase":null,"Title":null,"VideoRange":"SDR","VideoRangeType":"SDR","VideoDoViTitle":null,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"DisplayTitle":"4K HEVC SDR","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":null,"BitRate":6385994,"BitDepth":10,"RefFrames":1,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":true,"IsForced":false,"Height":1608,"Width":3840,"AverageFrameRate":23.976025,"RealFrameRate":23.976025,"Profile":"Main 10","Type":1,"AspectRatio":"2.40:1","Index":-1,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":"yuv420p10le","Level":150,"IsAnamorphic":false},{"Codec":"aac","CodecTag":null,"Language":null,"ColorRange":null,"ColorSpace":null,"ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/1000","CodecTimeBase":null,"Title":null,"VideoRange":null,"VideoRangeType":null,"VideoDoViTitle":null,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"DisplayTitle":"AAC - 5.1 - Default","NalLengthSize":null,"IsInterlaced":false,"IsAVC":null,"ChannelLayout":"5.1","BitRate":320000,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":6,"SampleRate":48000,"IsDefault":true,"IsForced":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":"LC","Type":0,"AspectRatio":null,"Index":-1,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":null,"Level":0,"IsAnamorphic":null}],"MediaAttachments":[],"Formats":[],"Bitrate":6705994,"Timestamp":null,"RequiredHttpHeaders":{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"},"TranscodingUrl":null,"TranscodingSubProtocol":null,"TranscodingContainer":null,"AnalyzeDurationMs":3000,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null}
/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -user_agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36" -fflags +igndts -stream_loop -1 -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_delay_max 2 -init_hw_device vaapi=va:,driver=iHD,kernel_driver=i915 -init_hw_device qsv=qs@va -filter_hw_device qs -autorotate 0 -i "http://.../video.mkv" -map_metadata -1 -map_chapters -1 -threads 2 -sn -codec:v:0 h264_qsv -preset 7 -look_ahead 0 -b:v 10643323 -maxrate 10643323 -bufsize 21286646 -profile:v:0 high -level 51 -g:v:0 72 -keyint_min:v:0 72 -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,min(3840\,1608*a))/2)*2:trunc(min(max(iw/a\,ih)\,min(3840/a\,1608))/2)*2,format=yuv420p" -flags -global_header -codec:a:0 libfdk_aac -ac 2 -ab 384000 -ar 48000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_base_url "hls/961afda7ab69c47f611a13886b6d710c/" -hls_segment_filename "/config/transcodes/961afda7ab69c47f611a13886b6d710c%d.ts" -hls_playlist_type event -hls_list_size 0 -y "/config/transcodes/961afda7ab69c47f611a13886b6d710c.m3u8"
...
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_qsv))
Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
So I wonder if some flags need to be set to enable hardware acceleration with VAAPI. I tried a Jellyfin server on a Windows machine with AMD AMF, and the plugin worked well with hardware transcoding.
Since it works on local files and even in LiveTV, I'm unsure if I can report issue upstream... I wonder if you have any idea of where I could try to look.
Ok,
I found a way to fix this problem in my case. I added some content of MediaStreams
in MediaSourceInfo()
in the file:
So, now the function MediaSourceInfo
returns:
return new MediaSourceInfo()
{
EncoderProtocol = MediaProtocol.Http,
Id = id.ToString(CultureInfo.InvariantCulture),
IsInfiniteStream = isLive,
IsRemote = true,
Path = uri,
Protocol = MediaProtocol.Http,
MediaStreams = new MediaStream[]
{
new MediaStream
{
Type = MediaStreamType.Video,
// Set the index to -1 because we don't know the exact index of the video stream within the container
Index = -1,
IsInterlaced = true
},
new MediaStream
{
Type = MediaStreamType.Audio,
// Set the index to -1 because we don't know the exact index of the audio stream within the container
Index = -1
}
},
RequiresClosing = restream,
RequiresOpening = restream,
SupportsDirectPlay = true,
SupportsDirectStream = true,
SupportsProbing = true,
};
It seems that if MediaStreams
is empty, it doesn't get populated when ffprobe
is called, and when jellyfin calls ffmpeg
, it doesn't give all the stream details.
To give a better context, I'm running Jellyfin in a Docker container on a Linux machine. Jellyfin version is 10.8.10
, and I'm using the integrated intel GPU with QuickSync driver.
Got inspiration from the file:
https://github.com/jellyfin/jellyfin/blob/e5dcaa6ed52a22360958e5d2054f55924f2a1512/Emby.Server.Implementations/LiveTv/LiveTvManager.cs#L315
That actually didn't fix all the problems. It probably messed with all the media information, and I ended up getting hardware acceleration in some scenarios.
I tried a new installation of Jellyfin 10.8.4
with plugin release 0.6.1.0
on a Windows machine, and I can reproduce the lack of hardware acceleration as it happens on my Linux server.
Jellyfin stores information about the media in many different places. I found information about the stream in:
metadata/channels/...
cache/channels/...
and likely in the Jellyfin database
When ffprobe
checks the stream, it stores the information about the media in the database, from what I could see, and not in the files in metadata/channels/../../channelmediasourceinfos.json
or cache/channels/../../*.json
which are created when the lists are updated.
When Jellyfin tries to play the stream, the file in metadata/channels/../../channelmediasourceinfos.json
seems to get priority and the information gathered by ffprobe
is not used. So the result is that ffmpeg
does not know relevant information from the stream to enable hardware transcoding.
I did some tests after removing metadata/channels/../../channelmediasourceinfos.json
files, and it properly transcoded using hardware acceleration because jellyfin likely used the information from ffprobe
stored in the database.
It would solve the problem by removing the *.json
files, but every time the channels are updated the *.json
files get restored, so it would be good to avoid the creation of them or make ffprobe
stores the information on them, but I could not find where in the plugin source to fix this. The source responsible for the creation of the files is this one:
So, @Kevinjil, to replicate this problem, you probably need a clean installation. If you have time to check this, let me know if you can reproduce the problems and if something on the plugin side can be done to fix this. If nothing can be done on the plugin side, I'll try to open this issue upstream.
Thank you for all the work
I will check when I have some time, thanks for the input.
I'm interested on this issue too...
I have the same problem
impossible to read VOD and series
reading fails
Having the same issue I think. I have both a Debian Linux instance and Windows instance and both my CPUs max out when watching Series or VOD. But LiveTV is fine.
Same problem here, maybe it has something to do with the container or encoder container, which a mediasource can have. But is not set in the plugin. It's just a idea, don't know if it's really the problem.
I am experiencing the same issue