[FFmpeg-user] Difference between i-frames and key frames

Nicolas Gaullier nicolas.gaullier at cji.paris
Mon Oct 30 20:16:50 EET 2023

>> On 07-10-2023 17:20, Ulf Zibis wrote:
>>> Hi,
>>> what is the difference between i-frames and key frames?
>>> And how many other frames are between i-frames or key frames in mp4 
>>> files, created with ffmpeg and with default settings?
>>> -Ulf
>> In mp4 containers I-frames are key frames.>
>That is not correct. Via ffprobe, I have seen I-frames that were not marked 'key_frame=1'.

Firstly, the definition of what a key frame is may depend on contexts and on peoples,
it is often a source of headaches.
If you take a look at 
You can see that properly signaled recovery points are tagged as keyframes,
which means you don't need an I-frame to make a keyframe (some low latency encoders make use of this).
And you can also see that kind of things:
            // heuristic to detect non marked keyframes
            if (p->ps.sps->ref_frame_count <= 1 && p->ps.pps->ref_count[0] <= 1 && s->pict_type == AV_PICTURE_TYPE_I)
                s->key_frame = 1;
as indeed, an I frame is not always a keyframe (long term references may be required later for further processing).

And, at the end, sorry for not answering your question ;)


More information about the ffmpeg-user mailing list