What is actually inside a video file
Someone sends you an MP4 and it will not open. Someone else sends you an MP4 and it opens everywhere. The extension told you almost nothing, and knowing why is most of what you need.
The box and the thing in the box
A container is a box. MP4, MOV, MKV and AVI are all boxes. A container holds one or more streams and an index saying where each one starts, and that is its entire job.
A codec is the method used to compress what is in the box. H.264 is a codec. HEVC is a codec. MP4 is not a codec and never was.
So a .mov from a camera is usually H.264 and plays fine. A .mov out of a Mac finishing suite is often ProRes and Windows will refuse it until you install something. Same extension, same box, completely different contents.
Bitrate is the only lever that matters much
Bitrate is how many bits per second the file spends. It governs quality and it governs size, and the relationship between the two is not linear.
The number a picture needs depends on how hard it is to predict. Compression works by describing what changed since the last frame, so a locked off interview against a plain wall is nearly free: almost nothing changes. Confetti falling, water, fire, foliage in wind, or a handheld shot where every pixel moves, all defeat the prediction and need many times the bits for the same apparent quality.
| Material at 1080p30 | Comfortable H.264 bitrate |
|---|---|
| Talking head, static camera, plain background | 4 to 6 Mbps |
| General interview and B roll, some movement | 8 to 10 Mbps |
| Handheld, outdoors, foliage or crowds | 12 to 16 Mbps |
| Sport, confetti, water, heavy grain | 20 Mbps and up |
Double those for 2160p. Halve them for 720p. Add roughly 50 percent when going from 30fps to 60fps.
Target a quality, not a size, when you can
Encoders offer you two ways to ask for what you want.
Ask for a bitrate and the encoder spends that many bits whether the picture needs them or not. On a still shot they are wasted. On a busy shot the picture falls apart because there were never enough.
Ask for a quality level instead, which most encoders call CRF, and it spends what each shot requires. 18 is visually indistinguishable from the source for most material. 23 is the common default and is fine. 28 is visibly soft on faces. The file size is whatever it turns out to be, which is the trade.
Use CRF when quality matters and size is negotiable. Use bitrate when a platform has given you a hard ceiling. There is no third option where you get both.
File size is arithmetic and nothing else
Bitrate times duration. Eight megabits per second for sixty seconds is 480 megabits, which is 60 megabytes. If the limit is 8 MB for a minute of video, you have about 1 Mbps to work with, and no encoder setting on earth changes that.
So when a piece will not fit, you have exactly three moves. Make it shorter. Make it smaller in resolution, since 720p at 1 Mbps looks far better than 1080p at 1 Mbps. Or accept that it will be soft.
Keyframes, and why lossless trimming lands in the wrong place
Only some frames are stored whole. Those are keyframes, and typically there is one every two seconds. Every frame in between stores only the difference from its neighbours, which is where all the compression comes from.
A tool that trims without re-encoding can only start at a keyframe, because it has nothing else to start from. That is why lossless cutters move your edit by up to two seconds and why the result sometimes begins with a smear. If the cut has to land exactly, the section has to be re-encoded.
Every re-encode costs you, and the cost compounds
Compression throws away detail it calculates you will not miss. Re-encode the result and the second encoder makes that judgement again, on a picture where the easy detail is already gone, so it starts removing things you will miss.
Three or four generations of H.264 is usually where it becomes obvious. Faces go waxy, gradients band, and edges grow a halo. The fix is to transcode once, at the end, and to work from an intermediate format if the project has many stages.
Moving a stream from one box to another, called a remux, costs nothing at all, because nothing is decoded. Pulling H.264 out of an MKV and putting it in an MP4 is instant and lossless. Turning that same H.264 into HEVC is not.
Audio inside the file
Work at 48 kHz. Every camera records it, every editor expects it, and mixing 44.1 and 48 in one project invites resampling errors. Work in 24 bit if the recorder offers it, because it gives you room to record quietly and lift later without dragging up the hiss.
Deliver AAC at 192 kbps stereo, or 128 for spoken word only. Going above that is bytes you will never hear.
The settings, written out
- Container MP4, video H.264, audio AAC, unless someone has told you otherwise in writing.
- CRF 20 for delivery you care about. Bitrate only when a size limit forces it.
- 48 kHz audio, 192 kbps AAC.
- Turn on faststart if it will be played from a web page. It moves the index to the front so playback can begin before the download finishes.
- Upload better than the platform delivers. Every platform re-encodes what you give it, and the cleaner your input, the better its output.