jellyfin / jellyfin-ffmpeg

FFmpeg for Jellyfin
https://jellyfin.org
Other
497 stars 131 forks source link

Intel Arc transcoding failure #440

Open viggy96 opened 2 months ago

viggy96 commented 2 months ago

Describe The Bug Many media files fail to transcode using QSV or VAAPI.

Steps To Reproduce

  1. Enable QSV or VAAPI
  2. Attempt to play file with transcoding (by lowering quality or other method)
  3. Profit

Expected Behavior Playback occurs smoothly.

System (please complete the following information):

MediaInfo

S01E03 Summer in Jura Bluray-1080p
Container: mkv
Path: /media/video/TV/The Slime Diaries - That Time I Got Reincarnated as a Slime/Season 1/S01E03 Summer in Jura Bluray-1080p.mkv
Size: 434 MB

Video
Title: Presented By EMBER - 1080p - HEVC - SDR
Codec: HEVC
AVC: No
Profile: Main 10
Level: 123
Resolution: 1920x1080
Aspect ratio: 16:9
Anamorphic: No
Interlaced: No
Framerate: 23.976025
Bitrate: 2557 kbps
Bit depth: 10 bit
Video range: SDR
Video range type: SDR
Color space: bt709
Color transfer: bt709
Color primaries: bt709
Pixel format: yuv420p10le
Ref frames: 1

Audio
Title: Japanese - Dolby Digital - Stereo - Default
Language: jpn
Codec: AC3
AVC: No
Layout: stereo
Channels: 2 ch
Bitrate: 224 kbps
Sample rate: 48000 Hz
Default: Yes
Forced: No
External: No

Subtitle
Title: Moe - English - Default - ASS
Language: eng
Codec: ASS
AVC: No
Default: Yes
Forced: No
External: No

Image
Codec: MJPEG
AVC: No
Profile: Baseline
Resolution: 1684x2114
Bit depth: 8 bit
Color space: bt470bg
Pixel format: yuvj420p
Ref frames: 1

FFmpeg Logs

