How does changing the Key Frame Distance control (as seen below) work in terms of quality and speed?

enter image description here


This is an answer I found on the adobe forums after googling it:

The keyframe distance is the maximum number of frames before the encoder inserts an i-frame, which is the highest-quality frame of an MPEG stream (ie, it has all the information for a single frame of video inside of it rather than relying on the frames around it to reconstruct). In between the i-frames are b-frames and p-frames, which are "difference" frames that reconstruct that frame of video by looking at the nearest i-frame and applying all the "difference" frames from that point forward (or backwards). The collection of an i-frame and all its connected p-frame and b-frames is called a GOP, or "Group of Pictures". So in essence the "keyframe distance" value determines the length of each GOP.

Note that Premiere automatically inserts a new i-frame for scene changes, irrespective of the keyframe distance value. This is to assure video quality at the start of a new scene since there wont be enough in common from previous b-frame and p-frames.

Generally speaking, the more i-frames you have, the higher the image quality of video, but also the larger the size of the video. So the value you choose for keyframe distance is a balance between the file size you want the video to fit in vs quality. If you're not concerned with file size or the file size generated is within reason then you can just leave it to its default value. Otherwise you can tweak it as part of the process to get the file size down to where you want it to be (in combination with the other encoder parameters such as bitrate).

  • It's not only quality / filesize that are affected, one other result of changing the GOP length is that shorter GOPs make it easier to seek to a specific frame, as well as shuttle forward and backward. This is the reason that most editing codecs are all-i-frame (if you're interested there's a recent post by someone asking about using all-I-Frame h.264 instead of say ProRes here: video.stackexchange.com/questions/29414/…). Of course that does dramatically increase the size.
    – stib
    Feb 8 '20 at 11:48
  • So Is it good to make the value 1 for a composition based on an audio spectrum? , @stib Feb 8 '20 at 12:02
  • Depends on what you're doing with it. All-i-frame compression will be significantly larger.
    – stib
    Feb 8 '20 at 13:51

This is the equivalent to Sony Vegas macroblocks. If you set it to 1, every frame will be built entirely, but if set to the the default 4 every frame will be divided by four. This is designed for the compression ratio - if you're using it - Depending on the profile, if using High for example, uses the h264 maximum compression rate that is 8. In other words, a video of 640x360 at 60 fps is 13824000 bits per second: in baseline profile must be constant br at 1 macroblock. This is the fastest rendering for any video editing program, because these are uncompressed values. If you wish to add compression in render, use High profile, and divide the bit rate by 8. If using variable bit rate, set the half of it to average and the divided by 8 total in the maximum bit rate and use 8 macroblocks. If using premiere, set the entire 1728 br and key frame distance to 8 too. But in every case, when using in render compression, picture quality is not guaranteed. If in doubt, always use uncompressed values.

  • 1
    Macroblocks are spatial divisions within a frame and have nothing to do with KF distance. For codecs upto H.264, they are fixed at 16x16 pixels. Parallel encoding breaks the frame into slices, not macroblocks,
    – Gyan
    Sep 26 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.