[FFmpeg-devel] [PATCH 2/4 v2] ffmpeg: ensure a keyframe was not seen before skipping packets

Anton Khirnov anton at khirnov.net
Thu Mar 31 14:47:00 EEST 2022


Quoting James Almer (2022-02-23 16:03:53)
> A keyframe could be buffered in the bsf and not be output until more packets
> had been fed to it.
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> Changed the check from pkt to !eof, since a packet is always provided.
> 
>  fftools/ffmpeg.c | 4 +++-
>  fftools/ffmpeg.h | 1 +
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 44043ef203..2b61c0d5aa 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -890,6 +890,8 @@ static void output_packet(OutputFile *of, AVPacket *pkt,
>  
>      /* apply the output bitstream filters */
>      if (ost->bsf_ctx) {
> +        if (!eof && pkt->flags & AV_PKT_FLAG_KEY)
> +            ost->seen_kf = 1;

Shouldn't this also be set when no bsfs are used?

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list