{"Protocol":0,"Id":"b603e89716205577c1bd5608440da08d","Path":"/media/video/TV/The Slime Diaries - That Time I Got Reincarnated as a Slime/Season 1/S01E03 Summer in Jura Bluray-1080p.mkv","EncoderPath":null,"EncoderProtocol":null,"Type":0,"Container":"mkv","Size":454700407,"Name":"S01E03 Summer in Jura Bluray-1080p","IsRemote":false,"ETag":"fc76e32e8d4f4a5407892902420a6bb4","RunTimeTicks":14221120000,"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":"Presented By EMBER","VideoRange":1,"VideoRangeType":1,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"LocalizedHearingImpaired":null,"DisplayTitle":"Presented By EMBER - 1080p - HEVC - SDR","NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":null,"BitRate":2557888,"BitDepth":10,"RefFrames":1,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":true,"IsForced":false,"IsHearingImpaired":false,"Height":1080,"Width":1920,"AverageFrameRate":23.976025,"RealFrameRate":23.976025,"Profile":"Main 10","Type":1,"AspectRatio":"16:9","Index":0,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":"yuv420p10le","Level":123,"IsAnamorphic":false},{"Codec":"ac3","CodecTag":null,"Language":"jpn","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":"Default","LocalizedForced":null,"LocalizedExternal":"External","LocalizedHearingImpaired":null,"DisplayTitle":"Japanese - Dolby Digital - Stereo - Default","NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":"stereo","BitRate":224000,"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":null,"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":"ass","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":"Moe","VideoRange":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":"Undefined","LocalizedDefault":"Default","LocalizedForced":"Forced","LocalizedExternal":"External","LocalizedHearingImpaired":"Hearing Impaired","DisplayTitle":"Moe - English - Default - ASS","NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":null,"BitRate":null,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":true,"IsForced":false,"IsHearingImpaired":false,"Height":0,"Width":0,"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":"mjpeg","CodecTag":null,"Language":null,"ColorRange":null,"ColorSpace":"bt470bg","ColorTransfer":null,"ColorPrimaries":null,"DvVersionMajor":null,"DvVersionMinor":null,"DvProfile":null,"DvLevel":null,"RpuPresentFlag":null,"ElPresentFlag":null,"BlPresentFlag":null,"DvBlSignalCompatibilityId":null,"Comment":null,"TimeBase":"1/90000","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":8,"RefFrames":1,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Height":2114,"Width":1684,"AverageFrameRate":null,"RealFrameRate":90000,"Profile":"Baseline","Type":3,"AspectRatio":"842:1057","Index":3,"Score":null,"IsExternal":false,"DeliveryMethod":null,"DeliveryUrl":null,"IsExternalUrl":null,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Path":null,"PixelFormat":"yuvj420p","Level":-99,"IsAnamorphic":false}],"MediaAttachments":[{"Codec":"mjpeg","CodecTag":"[0][0][0][0]","Comment":null,"Index":3,"FileName":"cover.jpg","MimeType":"image/jpeg","DeliveryUrl":null},{"Codec":"ttf","CodecTag":"[0][0][0][0]","Comment":null,"Index":4,"FileName":"roundirregularity.ttf","MimeType":"application/x-truetype-font","DeliveryUrl":null},{"Codec":"ttf","CodecTag":"[0][0][0][0]","Comment":null,"Index":5,"FileName":"RUZICKATYPEK.TTF","MimeType":"application/x-truetype-font","DeliveryUrl":null},{"Codec":"ttf","CodecTag":"[0][0][0][0]","Comment":null,"Index":6,"FileName":"SNsanafonkaku.ttf","MimeType":"application/x-truetype-font","DeliveryUrl":null},{"Codec":"ttf","CodecTag":"[0][0][0][0]","Comment":null,"Index":7,"FileName":"arialbd.ttf","MimeType":"application/x-truetype-font","DeliveryUrl":null},{"Codec":"otf","CodecTag":"[0][0][0][0]","Comment":null,"Index":8,"FileName":"GandhiSans-Bold.otf","MimeType":"application/vnd.ms-opentype","DeliveryUrl":null},{"Codec":"otf","CodecTag":"[0][0][0][0]","Comment":null,"Index":9,"FileName":"GandhiSans-BoldItalic.otf","MimeType":"application/vnd.ms-opentype","DeliveryUrl":null},{"Codec":"ttf","CodecTag":"[0][0][0][0]","Comment":null,"Index":10,"FileName":"impact.ttf","MimeType":"application/x-truetype-font","DeliveryUrl":null},{"Codec":"ttf","CodecTag":"[0][0][0][0]","Comment":null,"Index":11,"FileName":"Marker_SD_1.2.ttf","MimeType":"application/x-truetype-font","DeliveryUrl":null},{"Codec":"ttf","CodecTag":"[0][0][0][0]","Comment":null,"Index":12,"FileName":"NotJustGroovy-enmp.ttf","MimeType":"application/x-truetype-font","DeliveryUrl":null},{"Codec":"ttf","CodecTag":"[0][0][0][0]","Comment":null,"Index":13,"FileName":"pastel crayon.ttf","MimeType":"application/x-truetype-font","DeliveryUrl":null},{"Codec":"ttf","CodecTag":"[0][0][0][0]","Comment":null,"Index":14,"FileName":"quadrat-regulareclipse.ttf","MimeType":"application/x-truetype-font","DeliveryUrl":null}],"Formats":[],"Bitrate":2781888,"Timestamp":null,"RequiredHttpHeaders":{},"TranscodingUrl":null,"TranscodingSubProtocol":0,"TranscodingContainer":null,"AnalyzeDurationMs":null,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null}

