jellyfin / jellyfin-chromecast

Chromecast Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
137 stars 43 forks source link

Always transcodes video for Chromecast #647

Closed LinAGKar closed 1 week ago

LinAGKar commented 3 weeks ago

This issue respects the following points:

Description of the bug

Jellyfin always transcodes videos if this is allowed for a user, when playing on chromecast.

Reproduction steps

  1. Add an mkv/mp4+h.264+aac video
  2. Play on Chromecast

What is the current bug behavior?

It always transcodes the video if allowed. If I disable "Allow video playbach that requires transcoding", it will just remux the video instead, poiving it didn't need to transcode it.

What is the expected correct behavior?

Only transcodes if necessary. Plays mkv+h.264+aac via remuxing and mp4+h.264+aac via direct play.

Jellyfin Server version

10.9.11+

Specify commit id

No response

Specify unstable release number

No response

Specify version number

No response

Specify the build version

10.9.11

Environment

- OS: OpenSUSE Leap 15.6
- Linux Kernel: 6.4.0-150600.23.25-default
- Virtualization: Docker
- Clients: Android, Chromecast
- FFmpeg Version: 6.0.1-Jellyfin
- Hardware Acceleration: None
- GPU Model: None
- Plugins: None
- Reverse Proxy: Nginx
- Base URL: None
- Networking: Bridge
- Storage: local

Jellyfin logs

[2024-10-25 20:26:47.874 +00:00] [INF] [65] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "fd7a:115c:a1e0::fd01:6c6e" request
[2024-10-25 20:26:59.254 +00:00] [INF] [78] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "fd7a:115c:a1e0:ab12:4843:cd96:6252:1757" closed
[2024-10-25 20:27:00.326 +00:00] [INF] [78] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "fd7a:115c:a1e0:ab12:4843:cd96:6252:1757" request
[2024-10-25 20:27:01.634 +00:00] [INF] [78] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for "Linus". EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[2024-10-25 20:27:02.878 +00:00] [INF] [78] MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: "/usr/lib/jellyfin-ffmpeg/ffmpeg" "-analyzeduration 200M -probesize 1G -f mov,mp4,m4a,3gp,3g2,mj2 -noautorotate -i file:\"/media/.movie/test.mp4\" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 libx264 -preset veryfast -crf 18 -maxrate 5909434 -bufsize 11818868 -profile:v:0 high -level 40 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames:0 \"expr:gte(t,n_forced*3)\" -sc_threshold:v:0 0 -vf \"setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,1280)/2)*2:trunc(ow/a/2)*2,format=yuv420p\" -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 0 -hls_segment_filename \"/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba9%d.ts\" -hls_playlist_type vod -hls_list_size 0 -y \"/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba9.m3u8\""

FFmpeg logs

{"Protocol":0,"Id":"f310dd9028bb440c8e94d6f0a2dad79d","Path":"/media/.movie/test.mp4","EncoderPath":null,"EncoderProtocol":null,"Type":0,"Container":"mov,mp4,m4a,3gp,3g2,mj2","Size":1583435018,"Name":"test","IsRemote":false,"ETag":"2421ccfc0ee6cdbee616dffbf00ba33f","RunTimeTicks":20760744380,"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":"h264","CodecTag":"avc1","Language":"eng","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/16000","CodecTimeBase":null,"Title":null,"VideoRange":1,"VideoRangeType":1,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"LocalizedHearingImpaired":null,"DisplayTitle":"1080p H264 SDR","NalLengthSize":"4","IsInterlaced":false,"IsAVC":true,"ChannelLayout":null,"BitRate":5909434,"BitDepth":8,"RefFrames":1,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":true,"IsForced":false,"IsHearingImpaired":false,"Height":1080,"Width":1920,"AverageFrameRate":23.975536,"RealFrameRate":23.976025,"Profile":"High","Type":1,"AspectRatio":"16:9","Index":0,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":"yuv420p","Level":40,"IsAnamorphic":false},{"Codec":"aac","CodecTag":"mp4a","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/48000","CodecTimeBase":null,"Title":null,"VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":"Standard","LocalizedForced":null,"LocalizedExternal":"Extern","LocalizedHearingImpaired":null,"DisplayTitle":"English - AAC - Stereo - Standard","NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":"stereo","BitRate":185799,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":2,"SampleRate":48000,"IsDefault":true,"IsForced":false,"IsHearingImpaired":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":"bin_data","CodecTag":"text","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":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"LocalizedHearingImpaired":null,"DisplayTitle":null,"NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":null,"Width":null,"AverageFrameRate":null,"RealFrameRate":null,"Profile":null,"Type":4,"AspectRatio":null,"Index":2,"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":6101650,"Timestamp":null,"RequiredHttpHeaders":{},"TranscodingUrl":null,"TranscodingSubProtocol":0,"TranscodingContainer":null,"AnalyzeDurationMs":null,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null}

