2024-05-01, 12:15 PM
While attempting to watch videos on the Jellyfin iOS app with the subtitle burning feature, I encountered a problem where the video continuously loads without ever starting. Through the logs, it became evident that the application is endlessly trying to run FFMPEG for streaming, although it constantly results in a failure.
Configuration Details:
Physical Machine: PVE 6.8.4-2
Virtual Machine: Ubuntu 22.04 with direct pass-through for Nvidia 3050 graphics card
Jellyfin Installation: Running in Docker with the latest Jellyfin:unstable image.
In the Jellyfin startup logs, the mention of av1_nvenc as a supported codec has been a cause of confusion, considering my graphics card's capability. The detailed logs are as:
Quote:[19:16:42] [INF] [32] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for root. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: TrueOn a closer look at the FFMPEG logs, it appears that the issue is related to usage of the av1_nvenc encoder:
[19:16:43] [INF] [35] Jellyfin.Api.Controllers.DynamicHlsController: Current HLS implementation doesn't support non-keyframe breaks but one is requested, ignoring that request
[19:16:43] [INF] [35] MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: /usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -probesize 1G -init_hw_device cuda=cu:0 -filter_hw_device cu -hwaccel cuda -hwaccel_output_format cuda -hwaccel_flags +unsafe_output -threads 1 -noautorotate -i file:"/media/american anime/Rick and Morty (2013)/Season 2/S02E04.mkv" -noautoscale -map_metadata -1 -map_chapters -1 -threads 6 -map 0:0 -map 0:1 -map -0:0 -codec:v:0 av1_nvenc -preset p1 -b:v 7073323 -maxrate 7073323 -bufsize 14146646 -g:v:0 72 -keyint_min:v:0 72 -filter_complex "alphasrc=s=1920x1080:r=23.976025:start='0',format=yuva420p,subtitles=f='/media/american anime/Rick and Morty (2013)/Season 2/S02E04.ass':alpha=1:sub2video=1:fontsdir='/cache/attachments/7b45f55261b70ffbf479d4f55c72594f',hwupload=derive_device=cuda[sub];[0:0]setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale_cuda=format=yuv420p[main];[main][sub]overlay_cuda=eof_action=pass:repeatlast=0" -start_at_zero -codec:a:0 libfdk_aac -ac 6 -vbr:a 5 -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type fmp4 -hls_fmp4_init_filename "ca1c7e297947b36848ae0a84c1d6a721-1.mp4" -start_number 0 -hls_segment_filename "/cache/transcodes/ca1c7e297947b36848ae0a84c1d6a721%d.mp4" -hls_playlist_type vod -hls_list_size 0 -y "/cache/transcodes/ca1c7e297947b36848ae0a84c1d6a721.m3u8"
[19:16:44] [ERR] [35] MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: FFmpeg exited with code 1
[19:16:44] [ERR] [35] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL GET /videos/7b45f552-61b7-0ffb-f479-d4f55c72594f/hls1/main/-1.mp4.
MediaBrowser.Common.FfmpegException: FFmpeg exited with code 1
Quote:ffmpeg version 6.0.1-Jellyfin Copyright © 2000-2023 the FFmpeg developersAs far as my understanding, the graphics card I use, Nvidia 3050, only supports AV1 decoding, while only the 40 series graphics cards begin to support AV1 NVENC. This raises the question, why was AV1 chosen as the default encoder? Additionally, how can I manually switch from it to a supported encoder like hevc_nvenc or h264_nvenc?
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-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, matroska,webm, from 'file:/media/american anime/Rick and Morty (2013)/Season 2/S02E04.mkv':
Metadata:
encoder : libebml v1.3.3 + libmatroska v1.4.4
creation_time : 2016-06-08T01:19:01.000000Z
Duration: 00:21:56.51, start: 0.000000, bitrate: 7073 kb/s
Chapters:
Chapter #0:0: start 0.000000, end 102.102000
Metadata:
title : 00:00:00.000
Chapter #0:1: start 102.102000, end 133.925000
Metadata:
title : 00:01:42.102
Chapter #0:2: start 133.925000, end 571.488000
Metadata:
title : 00:02:13.925
Chapter #0:3: start 571.488000, end 1232.773000
Metadata:
title : 00:09:31.488
Chapter #0:4: start 1232.773000, end 1264.263000
Metadata:
title : 00:20:32.773
Chapter #0:5: start 1264.263000, end 1316.512000
Metadata:
title : 00:21:04.263
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 : 6431608
BPS-eng : 6431608
DURATION : 00:21:56.482000000
DURATION-eng : 00:21:56.482000000
NUMBER_OF_FRAMES: 31564
NUMBER_OF_FRAMES-eng: 31564
NUMBER_OF_BYTES : 1058387046
NUMBER_OF_BYTES-eng: 1058387046
_STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit
_STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit
_STATISTICS_WRITING_DATE_UTC: 2016-06-08 01:19:01
_STATISTICS_WRITING_DATE_UTC-eng: 2016-06-08 01:19:01
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
Metadata:
BPS : 640000
BPS-eng : 640000
DURATION : 00:21:56.512000000
DURATION-eng : 00:21:56.512000000
NUMBER_OF_FRAMES: 41141
NUMBER_OF_FRAMES-eng: 41141
NUMBER_OF_BYTES : 105320960
NUMBER_OF_BYTES-eng: 105320960
_STATISTICS_WRITING_APP: mkvmerge v9.2.0 ('Photograph') 64bit
_STATISTICS_WRITING_APP-eng: mkvmerge v9.2.0 ('Photograph') 64bit
_STATISTICS_WRITING_DATE_UTC: 2016-06-08 01:19:01
_STATISTICS_WRITING_DATE_UTC-eng: 2016-06-08 01:19:01
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[Parsed_subtitles_2 @ 0x5afdb64aac80] libass API version: 0x1701000
[Parsed_subtitles_2 @ 0x5afdb64aac80] libass source: commit: 0.17.1-0-ge8ad72accd3a84268275a9385beb701c9284e5b3
[Parsed_subtitles_2 @ 0x5afdb64aac80] Shaper: FriBidi 1.0.13 (SIMPLE) HarfBuzz-ng 8.4.0 (COMPLEX)
[Parsed_subtitles_2 @ 0x5afdb64aac80] Using font provider fontconfig
Stream mapping:
Stream #0:0 (h264) -> setparams:default (graph 0)
overlay_cuda:default (graph 0) -> Stream #0:0 (av1_nvenc)
Stream #0:1 -> #0:1 (ac3 (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[libfdk_aac @ 0x5afdb63f3000] Note, the VBR setting is unsupported and only works with some parameter combinations
[Parsed_subtitles_2 @ 0x5afdb6743440] libass API version: 0x1701000
[Parsed_subtitles_2 @ 0x5afdb6743440] libass source: commit: 0.17.1-0-ge8ad72accd3a84268275a9385beb701c9284e5b3
[Parsed_subtitles_2 @ 0x5afdb6743440] Shaper: FriBidi 1.0.13 (SIMPLE) HarfBuzz-ng 8.4.0 (COMPLEX)
[Parsed_subtitles_2 @ 0x5afdb6743440] Using font provider fontconfig
[Parsed_subtitles_2 @ 0x5afdb6743440] fontselect: (Arial, 400, 0) -> /usr/local/share/fonts/Arial.ttf, 0, ArialMT
[Parsed_subtitles_2 @ 0x5afdb6743440] fontselect: (Arial, 700, 0) -> /usr/local/share/fonts/Arial.ttf, 0, ArialMT
[Parsed_subtitles_2 @ 0x5afdb6743440] fontselect: (时尚中黑简体, 700, 0) -> /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf, 0, DejaVuSans-Bold
[Parsed_subtitles_2 @ 0x5afdb6743440] Glyph 0x7FFB not found, selecting one more font for (时尚中黑简体, 700, 0)
[Parsed_subtitles_2 @ 0x5afdb6743440] fontselect: (时尚中黑简体, 700, 0) -> /usr/local/share/fonts/msyhbd.ttc, 0, MicrosoftYaHei-Bold
[av1_nvenc @ 0x5afdb6407680] Codec not supported
[av1_nvenc @ 0x5afdb6407680] Provided device doesn't support required NVENC features
[vost#0:0/av1_nvenc @ 0x5afdb6413640] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[libfdk_aac @ 0x5afdb63f3000] 2 frames left in the queue on closing
Conversion failed!
Configuration Details:
Physical Machine: PVE 6.8.4-2
Virtual Machine: Ubuntu 22.04 with direct pass-through for Nvidia 3050 graphics card
Jellyfin Installation: Running in Docker with the latest Jellyfin:unstable image.
In the Jellyfin startup logs, the mention of av1_nvenc as a supported codec has been a cause of confusion, considering my graphics card's capability. The detailed logs are as:
Quote:[19:15:39] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available decoders: ["libdav1d", "av1", "av1_cuvid", "av1_qsv", "h264", "h264_qsv", "h264_cuvid", "hevc", "hevc_qsv", "hevc_cuvid", "mpeg2video", "mpeg2_qsv", "mpeg2_cuvid", "mpeg4", "mpeg4_cuvid", "msmpeg4", "vc1_qsv", "vc1_cuvid", "vp8", "libvpx", "vp8_cuvid", "vp8_qsv", "vp9", "libvpx-vp9", "vp9_cuvid", "vp9_qsv", "aac", "ac3", "dca", "flac", "mp3", "truehd"]
[19:15:39] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available encoders: ["libsvtav1", "av1_nvenc", "av1_qsv", "av1_amf", "av1_vaapi", "libx264", "h264_amf", "h264_nvenc", "h264_qsv", "h264_v4l2m2m", "h264_vaapi", "libx265", "hevc_amf", "hevc_nvenc", "hevc_qsv", "hevc_vaapi", "mpeg4", "msmpeg4", "libvpx", "libvpx-vp9", "aac", "libfdk_aac", "ac3", "alac", "dca", "flac", "libmp3lame", "libopus", "truehd", "libvorbis", "srt"]
[19:15:39] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available filters: ["deinterlace_qsv", "deinterlace_vaapi", "hwupload_cuda", "hwupload_vaapi", "libplacebo", "overlay_opencl", "overlay_qsv", "overlay_vaapi", "overlay_vulkan", "overlay_cuda", "procamp_vaapi", "scale_cuda", "scale_opencl", "scale_qsv", "scale_vaapi", "scale_vulkan", "tonemap_cuda", "tonemap_opencl", "tonemap_vaapi", "vpp_qsv", "yadif_cuda", "zscale", "alphasrc"]
[19:15:39] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available hwaccel types: ["cuda", "vaapi", "qsv", "drm", "opencl", "vulkan"]