Opened 3 years ago

Last modified 2 years ago

#9532 new defect

Blocks with VDPAU and H264/1080i

Reported by: Klaas de Waal Owned by:
Priority: normal Component: avcodec
Version: unspecified Keywords: h264 vdpau
Cc: Klaas de Waal Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Playing back H264 1080i recordings with MythTV frontend player gives blocking artifacts when VDPAU hardware decoding is used. Playback is OK when software decoding is used.

The blocking artifacts appear often, but not always, for a short time when skipping backward and forward. Sometimes the blocking artifacts also appear on start of playback.
Continuous playback is OK, it is the first second after the skip that gives the problems.

The problem has been reproduced with the mpv player when VDPAU hardware decoding is configured; also here playback is OK when software decoding is used.

The problem is bisected and it is caused by the following commit:

commit 99042c2bf6cc79006036502a6abbec5e51f73673
Author: James Almer <jamrial@gmail.com>
Date: Mon Mar 8 23:10:10 2021 -0300

avcodec/h264_slice: don't copy frame data during error concealment


In addition to the fact that av_image_copy() cannot handle hardware pixel formats,
h->short_ref[0]->f may not be writable at this point.


Based on a patch by Hendrik Leppkes.


Signed-off-by: James Almer <jamrial@gmail.com>

Reversing this patch in the release/4.4 tree does solve the problem for MythTV and for the mpv player.

The mpv player command used:

$ mpv -vo=vdpau --hwdec=vdpau tweevoortwaalf_ffmpeg.ts

Attachments (1)

tweevoortwaalf_ffmpeg.png (1.2 MB ) - added by Klaas de Waal 3 years ago.
blocks with vdpau

Download all attachments as: .zip

Change History (4)

comment:1 by James, 3 years ago

That commit can't be reverted as the old code was invalid. For a hwaccel pixel format like VDPAU it was in fact not doing anything at all. The new code is now properly copying the previous frame and using it as reference in error concealing.

Does the console show any decoding errors when you see these artifacts? Before it would do nothing and silently keep going, but now if it can't create a new reference it will stop decoding the frame.

by Klaas de Waal, 3 years ago

Attachment: tweevoortwaalf_ffmpeg.png added

blocks with vdpau

comment:2 by Klaas de Waal, 3 years ago

Thanks for your quick reply!
The mpv player gives the following ffmpeg error messages at playback start and when skipping:

[ffmpeg/video] h264: reference picture missing during reorder
[ffmpeg/video] h264: reference picture missing during reorder
[ffmpeg/video] h264: Missing reference picture, default is 2147483647
[ffmpeg/video] h264: Missing reference picture, default is 2147483647
[ffmpeg/video] h264: reference picture missing during reorder
[ffmpeg/video] h264: Missing reference picture, default is 65744
[ffmpeg/video] h264: reference picture missing during reorder
[ffmpeg/video] h264: Missing reference picture, default is 65740
V: 00:00:11 / 00:01:03 (18%)
[ffmpeg/video] h264: reference picture missing during reorder
[ffmpeg/video] h264: Missing reference picture, default is 2147483647
[ffmpeg/video] h264: reference picture missing during reorder
[ffmpeg/video] h264: Missing reference picture, default is 65672
[ffmpeg/video] h264: reference picture missing during reorder
[ffmpeg/video] h264: Missing reference picture, default is 65668
V: 00:00:09 / 00:01:03 (14%)

With ffplay the same type of error messages are given.

The video file, renamed to trac_9532_blocks_with_vdpau.ts, is available here:

https://drive.google.com/file/d/1l1fmZqI4lmSOT8x09T_KHSIQLDHOSCKQ/view?usp=sharing

This file is 100Mbyte so it enables some back and forth skipping.

N.B. I tried to upload this file to upload.ffmpeg.org as is recommended but this failed.
I have attached a screenshot from playback with the MythTV frontend player that does show the problem.

comment:3 by Carl Eugen Hoyos, 2 years ago

Keywords: blocks interlaced removed
Version: 4.4.1unspecified

Please clarify that the issue is reproducible with current FFmpeg git head.

Note: See TracTickets for help on using tickets.