There are multiple parameters that define a video, as you may know they are frame rate
, bit rate
, resolution
,... and some more.
I noticed that there are some new parameters that I didn't know about including what is called by B-frames
and I frames
.
I tried to understand the I-intervals
in a custom video capturing that I am implementing, this is what I got:
I-Intervals
I Intervals are intervals in between the video frames, and they are related to each other in terms of seconds. So either they are 1 sec away from each other or 2 sec away from each other or 3 sec....
When I encoded my video and set the I Interval to be (2 sec or 1 sec ) I noticed that the output video doesn't seek properly when controlled by a media controller.
When I encoded my video and set the I Interval to be (0 sec) I noticed that the video does seek properly but the size of the video increased.
Question:
What are these I Intervals and why do they affect the size and the seeking of the video?
Is it wrong to set the I frames to 0 sec?
The Basics
The H264 compression format is a inter-picture-prediction format. Very simplified, to complete and display a frame, it needs information stored in other frames.
Most basic frames are the I for independent, P for prediction and B for Bidirectional frames.
I-frames, also often called Key-frames are complete frames and do not require any data from other frames.
P-frames use data from previous frames.
Finally, B-frames can use both previous and future frame data
Back to the question
Most things should be clear now. The size increases because I-frames are simply the least compressible, you can imagine a all I-frame video as stringing together jpg pictures.
The seeking is affected because some players seek to the previous I-Frame of the seek position and simply play from there, because they have to decode from there on anyways to produce correct visuals.
There is nothing wrong with setting the I-frame interval to 0, it's actually pretty common.