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

James Almer jamrial at gmail.com
Thu Mar 31 14:51:14 EEST 2022



On 3/31/2022 8:47 AM, Anton Khirnov wrote:
> 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?

Afaict only in streamcopy with bsfs scenarios can packets be temporarily 
withheld, so it's not necessary.


More information about the ffmpeg-devel mailing list