Opened 2 years ago

Closed 2 years ago

#9630 closed defect (fixed)

regression: qsvdec wrong output

Reported by: U. Artie Eoff Owned by:
Priority: critical Component: avcodec
Version: git-master Keywords: qsvdec, qsv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Some avc decoded files produce wrong output since:

commit 08181624e041d36742870415319a1c599a6d3870
Author: Anton Khirnov <anton@khirnov.net>
Date:   Thu Jan 6 17:16:47 2022 +0100

    lavc/qsvdec: switch to the new FIFO API

How to reproduce:

ffmpeg -hwaccel qsv -init_hw_device qsv=hw:/dev/dri/renderD128 -hwaccel_output_format nv12 -hwaccel_flags allow_profile_mismatch -v verbose -c:v h264_qsv -i sunflower_420_1920x1080.264 -pix_fmt yuv420p -f rawvideo -vsync passthrough -autoscale 0 -vframes 496 -y output.yuv

[2022-02-07 17:46:21] ffmpeg version N-105504-g04cc7a5548fa Copyright (c) 2000-2022 the FFmpeg developers
[2022-02-07 17:46:21]   built with gcc 11 (GCC)
[2022-02-07 17:46:21]   configuration: --prefix=/home/uaeoff/Work/workspace/media/install --disable-static --enable-shared --enable-libdrm --enable-vaapi --enable-libmfx --disable-amf --disable-audiotoolbox --disable-cuda --disable-cuda-sdk --disable-cuvid --disable-d3d11va --disable-dxva2 --disable-libnpp --disable-mmal --disable-nvdec --disable-nvenc --disable-omx --disable-omx-rpi --disable-rkmpp --disable-v4l2-m2m --disable-vdpau --disable-videotoolbox --enable-gpl --enable-libx264 --enable-libx265
[2022-02-07 17:46:21]   libavutil      57. 21.100 / 57. 21.100
[2022-02-07 17:46:21]   libavcodec     59. 20.100 / 59. 20.100
[2022-02-07 17:46:21]   libavformat    59. 17.101 / 59. 17.101
[2022-02-07 17:46:21]   libavdevice    59.  5.100 / 59.  5.100
[2022-02-07 17:46:21]   libavfilter     8. 26.101 /  8. 26.101
[2022-02-07 17:46:21]   libswscale      6.  5.100 /  6.  5.100
[2022-02-07 17:46:21]   libswresample   4.  4.100 /  4.  4.100
[2022-02-07 17:46:21]   libpostproc    56.  4.100 / 56.  4.100
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a63880] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a63880] libva: VA-API version 1.14.0
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a63880] libva: User requested driver 'iHD'
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a63880] libva: Trying to open /home/uaeoff/Work/workspace/media/install/lib/dri/iHD_drv_video.so
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a63880] libva: Found init function __vaDriverInit_1_14
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a63880] libva: va_openDriver() returns 0
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a63880] Initialised VAAPI connection: version 1.14
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a63880] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 22.2.0 ().
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a63880] Driver not found in known nonstandard list, using standard behaviour.
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a63340] Initialize MFX session: API version is 1.35, implementation version is 1.35
[2022-02-07 17:46:21] [h264 @ 0x1b412c0] Reinit context to 1920x1088, pix_fmt: yuv420p
[2022-02-07 17:46:21] [h264 @ 0x1b412c0] Increasing reorder buffer to 1
[2022-02-07 17:46:21] [h264 @ 0x1b37e40] Stream #0: not enough frames to estimate rate; consider increasing probesize
[2022-02-07 17:46:21] Input #0, h264, from '/home/uaeoff/Work/workspace/media/src/otc-media/assets/sanity/avc/sunflower_420_1920x1080.264':
[2022-02-07 17:46:21]   Duration: N/A, bitrate: N/A
[2022-02-07 17:46:21]   Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(top first), 1920x1080 (1920x1088), 25 fps, 25 tbr, 1200k tbn
[2022-02-07 17:46:21] [h264_mp4toannexb @ 0x1b41e80] The input looks like it is Annex B already
[2022-02-07 17:46:21] Stream mapping:
[2022-02-07 17:46:21]   Stream #0:0 -> #0:0 (h264 (h264_qsv) -> rawvideo (native))
[2022-02-07 17:46:21] Press [q] to stop, [?] for help
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a627c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 22.2.0 ().
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1a627c0] Driver not found in known nonstandard list, using standard behaviour.
[2022-02-07 17:46:21] [h264_qsv @ 0x1c17e80] Decoder: output is video memory surface
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1b668c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 22.2.0 ().
[2022-02-07 17:46:21] [AVHWDeviceContext @ 0x1b668c0] Driver not found in known nonstandard list, using standard behaviour.
[2022-02-07 17:46:21] [h264_qsv @ 0x1c17e80] Decoder: output is video memory surface
[2022-02-07 17:46:21] [graph 0 input from stream 0:0 @ 0x2845940] w:1920 h:1080 pixfmt:nv12 tb:1/1200000 fr:25/1 sar:0/1
[2022-02-07 17:46:21] [auto_scale_0 @ 0x2848540] w:iw h:ih flags:'' interl:0
[2022-02-07 17:46:21] [format @ 0x2846a00] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'format'
[2022-02-07 17:46:21] [auto_scale_0 @ 0x2848540] w:1920 h:1080 fmt:nv12 sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x0
[2022-02-07 17:46:21] Output #0, rawvideo, to '/home/uaeoff/Work/workspace/media/src/vaapi-fits-smoke/results/smoke/dc1518ec-883d-11ec-b648-a0291914d55d_0/_0.test.ffmpeg-qsv.decode.avc/default/sunflower_420_1920x1080_1920x1080_I420.yuv':
[2022-02-07 17:46:21]   Metadata:
[2022-02-07 17:46:21]     encoder         : Lavf59.17.101
[2022-02-07 17:46:21]   Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p(tv, top coded first (swapped)), 1920x1080 (0x0), q=2-31, 622080 kb/s, 25 fps, 25 tbn
[2022-02-07 17:46:21]     Metadata:
[2022-02-07 17:46:21]       encoder         : Lavc59.20.100 rawvideo
[2022-02-07 17:46:21] frame=    1 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x   
[2022-02-07 17:46:24] [h264_qsv @ 0x1c17e80] A decode call did not consume any data: expect more data at input (-10)
[2022-02-07 17:46:24]     Last message repeated 2 times
[2022-02-07 17:46:24] No more output streams to write to, finishing.
[2022-02-07 17:46:24] frame=  495 fps=142 q=-0.0 Lsize= 1503562kB time=00:00:16.52 bitrate=745592.3kbits/s speed=4.75x    
[2022-02-07 17:46:24] video:1503562kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
[2022-02-07 17:46:24] Input file #0 (/home/uaeoff/Work/workspace/media/src/otc-media/assets/sanity/avc/sunflower_420_1920x1080.264):
[2022-02-07 17:46:24]   Input stream #0:0 (video): 496 packets read (19124680 bytes); 495 frames decoded; 
[2022-02-07 17:46:24]   Total: 496 packets (19124680 bytes) demuxed
[2022-02-07 17:46:24] Output file #0 (/home/uaeoff/Work/workspace/media/src/vaapi-fits-smoke/results/smoke/dc1518ec-883d-11ec-b648-a0291914d55d_0/_0.test.ffmpeg-qsv.decode.avc/default/sunflower_420_1920x1080_1920x1080_I420.yuv):
[2022-02-07 17:46:24]   Output stream #0:0 (video): 495 frames encoded; 495 packets muxed (1539648000 bytes); 
[2022-02-07 17:46:24]   Total: 495 packets (1539648000 bytes) muxed
[2022-02-07 17:46:24] [AVIOContext @ 0x1b6e040] Statistics: 1539648000 bytes written, 0 seeks, 5874 writeouts
[2022-02-07 17:46:24] [AVIOContext @ 0x1b40b40] Statistics: 19124680 bytes read, 0 seeks

