Video Trim
Blog

Keyframes Explained: Why Your Cut Doesn't Always Land Where You Set It

• Video Trim Team

You set the start of your clip at exactly 4.2 seconds, export, and the result begins at 4.0 seconds. Nothing is broken. You have just run into how video compression actually works.

Video frames are not all equal

A video file does not store a complete picture for every frame. That would be enormous. Instead, compression exploits the fact that consecutive frames are usually almost identical. If someone is talking to a static camera, the background does not change between frame 100 and frame 101, so there is no reason to store it twice.

Encoders therefore produce three kinds of frame:

I-frames (intra-coded, often called keyframes) store a complete image. They can be decoded entirely on their own, with no reference to anything before or after.

P-frames (predicted) store only the differences from a previous frame. A P-frame is meaningless without the frames it references.

B-frames (bidirectional) store differences from both earlier and later frames, which compresses even better and is even more dependent on its neighbours.

A typical encode places an I-frame every one to ten seconds, with dozens of P- and B-frames between them. That group is called a GOP, or group of pictures.

Why this constrains where you can cut

To start playback at a given moment, a decoder needs a complete picture to begin from. That means an I-frame. If your chosen start point lands on a P-frame, the decoder has nothing to reconstruct it against, because you have thrown away the frames it depends on.

That leaves two options, and every trimming tool picks one.

Option one: stream copy, or lossless trimming

The tool copies the compressed video data directly into a new file without decoding it. Nothing is re-compressed, so there is zero quality loss and it is extremely fast, often near-instant even for large files.

The catch is that cuts can only land on I-frames. Ask for 4.2 seconds and you get the nearest preceding keyframe, perhaps 4.0. If the encode uses sparse keyframes, that drift can be a couple of seconds.

Some tools hide this by starting at the keyframe but keeping the extra frames in the file, marked as not-to-be-displayed. Depending on the player, you may see a brief freeze or black frame at the start.

Option two: re-encode

The tool decodes the video, discards the frames you do not want, and encodes a fresh file with a new keyframe exactly at your chosen point. Your cut is frame-accurate.

The cost is time and generational loss. Re-encoding is much slower, because every frame must be decoded and compressed again. And because formats like H.264 are lossy, re-compressing already-compressed video discards a little more detail. One pass is usually invisible. Repeated round trips accumulate.

Which one should you want

For most trimming, frame accuracy matters less than people expect. If you are removing a few seconds of dead air at the start of a recording, landing on 4.0 instead of 4.2 is irrelevant, and the speed and quality preservation of a stream copy are worth far more.

Frame accuracy matters when the cut is doing creative work: landing on a beat, cutting on an action, matching a specific spoken word. There, re-encoding earns its cost.

A practical habit: trim losslessly when you are removing waste, and re-encode when the exact frame carries meaning.

Making cuts more precise

If you control the original recording, you can shorten the keyframe interval when you encode. Most software exposes this as “keyframe interval” or “GOP size”. A keyframe every second gives you much finer lossless cut points at a modest file size cost. Screen recorders and streaming encoders often default to long intervals, which is precisely why footage from them is awkward to trim cleanly.

The short version

Your cut point moved because video compression stores most frames as differences from other frames, and a clip has to start from a frame that stands alone. Tools either snap to the nearest such frame and stay fast and lossless, or rebuild the video to put one exactly where you asked. Neither is wrong. Knowing which one you are using explains the behaviour you are seeing.