On Wed, 16 Oct 2024 at 00:49, Shane Warren <sha...@innovsys.com> wrote:

>
>
> >> > -----Original Message-----
> >> > From: ffmpeg-user <ffmpeg-user-boun...@ffmpeg.org> On Behalf Of
> >> > Dennis Mungai
> >> > Sent: Monday, October 14, 2024 4:50 PM
> >> > To: FFmpeg user questions <ffmpeg-user@ffmpeg.org>
> >> > Subject: Re: [FFmpeg-user] Intel libmfx Crash with Hardware Decoding
> >> >
> >> >
> >> > On Mon, 14 Oct 2024 at 18:57, Shane Warren <sha...@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@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@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]hwmap=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.
> >>
> >> Link to input ts file:
> >> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdriv
> >> %2F&data=05%7C02%7Cshanew%40innovsys.com%7C8b560a334e1c427677b708dced5
> >> 8cc45%7C7a48ce45ee974a95ac183390878a179b%7C0%7C0%7C638646212890216867%
> >> 7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik
> >> 1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=Y6oJ4c16rQ%2B37E%2BX5eaxDF4V6B
> >> U8pPw%2F%2FmR6gBp%2B6Vg%3D&reserved=0
> >> e.google.com%2Ffile%2Fd%2F1Vy67szauLHemJMaVYHAQ9qZvpwO2qBnj%2Fview%3Fu
> >> sp%3Dsharing&data=05%7C02%7Cshanew%40innovsys.com%7C330d8c43847847a6f4
> >> 7e08dced536136%7C7a48ce45ee974a95ac183390878a179b%7C0%7C0%7C6386461896
> >> 19449414%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiL
> >> CJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=gLNEaeLZx%2BSBPtdU7x6
> >> 6c0b8LNK2bceM%2B8MFNtymvlM%3D&reserved=0
> >>
> >> 1. Had to add this to start of the filter (or I got invalid conversion
> >> errors): hwmap=derive_device=qsv, Result: Segfaults 2. Segfaults 3.
> >> Had to change to this at the start of the filter (or I got invalid
> >> conversion errors): hwmap=derive_device=qsv, Result: Segfaults
> >>
> >> I have also been testing directly decoding with QSV and encoding QSV
> >> using this test stream, this works 100% no crash. The only issue with
> >> QSV is the decoder strips A53 captions.
> >>
> >> Today I have been digging around in ffmpeg source and I think the
> >> problem is the QSV decoder is not copying out the a53 captions and
> >> putting them in the sideband data for the qsv endoder to use. In
> >> theory this should be easy to fix.
> >>
>
> >> Somehow, this seems to work correctly on the current ffmpeg git tip
> >> (master
> >> branch) and release points 7.0 and 7.1 with the command:
> >>
> >> ffmpeg -y -threads 2 -loglevel verbose -fflags +genpts -fflags
> >> discardcorrupt \ -hwaccel vaapi -init_hw_device
> >> vaapi=va:/dev/dri/renderD128 -hwaccel_output_format vaapi \
> >> -filter_hw_device va -noautorotate -i "crash-intel.ts" \ -noautoscale
> >> -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:framerate=60000/1001[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 \ -y -f mpegts -muxrate 4953560 -pes_payload_size 1528
> "intel-output.ts"
> >>
> >> And the output has the A53 captions:
> >>
> >> mediainfo intel-output.ts
> >> General
> >> ID                                       : 1 (0x1)
> >> Complete name                            : intel-output.ts
> >> Format                                   : MPEG-TS
> >> File size                                : 17.2 MiB
> >> Duration                                 : 29 s 179 ms
> >> Overall bit rate mode                    : Constant
> >> Overall bit rate                         : 4 954 kb/s
> >> Frame rate                               : 59.940 FPS
> >> Movie name                               : My Blue Heaven
> >> Law rating                               : TV-PG (DL)
> >>
> >> Video
> >> ID                                       : 256 (0x100)
> >> Menu ID                                  : 1 (0x1)
> >> Format                                   : AVC
> >> Format/Info                              : Advanced Video Codec
> >> Format profile                           : High@L4
> >> Format settings                          : CABAC / 2 Ref Frames
> >> Format settings, CABAC                   : Yes
> >> Format settings, Reference frames        : 2 frames
> >> Format settings, GOP                     : M=1, N=30
> >> Codec ID                                 : 27
> >> Duration                                 : 28 s 587 ms
> >> Bit rate mode                            : Constant
> >> Nominal bit rate                         : 4 000 kb/s
> >> Width                                    : 1 280 pixels
> >> Height                                   : 720 pixels
> >> Display aspect ratio                     : 16:9
> >> Frame rate                               : 59.940 (60000/1001) FPS
> >> Standard                                 : Component
> >> Color space                              : YUV
> >> Chroma subsampling                       : 4:2:0
> >> Bit depth                                : 8 bits
> >> Scan type                                : Progressive
> >> Bits/(Pixel*Frame)                       : 0.072
> >> Color range                              : Limited
> >> Color primaries                          : BT.709
> >> Transfer characteristics                 : BT.709
> >> Matrix coefficients                      : BT.709
> >>
> >> Audio
> >> ID                                       : 257 (0x101)
> >> Menu ID                                  : 1 (0x1)
> >> Format                                   : AAC LC
> >> Format/Info                              : Advanced Audio Codec Low
> >> Complexity
> >> Format version                           : Version 4
> >> Muxing mode                              : ADTS
> >> Codec ID                                 : 15-2
> >> Duration                                 : 29 s 141 ms
> >> Bit rate mode                            : Variable
> >> Channel(s)                               : 2 channels
> >> Channel layout                           : L R
> >> Sampling rate                            : 48.0 kHz
> >> Frame rate                               : 46.875 FPS (1024 SPF)
> >> Compression mode                         : Lossy
> >> Delay relative to video                  : -572 ms
> >> Language                                 : English
> >>
> >> Text #1
> >> ID                                       : 256 (0x100)-CC1
> >> Menu ID                                  : 1 (0x1)
> >> Format                                   : EIA-608
> >> Muxing mode                              : SCTE 128 / DTVCC Transport
> >> Muxing mode, more info                   : Muxed in Video #1
> >> Duration                                 : 28 s 587 ms
> >> Duration of the visible content          : 25 s 592 ms
> >> Start time (commands)                    : 2 s 522 ms
> >> Start time                               : 2 s 623 ms
> >> End time                                 : 28 s 215 ms
> >> Bit rate mode                            : Constant
> >> Stream size                              : 0.00 Byte (0%)
> >> Count of events                          : 9
> >> Count of PopOn events                    : 9
> >> Count of lines                           : 15
> >> Maximum count of lines per event         : 3
> >> Count of frames before first event       : 39
> >> Type of the first event                  : PopOn
> >>
> >> Text #2
> >> ID                                       : 256 (0x100)-CC3
> >> Menu ID                                  : 1 (0x1)
> >> Format                                   : EIA-608
> >> Muxing mode                              : SCTE 128 / DTVCC Transport
> >> Muxing mode, more info                   : Muxed in Video #1
> >> Duration                                 : 28 s 587 ms
> >> Start time (commands)                    : 10 s 981 ms
> >> Bit rate mode                            : Constant
> >> Stream size                              : 0.00 Byte (0%)
> >> Count of lines                           : 0
> >>
> >> Text #3
> >> ID                                       : 256 (0x100)-1
> >> Menu ID                                  : 1 (0x1)
> >> Format                                   : EIA-708
> >> Muxing mode                              : SCTE 128 / DTVCC Transport
> >> Muxing mode, more info                   : Muxed in Video #1
> >> Duration                                 : 28 s 587 ms
> >> Bit rate mode                            : Constant
> >> Stream size                              : 0.00 Byte (0%)
> >>
> >> Text #4
> >> ID                                       : 256 (0x100)-2
> >> Menu ID                                  : 1 (0x1)
> >> Format                                   : EIA-708
> >> Muxing mode                              : SCTE 128 / DTVCC Transport
> >> Muxing mode, more info                   : Muxed in Video #1
> >> Duration                                 : 28 s 587 ms
> >> Bit rate mode                            : Constant
> >> Stream size                              : 0.00 Byte (0%)
> >>
> >> Menu
> >> ID                                       : 4096 (0x1000)
> >> Menu ID                                  : 1 (0x1)
> >> Format                                   : AVC / AAC
> >> Duration                                 : 29 s 179 ms
> >> List                                     : 256 (0x100) (AVC) / 257
> (0x101)
> >> (AAC, English)
> >> Title                                    : My Blue Heaven
> >> Language                                 :  / English
> >> Service name                             : Service01
> >> Service provider                         : FFmpeg
> >> Service type                             : digital television
> >> Law rating                               : TV-PG (DL)
>
> > I should have mentioned that the command does not crash 100% of the
> time, if you run it over and over mine crashes maybe 10-15% of the time. I
> would try it a few times and see if it still works.
>
> I pulled the latest source, and built it, then ran my command again. It
> didn't crash the first time, but it did crash the 2nd run and I can still
> make it crash reliably with the latest source.
>


Have you ever tried building and installing the Intel Cartwheel FFmpeg
release(s)?
https://github.com/intel/cartwheel-ffmpeg

The latest releases over there have patchsets that are yet to be merged
upstream, addressing multiple bug fixes and enhancements to Intel's OneVPL
stack and DNN stuff.
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to