/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -probesize 1G -f mov,mp4,m4a,3gp,3g2,mj2 -noautorotate -i file:"/media/.movie/test.mp4" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 libx264 -preset veryfast -crf 18 -maxrate 5909434 -bufsize 11818868 -profile:v:0 high -level 40 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames:0 "expr:gte(t,n_forced*3)" -sc_threshold:v:0 0 -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,1280)/2)*2:trunc(ow/a/2)*2,format=yuv420p" -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 0 -hls_segment_filename "/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba9%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba9.m3u8"

ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --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-opencl --enable-libdrm --enable-libxml2 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libsvtav1 --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:/media/.movie/test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.76.100
  Duration: 00:34:36.07, start: 0.000000, bitrate: 6101 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 5909 kb/s, 23.98 fps, 23.98 tbr, 16k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 185 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Data: bin_data (text / 0x74786574)
    Metadata:
      handler_name    : SubtitleHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x55864219eac0] using SAR=1/1
[libx264 @ 0x55864219eac0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55864219eac0] profile Main, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x55864219eac0] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=4 chroma_me=0 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=22 lookahead_threads=3 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=1 keyint=250 keyint_min=23 scenecut=0 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=5909 vbv_bufsize=11818 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, hls, to '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba9.m3u8':
  Metadata:
    encoder         : Lavf60.3.100
  Stream #0:0: Video: h264, yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 90k tbn (default)
    Metadata:
      encoder         : Lavc60.3.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 5909000/0/0 buffer size: 11818000 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 185 kb/s (default)
frame=    0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba90.ts' for writing
frame=  112 fps=0.0 q=23.0 size=N/A time=00:00:06.10 bitrate=N/A dup=1 drop=0 speed=10.9x    
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba91.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba92.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba93.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba94.ts' for writing
frame=  379 fps=357 q=23.0 size=N/A time=00:00:17.23 bitrate=N/A dup=1 drop=0 speed=16.2x    
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba95.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba96.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba97.ts' for writing
frame=  589 fps=377 q=23.0 size=N/A time=00:00:26.00 bitrate=N/A dup=1 drop=0 speed=16.6x    
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba98.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba99.ts' for writing
frame=  792 fps=384 q=23.0 size=N/A time=00:00:34.47 bitrate=N/A dup=1 drop=0 speed=16.7x    
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba910.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba911.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba912.ts' for writing
frame=  988 fps=385 q=23.0 size=N/A time=00:00:42.64 bitrate=N/A dup=1 drop=0 speed=16.6x    
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba913.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba914.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba915.ts' for writing
frame= 1182 fps=386 q=23.0 size=N/A time=00:00:50.73 bitrate=N/A dup=1 drop=0 speed=16.6x    
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba916.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba917.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba918.ts' for writing
frame= 1376 fps=386 q=23.0 size=N/A time=00:00:58.81 bitrate=N/A dup=1 drop=0 speed=16.5x    
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba919.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba920.ts' for writing
frame= 1566 fps=385 q=23.0 size=N/A time=00:01:06.75 bitrate=N/A dup=1 drop=0 speed=16.4x    
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba921.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba922.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba923.ts' for writing
frame= 1742 fps=381 q=23.0 size=N/A time=00:01:14.09 bitrate=N/A dup=1 drop=0 speed=16.2x    
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba924.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba925.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba926.ts' for writing
frame= 1990 fps=393 q=23.0 size=N/A time=00:01:24.43 bitrate=N/A dup=1 drop=0 speed=16.7x    
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba927.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba928.ts' for writing
[hls @ 0x5586421a3a40] Opening '/config/transcodes/d63a16eac7b61046af5014b8cdbc4ba929.ts' for writing

Client / Browser logs

No response

Relevant screenshots or videos

No response

Additional information

No response

3flex commented 2 weeks ago

This may be fixed by #663. Can you please check using unstable Cast client?

I had a similar file that was H264 + AAC which was 1080p, but the client would always ask Jellyfin to downscale to 720p. In the logs you provided I can see the input file was 1920x1080 but the output was 1280x720.

LinAGKar commented 1 week ago

Yes, this does not seem to happen with unstable cast client.

3flex commented 1 week ago

Thanks for confirming, I think this can be closed then as it was fixed by #663.