Jellyfin Forum
SOLVED: ffmpeg crash on hevc 10 bit - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: SOLVED: ffmpeg crash on hevc 10 bit (/t-solved-ffmpeg-crash-on-hevc-10-bit)



ffmpeg crash on hevc 10 bit - KingPin - 2024-07-02

Hi all I'm running jellyfin server for quite a while, I have recently started noticing I coudlnt play some videos. Through some basic process of elimination, I have noticed this is happening on HEVC 10bt, and x265 videos. some logs and basic info below.

Running on docker, 
Linux mini 6.5.0-41-generic #41~22.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun  3 11:32:55 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Server version 10.9.7
cpu : model name : 11th Gen Intel® Core™ i7-11800H @ 2.30GHz

ffmpeg log: 
Quote:{"Protocol":0,"Id":"9c4a2bcf16fd065514869b08e274d8d6","Path":"/library/some ","EncoderPath":null,"EncoderProtocol":null,"Type":0,"Container":"mkv","Size":4032007930,"Name":"some video","IsRemote":false,"ETag":"bd947895185f936be3d6b52104fb7019","RunTimeTicks":56177700000,"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":"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/1000","CodecTimeBase":null,"Title":null,"VideoRange":1,"VideoRangeType":1,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"LocalizedHearingImpaired":null,"DisplayTitle":"1080p HEVC SDR","NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":null,"BitRate":5741791,"BitDepth":8,"RefFrames":1,"PacketLength":null,"Channels":null,"SampleRate":null,"IsDefault":true,"IsForced":false,"IsHearingImpaired":false,"Height":800,"Width":1920,"AverageFrameRate":23.976025,"RealFrameRate":23.976025,"Profile":"Main","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":"yuv420p","Level":123,"IsAnamorphic":false},{"Codec":"aac","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":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":null,"LocalizedDefault":null,"LocalizedForced":null,"LocalizedExternal":null,"LocalizedHearingImpaired":null,"DisplayTitle":"English - AAC - 5.1 - Default","NalLengthSize":null,"IsInterlaced":false,"IsAVC":false,"ChannelLayout":"5.1","BitRate":445371,"BitDepth":null,"RefFrames":null,"PacketLength":null,"Channels":6,"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":"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":0,"VideoRangeType":0,"VideoDoViTitle":null,"AudioSpatialFormat":0,"LocalizedUndefined":"Undefined","LocalizedDefault":"Default","LocalizedForced":"Forced","LocalizedExternal":"External","LocalizedHearingImpaired":"Hearing Impaired","DisplayTitle":"English - SUBRIP","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":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}],"MediaAttachments":[],"Formats":[],"Bitrate":6187162,"Timestamp":null,"RequiredHttpHeaders":{},"TranscodingUrl":null,"TranscodingSubProtocol":0,"TranscodingContainer":null,"AnalyzeDurationMs":null,"DefaultAudioStreamIndex":null,"DefaultSubtitleStreamIndex":null}

/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -probesize 1G -init_hw_device vaapi=va:,kernel_driver=i915,driver=iHD -init_hw_device qsv=qs@va -filter_hw_device qs -hwaccel qsv -hwaccel_output_format qsv -c:v hevc_qsv -noautorotate -i file:"/library/some video.mkv" -noautoscale -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_qsv -low_power 1 -preset veryfast -look_ahead 0 -b:v 9569652 -maxrate 9569652 -bufsize 19139304 -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 256000 -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 fmp4 -hls_fmp4_init_filename "03042d19a069c546ea2c613bffa518b9-1.mp4" -start_number 0 -hls_segment_filename "/transcode/03042d19a069c546ea2c613bffa518b9%d.mp4" -hls_playlist_type vod -hls_list_size 0 -y "/transcode/03042d19a069c546ea2c613bffa518b9.m3u8"


ffmpeg version 6.0.1-Jellyfin Copyright © 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  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      582.100 / 582.100
  libavcodec    603.100 / 603.100
  libavformat    603.100 / 603.100
  libavdevice    601.100 / 601.100
  libavfilter    93.10093.100
  libswscale      71.10071.100
  libswresample  4. 10.1004. 10.100
  libpostproc    571.100 / 571.100
[AVHWDeviceContext @ 0x6436134cf3c0] No VA display found for any default device.
Device creation failed: -22.
Failed to set value 'vaapi=va:,kernel_driver=i915,driver=iHD' for option 'init_hw_device': Invalid argument
Error parsing global options: Invalid argument

Docker compose: 
Quote:  jellyfin:
    image: jellyfin/jellyfin
    container_name: jellyfin
    environment:
      JELLYFIN_PublishedServerUrl: https://someurl.com
      JELLYFIN_DATA_DIR: /config/data
      JELLYFIN_CONFIG_DIR: /config
      JELLYFIN_LOG_DIR: /config/log
      JELLYFIN_CACHE_DIR: /config/cache
    devices:
      - "/dev/driConfused-facedev/dri"
    volumes:
      xxxxxxxxx
    restart: unless-stopped



RE: ffmpeg crash on hevc 10 bit - Fate - 2024-07-02

Can you try disable low power intel hardware encoding for hevc in the settings?


RE: ffmpeg crash on hevc 10 bit - TheDreadPirate - 2024-07-02

(2024-07-02, 12:26 PM)Fate Wrote: Can you try disable low power intel hardware encoding for hevc in the settings?

Low power encoding for HEVC is supported in Tiger Lake CPUs.

(2024-07-02, 08:30 AM)KingPin Wrote: Hi all I'm running jellyfin server for quite a while, I have recently started noticing I coudlnt play some videos. Through some basic process of elimination, I have noticed this is happening on HEVC 10bt, and x265 videos. some logs and basic info below.

Running on docker, 
Linux mini 6.5.0-41-generic #41~22.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun  3 11:32:55 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Server version 10.9.7
cpu : model name : 11th Gen Intel® Core™ i7-11800H @ 2.30GHz

You did not pass in the render group into the container.  I'm not sure if that matters since you are running a root container

https://jellyfin.org/docs/general/administration/hardware-acceleration/intel/#official-docker

Code:
    group_add:
      - "122" # Change this to match your "render" host group id and remove this comment

What is the output of this command (run it on the host system).

Code:
docker exec -it jellyfin /usr/lib/jellyfin-ffmpeg/vainfo

And on the host system, what devices are listed in /dev/dri?


RE: ffmpeg crash on hevc 10 bit - KingPin - 2024-07-02

Turning off low power did allow playback, but passing in the group_add was the fix.

getent group render | cut -d: -f3

and then added it to group_add and voila. thank you @TheDreadPirate and Fate


RE: ffmpeg crash on hevc 10 bit - KingPin - 2024-07-02

just for copmpleteness sake :


Quote:Trying display: drm
libva info: VA-API version 1.21.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/nvidia_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: Trying to open /usr/lib/dri/nvidia_drv_video.so
libva info: Trying to open /usr/local/lib/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

Quote:# ll /dev/dri
total 0
drwxr-xr-x  3 root root        100 Jul  1 20:00 ./
drwxr-xr-x 19 root root      4360 Jul  1 20:00 ../
drwxr-xr-x  2 root root        80 Jul  1 20:00 by-path/
crw-rw----  1 root video  226,  0 Jul  1 20:00 card0
crw-rw----  1 root render 226, 128 Jul  1 20:00 renderD128



RE: ffmpeg crash on hevc 10 bit - Fate - 2024-07-02

(2024-07-02, 02:56 PM)TheDreadPirate Wrote:
(2024-07-02, 12:26 PM)Fate Wrote: Can you try disable low power intel hardware encoding for hevc in the settings?

Low power encoding for HEVC is supported in Tiger Lake CPUs.


Who said it wasn't supported?

I'm just eliminating variables since LP encoding also needs guc=2 and a somewhat recent kernel/Intel driver to work.

Unless you don't want anyone else support on this forum...


RE: ffmpeg crash on hevc 10 bit - TheDreadPirate - 2024-07-02

(2024-07-02, 09:18 PM)Fate Wrote: Unless you don't want anyone else support on this forum...

Turning off low power encoding for HEVC is the correct suggestion for older Intel iGPUs (6-9th gen Intel).   But I don't know what you know.  I was simply informing.  The attitude is not necessary.