Why does a cut video sometimes start half a second off? The answer hides in I/P/B frames and the GOP structure.
What Is Video Cutting?
Video cutting (or trimming) is the process of selecting a specific time segment from a video, keeping the desired portion and discarding the rest. It is the most fundamental and essential operation in video editing—whether you're extracting a highlight, removing an intro/outro, or precisely deleting a specific second of content.
Cutting seems simple, but there's more beneath the surface. Why does a cut sometimes miss the exact point by a tiny margin? Why can some cuts be precise to the millisecond while others are always "off by a frame"? To answer these questions, we need to understand the underlying structure of video.
Frames and Timelines
A video is essentially a sequence of still images (frames) played at a certain rate to create the illusion of motion. Each frame has a precise time position, and a timeline is a visual representation of these frames arranged chronologically.
- Frame Rate: The number of frames displayed per second. Common rates include 24fps (cinema), 25fps (PAL), 30fps (NTSC), and 60fps (high frame rate).
- Playhead: A marker on the timeline indicating the current preview or seek position.
- Millisecond Precision: In a 25fps video, each frame lasts 40 milliseconds. High-precision editing tools can position to the millisecond, but the cut is ultimately constrained by frame boundaries.
Keyframes and Non-Keyframes: I/P/B Frames Explained
To understand cutting precision, you must first understand the three types of video frames:
| Frame Type | Full Name | Characteristics | Independently Decodable? |
|---|---|---|---|
| I-frame | Intra-coded Frame | Fully encoded independent frame, like a complete image | Yes |
| P-frame | Predicted Frame | References previous I or P frames, records only differences | No |
| B-frame | Bi-directional Predicted Frame | References both preceding and following frames, highest compression | No |
A key concept: only I-frames can be independently decoded. P-frames and B-frames depend on other frames to display correctly. This means if you cut at a P-frame or B-frame position, the decoder must start from the nearest I-frame to correctly display that frame.
GOP: Group of Pictures
A GOP (Group of Pictures) is a sequence of frames from one I-frame to just before the next I-frame. For example, a GOP structure might be: I B B P B B P B B P B B I.
- GOP Size: The distance between two I-frames. Common GOP sizes are 12-30 frames, meaning an I-frame appears every 0.5-1 seconds.
- Larger GOP: Higher compression efficiency (fewer I-frames, less space), but more difficult random access and precise cutting.
- Smaller GOP: Easier precise cutting, but larger file size.
Why Are Some Cuts Imprecise?
When you try to cut at a non-I-frame position, you encounter precision issues:
- Direct Stream Copy: No re-encoding; the data stream is copied directly. This is extremely fast but can only cut at I-frame boundaries, with precision limited by the GOP structure. If I-frames are 0.5 seconds apart, the worst-case deviation is about 0.5 seconds.
- Re-encoding: Frames near the cut point are re-encoded. This achieves frame-accurate cutting but requires more processing time and may introduce minor quality loss.
Direct Stream Copy: Fast, low precision (constrained by I-frames)
Re-encoding: Slow, high precision (frame-accurate)
Extract vs. Remove: Two Cutting Modes
Cutting operations typically offer two modes:
- Extract: Keep the selected time segment, discard the rest. For example, extracting the 2-3 minute segment from a 10-minute video.
- Remove: Delete the selected time segment, keep the rest. For example, removing a 10-second ad from the middle of a video.
The two modes are technically identical in implementation, differing only in which portion is retained. In practice, extract mode is more commonly used for capturing clips, while remove mode is more commonly used for cleaning up content.
Fade In and Fade Out Effects
Fade in and fade out are common transition effects in cutting:
- Fade In: The image gradually appears from black (or transparent), typically lasting 0.5-2 seconds.
- Fade Out: The image gradually disappears to black (or transparent), typically lasting 0.5-2 seconds.
Why are fades important?
- Visual Comfort: Abruptly appearing or disappearing images can jolt the viewer. Fades provide a gentle transition.
- Narrative Function: Fade out often signals the end of a segment; fade in signals the beginning of a new one. This is basic film grammar.
- Audio Sync: Video fades are usually accompanied by audio fades, avoiding sudden sound changes.
Practical Tips
- Prioritize speed: Use direct stream copy mode, accepting possible frame-precision deviation for quick rough cuts.
- Prioritize precision: Use re-encoding mode to ensure frame-accurate cuts for fine editing.
- Add transitions: Apply fade in/out effects at cut points for smoother visual transitions.
- Mind the audio: Check the audio waveform when cutting to avoid splitting words mid-utterance.
- Preview to confirm: Always preview content around cut points to verify both picture and sound meet expectations.