Before above commit:

ls -la output.yuv
-rw-rw-r-- 1 uaeoff uaeoff 1542758400 Feb  7 09:45
md5sum output.yuv
2c3fa0aad1b55e0bee2a05e16a655b14 output.yuv

After above commit:

$ ls -la output.yuv
-rw-rw-r-- 1 uaeoff uaeoff 1539648000 Feb  7 09:46
$ md5sum output.yuv
02cc6ba6bdee0d1dc926d15a64dba6e8 output.yuv

Change History (7)

comment:1 by U. Artie Eoff, 2 years ago

input file is 19M, so can't upload it here. Let me know how I can provide it to you if needed.

comment:2 by mkver, 2 years ago

You can use this to upload the file.

comment:3 by U. Artie Eoff, 2 years ago

Already uploaded file to https://0x0.st/oXBP.tgz for Anton (elenril) whom has started root-causing. Not sure if Anton has found a fix yet.

comment:4 by U. Artie Eoff, 2 years ago

Already uploaded file to https://0x0.st/oXBP.tgz for Anton (elenril) whom has started root-causing. Not sure if Anton has found a fix yet.

comment:5 by haihao, 2 years ago

I have a patch (https://github.com/intel-media-ci/ffmpeg/pull/500) to fix this issue

comment:6 by U. Artie Eoff, 2 years ago

Thanks Haihao! That patch fixes it for me.

comment:7 by mkver, 2 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.