[FFmpeg-devel] [PATCH] libavcodec/h261dec: Fix keyframe markup and frame skipping.

Andrey Semashev andrey.semashev at gmail.com
Sat Oct 26 21:34:54 EEST 2019


On 2019-10-26 21:15, Michael Niedermayer wrote:
> On Sat, Oct 26, 2019 at 02:05:27PM +0300, Andrey Semashev wrote:
>> The decoder never marks pictures as I-frames, which results in no
>> keyframe indication and incorrect frame skipping, in cases when
>> keyframes should be decoded.
>>
>> This commit works around this decoder limitation and marks I-frames
>> and keyframes based on "freeze picture release" bit in h261 picture
>> header. This reflects h261enc behavior.
>> ---
>>   libavcodec/h261.h    |  1 +
>>   libavcodec/h261dec.c | 27 ++++++++++++++++++---------
>>   2 files changed, 19 insertions(+), 9 deletions(-)
> 
> If the goal is correctly recognizing I frames then checking if all
> blocks are intra should be the most reliable

In my case, the goal is to know when a keyframe is received, i.e. when 
the receiver can be reasonably sure it can start displaying/processing 
received frames. Including after some frames lost in transmission.

According to H.261 spec, "freeze picture release" bit is what is 
intended to mark keyframes. To quote section 4.3.3:

<quote>
A signal from an encoder which has responded to a fast update request 
and allows a decoder to exit from its freeze picture mode and display 
decoded pictures in the normal manner.
</quote>

I'll reiterate that h261enc marks keyframes with this bit.

> that wont work for skiping though as it requires decoding

Right.


More information about the ffmpeg-devel mailing list