[FFmpeg-user] Intel libmfx Crash with Hardware Decoding

Dennis Mungai dmngaie at gmail.com
Tue Oct 15 21:14:52 EEST 2024


On Tue, 15 Oct 2024 at 17:11, Shane Warren <shanew at innovsys.com> wrote:

> -----Original Message-----
> From: ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> On Behalf Of Dennis
> Mungai
> Sent: Monday, October 14, 2024 4:50 PM
> To: FFmpeg user questions <ffmpeg-user at ffmpeg.org>
> Subject: Re: [FFmpeg-user] Intel libmfx Crash with Hardware Decoding
>
>
> On Mon, 14 Oct 2024 at 18:57, Shane Warren <shanew at innovsys.com> wrote:
>
> >> I have a system with Intel Flex 140 cards and use ffmpeg to transcode
> >> video on an Ubuntu 22.x system. Through a lot of testing, I have come
> >> up with a flow that handles multicast h264 input (decoding using
> >> vaapi) with
> >> h264/h265 output using QSV. I wanted to use QSV decoding but if I used
> >> QSV decoding and QSV encoding, but QSV decoding seems to strip A53
> >> captions (which I need).
> >>
> >> I found one input stream that eventually crashes the vaapi decoder
> >> inside of libmfx.
> >>
> >> The call stack ends up in some function in libfmx:
> >>
> >> Program terminated with signal SIGSEGV, Segmentation fault.
> >>
> >> #0  0x00007f14b22d9f88 in ?? () from
> >> /usr/lib/x86_64-linux-gnu/libmfx-gen.so.1.2.10
> >>
> >> Is there a way to get symbols for libmfx so I can get a better bug
> >> report, or some suggestion on how to debug this.
> >>
> >> I have switched this stream to software decoding then QSV encoding,
> >> and it is stable but obviously uses a bit more cpu.
> >>
> >> An extra question is: Will the QSV hardware decoder ever support
> >> passing through a53 captions?
> >>
> >> Thanks,
> >>
> >> Shane Warren
> >>
>
> > Full ffmpeg command and uncut console output would help in understanding
> what's going on in your setup.
>
> Full ffmpeg command and full output follows (I can upload the ts file that
> makes it core dump if needed):
>
> root at restarttv:~# ffmpeg -y -threads 2 -nostats -loglevel verbose -fflags
> +genpts -fflags discardcorrupt -hwaccel vaapi -vaapi_device
> /dev/dri/renderD130 -hwaccel_output_format vaapi -extra_hw_frames 2
> -init_hw_device qsv=hw3 -filter_hw_device hw3 -i /tmp/crash-intel.ts
> -filter:a:0 "aresample=async=10000" -c:a:0 aac  -ac:a:0 2 -ar:a:0 48000
> -b:a:0 192k -flush_packets 0 -filter_complex
> "[0:v:0]hwmap=derive_device=qsv,vpp_qsv=deinterlace=2:w=1280:h=720,fps=60000/1001,format=yuv420p[vout]"
> -map "[vout]" -map "0:a:0" -map 0:d? -c:v h264_qsv -b:v 4000k -minrate:v
> 4000k -maxrate:v 4000k -bufsize:v 8000k -scenario livestreaming -strict_gop
> 1 -forced_idr 1 -profile:v high -level:v 4.2 -bf:v 0 -g:v 30 -f mpegts
> -muxrate 4953560 -pes_payload_size 1528 /tmp/intel-output.ts
>
> ffmpeg version N-112548-g48a1b7005d Copyright (c) 2000-2023 the FFmpeg
> developers
>   built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
>   configuration: --nvcc=/usr/local/cuda/bin/nvcc --enable-debug
> --disable-shared --enable-static --enable-version3 --arch=x86_64
> --target-os=linux --enable-cuda --enable-cuvid --enable-nvenc --enable-gpl
> --enable-nonfree --enable-runtime-cpudetect --enable-libnpp
> --extra-cflags='-I/usr/local/cuda/include --static'
> --extra-ldflags=-L/usr/local/cuda/lib64 --enable-gpl --enable-cuda-nvcc
> --enable-libfreetype --enable-libvpl --enable-ffnvcodec --enable-cuda-llvm
> --disable-ffplay --pkg-config-flags=--static --enable-libnpp-static
> --enable-opengl --enable-filter=gltransition --extra-libs='-lGLEW -lEGL'
> --logfile=./config.log --enable-libfreetype --enable-libharfbuzz
> --enable-libsrt
>   libavutil      58. 37.100 / 58. 37.100
>   libavcodec     60. 30.102 / 60. 30.102
>   libavformat    60. 15.101 / 60. 15.101
>   libavdevice    60.  2.101 / 60.  2.101
>   libavfilter     9. 11.100 /  9. 11.100
>   libswscale      7.  4.100 /  7.  4.100
>   libswresample   4. 11.100 /  4. 11.100
>   libpostproc    57.  2.100 / 57.  2.100
> [AVHWDeviceContext @ 0x55c1ddf49b40] libva: VA-API version 1.20.0
> [AVHWDeviceContext @ 0x55c1ddf49b40] libva: Trying to open
> /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> [AVHWDeviceContext @ 0x55c1ddf49b40] libva: Found init function
> __vaDriverInit_1_20
> [AVHWDeviceContext @ 0x55c1ddf49b40] libva: va_openDriver() returns 0
> [AVHWDeviceContext @ 0x55c1ddf49b40] Initialised VAAPI connection: version
> 1.20
> [AVHWDeviceContext @ 0x55c1ddf49b40] VAAPI driver: Intel iHD driver for
> Intel(R) Gen Graphics - 23.4.3 ().
> [AVHWDeviceContext @ 0x55c1ddf49b40] Driver not found in known nonstandard
> list, using standard behaviour.
> [AVHWDeviceContext @ 0x55c1ddf7b080] Trying to use DRM render node for
> device 0.
> [AVHWDeviceContext @ 0x55c1ddf7b080] libva: VA-API version 1.20.0
> [AVHWDeviceContext @ 0x55c1ddf7b080] libva: User requested driver 'iHD'
> [AVHWDeviceContext @ 0x55c1ddf7b080] libva: Trying to open
> /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> [AVHWDeviceContext @ 0x55c1ddf7b080] libva: Found init function
> __vaDriverInit_1_20
> [AVHWDeviceContext @ 0x55c1ddf7b080] libva: va_openDriver() returns 0
> [AVHWDeviceContext @ 0x55c1ddf7b080] Initialised VAAPI connection: version
> 1.20
> [AVHWDeviceContext @ 0x55c1ddf7b080] VAAPI driver: Intel iHD driver for
> Intel(R) Gen Graphics - 23.4.3 ().
> [AVHWDeviceContext @ 0x55c1ddf7b080] Driver not found in known nonstandard
> list, using standard behaviour.
> [AVHWDeviceContext @ 0x55c1ddf78680] Use Intel(R) oneVPL to create MFX
> session, API version is 2.9, the required implementation version is 1.3
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> [AVHWDeviceContext @ 0x55c1ddf78680] Initialize MFX session:
> implementation version is 2.10
> [Parsed_fps_2 @ 0x55c1de1e5c40] 0 frames in, 0 frames out; 0 frames
> dropped, 0 frames duplicated.
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x55c1de19a480] decode_slice_header error
> [h264 @ 0x55c1de19a480] no frame!
> [h264 @ 0x55c1de19a480] Reinit context to 1280x720, pix_fmt: yuv420p
> [mpegts @ 0x55c1de1f8ac0] max_analyze_duration 5000000 reached at 5013333
> microseconds st:1
> [mpegts @ 0x55c1de1f8ac0] start time for stream 2 is not set in
> estimate_timings_from_pts
> Selecting decoder 'h264' because of requested hwaccel method vaapi
> Input #0, mpegts, from '/tmp/crash-intel.ts':
>   Duration: 00:00:29.14, start: 26553.922556, bitrate: 6855 kb/s
>   Program 1
>     Metadata:
>       service_name    : Service01
>       service_provider: FFmpeg
>   Stream #0:0[0x100]: Video: h264 (High), 1 reference frame ([27][0][0][0]
> / 0x001B), yuv420p(tv, bt709, progressive, left), 1280x720 [SAR 1:1 DAR
> 16:9], Closed Captions, 59.94 fps, 59.94 tbr, 90k tbn
>   Stream #0:1[0x101](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000
> Hz, stereo, fltp, 193 kb/s
>   Stream #0:2[0x102]: Data: scte_35
> [out#0/mpegts @ 0x55c1df079c80] Adding streams from explicit maps...
> [out#0/mpegts @ 0x55c1df079c80] Creating output stream from an explicitly
> mapped complex filtergraph 0, output [vout]
> [vost#0:0/h264_qsv @ 0x55c1dee9dec0] Created video stream from complex
> filtergraph 0:[format:default]
> [vost#0:0/h264_qsv @ 0x55c1dee9dec0]
> [aost#0:1/aac @ 0x55c1de151700] Created audio stream from input stream 0:1
> [dost#0:2/copy @ 0x55c1de291840] Created data stream from input stream 0:2
> Stream mapping:
>   Stream #0:0 (h264) -> hwmap:default (graph 0)
>   format:default (graph 0) -> Stream #0:0 (h264_qsv)
>   Stream #0:1 -> #0:1 (aac (native) -> aac (native))
>   Stream #0:2 -> #0:2 (copy)
> Press [q] to stop, [?] for help
> [graph_1_in_0_1 @ 0x55c1de750b40] tb:1/48000 samplefmt:fltp
> samplerate:48000 chlayout:stereo
> [Parsed_aresample_0 @ 0x55c1de1c4900] ch:2 chl:stereo fmt:fltp r:48000Hz
> -> ch:2 chl:stereo fmt:fltp r:48000Hz
> [h264 @ 0x55c1de2513c0] Reinit context to 1280x720, pix_fmt: vaapi
> [graph 0 input from stream 0:0 @ 0x55c1de20a040] w:1280 h:720 pixfmt:vaapi
> tb:1/90000 fr:60000/1001 sar:1/1
> [auto_scale_0 @ 0x55c1de1f4180] w:iw h:ih flags:'' interl:0
> [Parsed_format_3 @ 0x55c1dee0c280] auto-inserting filter 'auto_scale_0'
> between the filter 'Parsed_fps_2' and the filter 'Parsed_format_3'
> [auto_scale_1 @ 0x55c1defb3240] w:iw h:ih flags:'' interl:0
> [format @ 0x55c1de1c5780] auto-inserting filter 'auto_scale_1' between the
> filter 'Parsed_format_3' and the filter 'format'
> [AVHWDeviceContext @ 0x55c1de113600] Use Intel(R) oneVPL to create MFX
> session, API version is 2.9, the required implementation version is 1.3
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> libva info: VA-API version 1.20.0
> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
> libva info: Found init function __vaDriverInit_1_20
> libva info: va_openDriver() returns 0
> [AVHWDeviceContext @ 0x55c1de113600] Initialize MFX session:
> implementation version is 2.10
> [Parsed_vpp_qsv_1 @ 0x55c1de758c00] Use Intel(R) oneVPL to create MFX
> session with the specified MFX loader
> [Parsed_vpp_qsv_1 @ 0x55c1de758c00] VPP: input is video memory surface
> [Parsed_vpp_qsv_1 @ 0x55c1de758c00] VPP: output is system memory surface
> [Parsed_fps_2 @ 0x55c1de1e4980] fps=60000/1001
> [auto_scale_0 @ 0x55c1de1f4180] w:1280 h:720 fmt:nv12 sar:1/1 -> w:1280
> h:720 fmt:yuv420p sar:1/1 flags:0x00000004
> [auto_scale_1 @ 0x55c1defb3240] w:1280 h:720 fmt:yuv420p sar:1/1 -> w:1280
> h:720 fmt:nv12 sar:1/1 flags:0x00000004
> [Parsed_fps_2 @ 0x55c1de1e4980] Set first pts to 33
> [auto_scale_0 @ 0x55c1de1f4180] w:1280 h:720 fmt:nv12 sar:1/1 -> w:1280
> h:720 fmt:yuv420p sar:1/1 flags:0x00000004
>     Last message repeated 2 times
> [auto_scale_1 @ 0x55c1defb3240] w:1280 h:720 fmt:yuv420p sar:1/1 -> w:1280
> h:720 fmt:nv12 sar:1/1 flags:0x00000004
>     Last message repeated 2 times
> [h264_qsv @ 0x55c1de150b00] Using device hw3 (type qsv) with h264_qsv
> encoder.
> [h264_qsv @ 0x55c1de150b00] Encoder: input is system memory surface
> [h264_qsv @ 0x55c1de150b00] Use Intel(R) oneVPL to create MFX session with
> the specified MFX loader
> [h264_qsv @ 0x55c1de150b00] Using the constant bitrate (CBR) ratecontrol
> method
> [h264_qsv @ 0x55c1de150b00] profile: avc high; level: 32
> [h264_qsv @ 0x55c1de150b00] GopPicSize: 30; GopRefDist: 1; GopOptFlag:
> closed; IdrInterval: 0
> [h264_qsv @ 0x55c1de150b00] TargetUsage: 4; RateControlMethod: CBR
> [h264_qsv @ 0x55c1de150b00] BufferSizeInKB: 1000; InitialDelayInKB: 750;
> TargetKbps: 4000; MaxKbps: 4000; BRCParamMultiplier: 1
> [h264_qsv @ 0x55c1de150b00] NumSlice: 1; NumRefFrame: 2
> [h264_qsv @ 0x55c1de150b00] RateDistortionOpt: OFF
> [h264_qsv @ 0x55c1de150b00] RecoveryPointSEI: OFF
> [h264_qsv @ 0x55c1de150b00] VDENC: ON
> [h264_qsv @ 0x55c1de150b00] Entropy coding: CABAC; MaxDecFrameBuffering: 2
> [h264_qsv @ 0x55c1de150b00] NalHrdConformance: ON; SingleSeiNalUnit: ON;
> VuiVclHrdParameters: OFF VuiNalHrdParameters: ON
> [h264_qsv @ 0x55c1de150b00] FrameRateExtD: 1001; FrameRateExtN: 60000
> [h264_qsv @ 0x55c1de150b00] IntRefType: 0; IntRefCycleSize: 0;
> IntRefQPDelta: 0
> [h264_qsv @ 0x55c1de150b00] MaxFrameSize: 0; MaxSliceSize: 0
> [h264_qsv @ 0x55c1de150b00] BitrateLimit: OFF; MBBRC: OFF; ExtBRC: OFF
> [h264_qsv @ 0x55c1de150b00] Trellis: auto
> [h264_qsv @ 0x55c1de150b00] RepeatPPS: OFF; NumMbPerSlice: 0; LookAheadDS:
> 2x
> [h264_qsv @ 0x55c1de150b00] AdaptiveI: OFF; AdaptiveB: OFF; BRefType:off
> [h264_qsv @ 0x55c1de150b00] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0;
> MinQPB: 0; MaxQPB: 0
> [h264_qsv @ 0x55c1de150b00] DisableDeblockingIdc: 0
> [h264_qsv @ 0x55c1de150b00] SkipFrame: no_skip
> [h264_qsv @ 0x55c1de150b00] PRefType: simple
> [h264_qsv @ 0x55c1de150b00] TransformSkip: unknown
> [h264_qsv @ 0x55c1de150b00] IntRefCycleDist: 0
> [h264_qsv @ 0x55c1de150b00] LowDelayBRC: OFF
> [h264_qsv @ 0x55c1de150b00] MaxFrameSizeI: 0; MaxFrameSizeP: 0
> [h264_qsv @ 0x55c1de150b00] ScenarioInfo: 4
> Automatically inserted bitstream filter 'scte35ptsadjust'; args=''
> [mpegts @ 0x55c1de167180] service 1 using PCR in pid=256, pcr_period=20ms
> [mpegts @ 0x55c1de167180] muxrate 4953560, sdt every 500 ms, pat/pmt every
> 100 ms
> Output #0, mpegts, to '/tmp/intel-output.ts':
>   Metadata:
>     encoder         : Lavf60.15.101
>   Stream #0:0: Video: h264, 1 reference frame, nv12(tv, bt709,
> progressive, left), 1280x720 (0x0) [SAR 1:1 DAR 16:9], q=2-31, 4000 kb/s,
> 59.94 fps, 90k tbn
>     Metadata:
>       encoder         : Lavc60.30.102 h264_qsv
>     Side data:
>       cpb: bitrate max/min/avg: 4000000/4000000/4000000 buffer size:
> 8000000 vbv_delay: N/A
>   Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp, delay 1024,
> 192 kb/s
>     Metadata:
>       encoder         : Lavc60.30.102 aac
>   Stream #0:2: Data: scte_35
> Segmentation fault (core dumped)
>

Please upload the sample source file triggering the segfault.

Also, test with these variants:

1. Initializing a QSV instance from VAAPI.

ffmpeg -y -threads 2 -nostats -loglevel verbose -fflags +genpts -fflags
discardcorrupt -hwaccel vaapi -init_hw_device vaapi=va:/dev/dri/renderD130
-hwaccel_output_format vaapi -extra_hw_frames 2 -init_hw_device qsv=qs at va
-filter_hw_device qs -autorotate 0 -i /tmp/crash-intel.ts -autoscale 0
-filter:a:0 "aresample=async=10000" -c:a:0 aac  -ac:a:0 2 -ar:a:0 48000
-b:a:0 192k -flush_packets 0 -filter_complex
"[0:v:0]vpp_qsv=deinterlace=2:w=1280:h=720,fps=60000/1001,format=yuv420p[vout]"
-map "[vout]" -map "0:a:0" -map 0:d? -c:v h264_qsv -b:v 4000k -minrate:v
4000k -maxrate:v 4000k -bufsize:v 8000k -scenario livestreaming -strict_gop
1 -forced_idr 1 -profile:v high -level:v 4.2 -bf:v 0 -g:v 30 -f mpegts
-muxrate 4953560 -pes_payload_size 1528 /tmp/intel-output.ts


2. Using hwmap to derive QSV from VAAPI H/W:

ffmpeg -y -threads 2 -nostats -loglevel verbose -fflags +genpts -fflags
discardcorrupt -hwaccel vaapi -init_hw_device vaapi=va:/dev/dri/renderD130
-hwaccel_output_format vaapi -extra_hw_frames 2 -filter_hw_device va
-autorotate 0 -i /tmp/crash-intel.ts -autoscale 0 -filter:a:0
"aresample=async=10000" -c:a:0 aac  -ac:a:0 2 -ar:a:0 48000 -b:a:0 192k
-flush_packets 0 -filter_complex
"[0:v:0]hwmap=derive_device=qsv,format=qsv,vpp_qsv=deinterlace=2:w=1280:h=720,fps=60000/1001,format=yuv420p[vout]"
-map "[vout]" -map "0:a:0" -map 0:d? -c:v h264_qsv -b:v 4000k -minrate:v
4000k -maxrate:v 4000k -bufsize:v 8000k -scenario livestreaming -strict_gop
1 -forced_idr 1 -profile:v high -level:v 4.2 -bf:v 0 -g:v 30 -f mpegts
-muxrate 4953560 -pes_payload_size 1528 /tmp/intel-output.ts

3. Using hwupload to derive QSV from VAAPI H/W:

The extra_hw_frames argument is now passed directly to hwupload's
derive_device option, with the value of 64.

ffmpeg -y -threads 2 -nostats -loglevel verbose -fflags +genpts -fflags
discardcorrupt -hwaccel vaapi -init_hw_device vaapi=va:/dev/dri/renderD130
-hwaccel_output_format vaapi -filter_hw_device va -autorotate 0 -i
/tmp/crash-intel.ts -autoscale 0 -filter:a:0 "aresample=async=10000" -c:a:0
aac  -ac:a:0 2 -ar:a:0 48000 -b:a:0 192k -flush_packets 0 -filter_complex
"[0:v:0]hwupload=derive_device=qsv:extra_hw_frames=64,format=qsv,vpp_qsv=deinterlace=2:w=1280:h=720,fps=60000/1001,format=yuv420p[vout]"
-map "[vout]" -map "0:a:0" -map 0:d? -c:v h264_qsv -b:v 4000k -minrate:v
4000k -maxrate:v 4000k -bufsize:v 8000k -scenario livestreaming -strict_gop
1 -forced_idr 1 -profile:v high -level:v 4.2 -bf:v 0 -g:v 30 -f mpegts
-muxrate 4953560 -pes_payload_size 1528 /tmp/intel-output.ts

Extra parameters added:

(a). -autororate 0 : This disables the automatic rotation of the video
according to file metadata. Known to make some H/W decoders to misbehave.
(b). -noautoscale : Used to prevent the automatic insertion of a scale
filter in the pipeline(s), ensuring better resilience against crashes due
to changing input resolutions with *some* encoder & decoder combinations.

Test and report back.


More information about the ffmpeg-user mailing list