/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -probesize 1G -hwaccel vaapi -hwaccel_output_format vaapi -noautorotate -i file:"/media/video/TV/The Slime Diaries - That Time I Got Reincarnated as a Slime/Season 1/S01E03 Summer in Jura Bluray-1080p.mkv" -noautoscale -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -codec:v:0 h264_vaapi -rc_mode VBR -b:v 8526293 -maxrate 8526293 -bufsize 17052586 -sei -a53_cc -force_key_frames:0 "expr:gte(t,n_forced*3)" -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale_vaapi=format=nv12:extra_hw_frames=24,hwmap,format=nv12,subtitles=f='/media/video/TV/The Slime Diaries - That Time I Got Reincarnated as a Slime/Season 1/S01E03 Summer in Jura Bluray-1080p.mkv':si=0:fontsdir='/cache/attachments/b603e89716205577c1bd5608440da08d',hwmap,format=vaapi" -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 0 -hls_segment_filename "/transcodes/d6cb6ef2d18c6fe377657cf7cfb69b5d%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/transcodes/d6cb6ef2d18c6fe377657cf7cfb69b5d.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, matroska,webm, from 'file:/media/video/TV/The Slime Diaries - That Time I Got Reincarnated as a Slime/Season 1/S01E03 Summer in Jura Bluray-1080p.mkv':
  Metadata:
    title           : S01E03-EMBER
    encoder         : libebml v1.4.2 + libmatroska v1.6.4
    creation_time   : 2021-08-14T02:10:07.000000Z
  Duration: 00:23:42.11, start: 0.000000, bitrate: 2557 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 77.994244
      Metadata:
        title           : Intro
    Chapter #0:1: start 77.994244, end 168.042533
      Metadata:
        title           : OP
    Chapter #0:2: start 168.042533, end 630.045733
      Metadata:
        title           : Part A
    Chapter #0:3: start 630.045733, end 1212.043822
      Metadata:
        title           : Part B
    Chapter #0:4: start 1212.043822, end 1302.050400
      Metadata:
        title           : ED
    Chapter #0:5: start 1302.050400, end 1409.032289
      Metadata:
        title           : Extra
    Chapter #0:6: start 1409.032289, end 1422.112000
      Metadata:
        title           : PV
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn (default)
    Metadata:
      title           : Presented By EMBER
      BPS             : 2268315
      DURATION        : 00:23:42.088000000
      NUMBER_OF_FRAMES: 34096
      NUMBER_OF_BYTES : 403218020
      _STATISTICS_WRITING_APP: mkvmerge v57.0.0 ('Till The End') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-08-14 02:10:07
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1(jpn): Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s (default)
    Metadata:
      BPS             : 224000
      DURATION        : 00:23:42.112000000
      NUMBER_OF_FRAMES: 44441
      NUMBER_OF_BYTES : 39819136
      _STATISTICS_WRITING_APP: mkvmerge v57.0.0 ('Till The End') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-08-14 02:10:07
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:2(eng): Subtitle: ass (default)
    Metadata:
      title           : Moe
      BPS             : 667
      DURATION        : 00:23:37.340000000
      NUMBER_OF_FRAMES: 937
      NUMBER_OF_BYTES : 118296
      _STATISTICS_WRITING_APP: mkvmerge v57.0.0 ('Till The End') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-08-14 02:10:07
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:3: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1684x2114 [SAR 300:300 DAR 842:1057], 90k tbr, 90k tbn (attached pic)
    Metadata:
      filename        : cover.jpg
      mimetype        : image/jpeg
  Stream #0:4: Attachment: ttf
    Metadata:
      filename        : roundirregularity.ttf
      mimetype        : application/x-truetype-font
  Stream #0:5: Attachment: ttf
    Metadata:
      filename        : RUZICKATYPEK.TTF
      mimetype        : application/x-truetype-font
  Stream #0:6: Attachment: ttf
    Metadata:
      filename        : SNsanafonkaku.ttf
      mimetype        : application/x-truetype-font
  Stream #0:7: Attachment: ttf
    Metadata:
      filename        : arialbd.ttf
      mimetype        : application/x-truetype-font
  Stream #0:8: Attachment: otf
    Metadata:
      filename        : GandhiSans-Bold.otf
      mimetype        : application/vnd.ms-opentype
  Stream #0:9: Attachment: otf
    Metadata:
      filename        : GandhiSans-BoldItalic.otf
      mimetype        : application/vnd.ms-opentype
  Stream #0:10: Attachment: ttf
    Metadata:
      filename        : impact.ttf
      mimetype        : application/x-truetype-font
  Stream #0:11: Attachment: ttf
    Metadata:
      filename        : Marker_SD_1.2.ttf
      mimetype        : application/x-truetype-font
  Stream #0:12: Attachment: ttf
    Metadata:
      filename        : NotJustGroovy-enmp.ttf
      mimetype        : application/x-truetype-font
  Stream #0:13: Attachment: ttf
    Metadata:
      filename        : pastel crayon.ttf
      mimetype        : application/x-truetype-font
  Stream #0:14: Attachment: ttf
    Metadata:
      filename        : quadrat-regulareclipse.ttf
      mimetype        : application/x-truetype-font
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_vaapi))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[hevc @ 0x611f0e86ba00] Failed to create decode context: 2 (resource allocation failed).
[hevc @ 0x611f0e86ba00] Failed setup for format vaapi: hwaccel initialisation returned error.
[Parsed_subtitles_4 @ 0x611f0e6fdb40] libass API version: 0x1703000
[Parsed_subtitles_4 @ 0x611f0e6fdb40] libass source: commit: 0.17.3-0-ge46aedea0a0d17da4c4ef49d84b94a7994664ab5
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Shaper: FriBidi 1.0.15 (SIMPLE) HarfBuzz-ng 9.0.0 (COMPLEX)
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Loading font file '/cache/attachments/b603e89716205577c1bd5608440da08d/GandhiSans-Bold.otf'
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Loading font file '/cache/attachments/b603e89716205577c1bd5608440da08d/impact.ttf'
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Loading font file '/cache/attachments/b603e89716205577c1bd5608440da08d/arialbd.ttf'
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Loading font file '/cache/attachments/b603e89716205577c1bd5608440da08d/pastel crayon.ttf'
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Loading font file '/cache/attachments/b603e89716205577c1bd5608440da08d/GandhiSans-BoldItalic.otf'
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Loading font file '/cache/attachments/b603e89716205577c1bd5608440da08d/Marker_SD_1.2.ttf'
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Loading font file '/cache/attachments/b603e89716205577c1bd5608440da08d/quadrat-regulareclipse.ttf'
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Loading font file '/cache/attachments/b603e89716205577c1bd5608440da08d/SNsanafonkaku.ttf'
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Loading font file '/cache/attachments/b603e89716205577c1bd5608440da08d/roundirregularity.ttf'
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Loading font file '/cache/attachments/b603e89716205577c1bd5608440da08d/NotJustGroovy-enmp.ttf'
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Loading font file '/cache/attachments/b603e89716205577c1bd5608440da08d/RUZICKATYPEK.TTF'
[Parsed_subtitles_4 @ 0x611f0e6fdb40] Using font provider fontconfig
Impossible to convert between the formats supported by the filter 'Parsed_setparams_0' and the filter 'auto_scale_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
Conversion failed!

Additional Context Using Ubuntu HWE kernel 6.8.0-40, and built-in i915 driver.

gnattu commented 2 months ago

Ubuntu 22.04.4 LTS

Are you using the broken kernel as described here?

If so, please install the HWE as described there

gnattu commented 2 months ago

BTW, the current HWE kernel seems to be impacted by upstream driver bug as well, so you may need to install the specific version of kernel (6.8.0-36) for arc to work correctly on ubuntu right now. I'm sorry and I know this situation is frustrating, but this is what you have to do to workaround the broken arc driver support on ubuntu now.

viggy96 commented 2 months ago

Actually I'm using kernel 6.8.0-40.

gnattu commented 2 months ago

Yes, and that very version does include an Intel driver bug affecting arc users. The fix is pushed to upstream kernels but yet to be back-ported to ubuntu kernels. That's why I said that you need the specific version (6.8.0-36) as that is the last version that does not include this bug.

viggy96 commented 2 months ago

I see, thanks.