[FFmpeg-devel] [PATCH] avcodec/h264_parser: remove key frame tagging heuristics

Kieran Kunhya kierank at obe.tv
Tue Jul 13 02:53:43 EEST 2021


On Mon, 12 Jul 2021 at 20:33, James Almer <jamrial at gmail.com> wrote:

> None of these packets contain keyframes, and tagging them as such can
> result in
> non spec compliant output when remuxing into containers like mp4 and
> Matroska,
> where bogus samples would be marked as Sync Samples.
>
> Some tests are updated to reflect this.
>
> Suggested-by: ffmpeg at fb.com
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavcodec/h264_parser.c           |  8 --------
>  tests/fate-run.sh                  |  4 ++--
>  tests/fate/ffmpeg.mak              |  2 +-
>  tests/fate/lavf-container.mak      | 12 ++++++------
>  tests/fate/matroska.mak            |  2 +-
>  tests/ref/fate/copy-trac2211-avi   |  2 +-
>  tests/ref/fate/matroska-h264-remux |  4 ++--
>  tests/ref/fate/segment-mp4-to-ts   | 10 +++++-----
>  tests/ref/lavf-fate/h264.mp4       |  4 ++--
>  9 files changed, 20 insertions(+), 28 deletions(-)
>
> diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
> index d3c56cc188..e78c3679fb 100644
> --- a/libavcodec/h264_parser.c
> +++ b/libavcodec/h264_parser.c
> @@ -344,10 +344,6 @@ static inline int
> parse_nal_units(AVCodecParserContext *s,
>              get_ue_golomb_long(&nal.gb);  // skip first_mb_in_slice
>              slice_type   = get_ue_golomb_31(&nal.gb);
>              s->pict_type = ff_h264_golomb_to_pict_type[slice_type % 5];
> -            if (p->sei.recovery_point.recovery_frame_cnt >= 0) {
> -                /* key frame, since recovery_frame_cnt is set */
> -                s->key_frame = 1;
> -            }
>

Why remove this, this is a reasonable check for a key frame?

Kieran


More information about the ffmpeg-devel mailing list