0

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?

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574

1 Answers1

0

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.

ChrisBe
  • 878
  • 9
  • 19
  • When I try to merge the video file that was encoded with (1 sec between I frames) with an audio file of equal length, and try to seek the output mixed video I see black frames when seeking. Do you know why that happens? Thanks for your reply. –  May 17 '18 at 10:19
  • But with 0 sec between I frames all works fine (no black screens when seeking). –  May 17 '18 at 10:21
  • Are you seeing black frames everywhere? My guess would be that the seeking player decodes only i-frames, so you see black frames while seeking a mixed format and alle frames are visible when seeking an all-i frame format – ChrisBe May 17 '18 at 10:32
  • the mixed format and the non mixed are both mp4, and the mixed video only shows black frame when I fast seek the video not when it is left to play the video on it's own. Any idea? How can this be fixed? Why it is happening only when I mix a video that had more than 0 sec I intervals? –  May 17 '18 at 10:38
  • i think my previous comment sums it up pretty ok. I-Frames are easy to decode. Other Frames are not because you always need to decode from the i-frame until the non-i-frame. Media Players might just skip this and only show the last fully rendered frame or, like in your case, just show a black frame – ChrisBe May 17 '18 at 14:10