[FFmpeg-trac] #9805(ffplay:new): Gray frames while decoding when HEVC codec is used and frames with missing POC reference exist
FFmpeg
trac at avcodec.org
Thu Jun 9 08:44:36 EEST 2022
#9805: Gray frames while decoding when HEVC codec is used and frames with missing
POC reference exist
------------------------------------+----------------------------------
Reporter: dhirendvs | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: ffplay
Version: git-master | Resolution:
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+----------------------------------
Description changed by dhirendvs:
Old description:
> Summary of the bug:
> When a H265 .mp4 file contains missing/corrupt frames, and this file is
> decoded for playback using the HEVC codec, gray frames are visible in
> case of frames with missing POC reference i.e. when the error "Could not
> find ref with POC XX" is displayed.
>
> I have verified that after calling avcodec_send_packet() and
> avcodec_receive_frame() methods, no decoding warning or error was
> generated in any of the cases of missing POC reference, and the
> AV_FRAME_FLAG_CORRUPT or AV_FRAME_FLAG_DISCARD flags were not set for
> AVFrame::flags, and also the FF_DECODE_ERROR_MISSING_REFERENCE flag was
> not set for AVFrame::decode_error_flags.
>
> I had also tried setting the following AVCodecContext members:
>
> strict_std_compliance = FF_COMPLIANCE_VERY_STRICT;
> err_recognition = AV_EF_EXPLODE;
> skip_frame = AVDISCARD_NONREF;
>
> But even with the above settings, no decoding warning/error was generated
> while decoding with the HEVC codec when gray frames were visible during
> playback.
>
> However, when the HEVC Intel Quick Sync codec is used, gray frames are
> not visible in case of the 8 instances of the missing POC reference
> error, but a much better playback result is generated with only 3
> instances of garbled frames.
>
> Is this because HEVC Intel Quick Sync codec decodes frames with a non-
> zero latency whereas the latency is 0 in case of the default HEVC codec?
> Is it possible to produce a similar result without gray frames when the
> default HEVC codec is used for playback of such a file with
> missing/corrupt frames?
>
> When the VLC media player (tested with Ver 3.0.8) is used for playback of
> this file, the same result as HEVC Intel Quick Sync codec is generated
> without gray frames, and when Tools --> Preferences --> Input / Codecs
> --> Hardware-accelerated decoding --> Disable is used instead of default
> value of Automatic, then the result is the same as use of HEVC codec.
>
> Link to the H265.mp4 file (valid for 30 days) for testing:
> https://easyupload.io/wrg357
>
> How to reproduce:
> A) Gray frames:
> ffplay -vcodec hevc H265.mp4
>
> B) Garbled frames in a few instances but no gray frames:
> ffplay -vcodec hevc_qsv H265.mp4
>
> Built on:
> FFmpeg 5.0
>
> Reference links to bugs with similar errors:
> https://github.com/mpv-player/mpv/issues/3440
> https://github.com/mpv-player/mpv/issues/6218
> https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/10bc4c3a7df7bb26303067b97311b7eeedfd453e
> https://stackoverflow.com/questions/51668066/detect-frame-with-incorrect-
> poc
> https://trac.ffmpeg.org/ticket/7950
> https://trac.ffmpeg.org/ticket/8732
New description:
Summary of the bug:
When a H265 .mp4 file contains missing/corrupt frames, and this file is
decoded for playback using the HEVC codec, gray frames are visible in case
of frames with missing POC reference i.e. when the error "Could not find
ref with POC XX" is displayed.
I have verified that after calling avcodec_send_packet() and
avcodec_receive_frame() methods, no decoding warning or error was
generated in any of the cases of missing POC reference, and the
AV_FRAME_FLAG_CORRUPT or AV_FRAME_FLAG_DISCARD flags were not set for
AVFrame::flags, and also the FF_DECODE_ERROR_MISSING_REFERENCE flag was
not set for AVFrame::decode_error_flags.
I had also tried setting the following AVCodecContext members:
strict_std_compliance = FF_COMPLIANCE_VERY_STRICT;
err_recognition = AV_EF_EXPLODE;
skip_frame = AVDISCARD_NONREF;
But even with the above settings, no decoding warning/error was generated
while decoding with the HEVC codec when gray frames were visible during
playback.
However, when the HEVC Intel Quick Sync codec is used, gray frames are not
visible in case of the 8 instances of the missing POC reference error, but
a much better playback result is generated with only 3 instances of
garbled frames.
Is this because HEVC Intel Quick Sync codec decodes frames with a non-zero
latency whereas the latency is 0 in case of the default HEVC codec? Is it
possible to produce a similar result without gray frames when the default
HEVC codec is used for playback of such a file with missing/corrupt
frames?
When the VLC media player (tested with Ver 3.0.8) is used for playback of
this file, the same result as HEVC Intel Quick Sync codec is generated
without gray frames, and when Tools --> Preferences --> Input / Codecs -->
Hardware-accelerated decoding --> Disable is used instead of default value
of Automatic, then the result is the same as use of HEVC codec.
Link to the H265.mp4 file (valid for 30 days) for testing:
https://easyupload.io/wrg357
How to reproduce:
A) Gray frames:
ffplay -vcodec hevc H265.mp4
B) Garbled frames in a few instances but no gray frames:
ffplay -vcodec hevc_qsv H265.mp4
Built on:
FFmpeg 5.0
Reference links to bugs with similar errors:
https://github.com/mpv-player/mpv/issues/3440
https://github.com/mpv-player/mpv/issues/6218
https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/10bc4c3a7df7bb26303067b97311b7eeedfd453e
https://stackoverflow.com/questions/51668066/detect-frame-with-incorrect-
poc
https://trac.ffmpeg.org/ticket/7950
https://trac.ffmpeg.org/ticket/8732
Important reference link:
http://git.videolan.org/gitweb.cgi/ffmpeg.git/?p=ffmpeg.git;a=commitdiff;h=8b5ffaea64c7810b66f66f7b70222242000e2a3e;hp=939a4db227be629b7ff5492c6cc7cd75f40bf0f8;ds=sidebyside
In the above link, a developer at Intel has suggested a mechanism of
preventing errors related to POC reference in the find_ref_idx() method in
libavcodec/hevc_refs.c, probably due to which the HEVC Intel Quick Sync
codec generates a better result by preventing gray frames during playback.
--
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9805#comment:11>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list