How to compress a video without wrecking the quality
Most compression advice tells you to squeeze the file as small as it will go. That is usually the wrong move, because YouTube and Meta re-encode whatever you send them anyway.
8 minute read
The only formula that matters
File size is bitrate multiplied by duration, and almost nothing else. Bitrate is how many bits per second the encoder spends describing the picture, so a clip encoded at 8 megabits per second uses 8 million bits for every second it runs. Sixty seconds of that is 480 megabits, which is 60 megabytes. Ten minutes is 600 megabytes. Once you internalise that, most compression questions answer themselves: halving the bitrate halves the file, and a twenty-minute video will always be roughly twenty times a one-minute video at the same settings. Everything else people fiddle with, resolution, frame rate, codec, preset, only matters through its effect on how much bitrate you need to look acceptable.
Why resolution and frame rate are levers, not the file size
Dropping from 4K to 1080p does not shrink the file because there are fewer pixels in the container. It shrinks the file because a 1080p frame needs far less bitrate to look clean than a 2160p frame does. YouTube's own table makes the scale of that clear: it asks for 8 Mbps at 1080p and 35 to 45 Mbps at 4K, roughly a fivefold difference. Frame rate works the same way, with high frame rate uploads at 48 to 60fps carrying about a 50 percent bitrate premium. So the first question is not what settings to use, it is whether you need 4K and 60fps at all. A talking head or a screen walkthrough almost never does.
Container versus codec, and why MP4 tells you very little
MP4 and MOV are containers. They are boxes holding a video stream, an audio stream, subtitles and metadata. H.264, HEVC and AV1 are codecs, the actual compression schemes producing the video stream inside the box. The same .mp4 extension can hold H.264 that plays on a fifteen-year-old phone or AV1 that a lot of hardware still cannot decode, which is why being told a file is MP4 tells you almost nothing about whether it will play. When a platform lists its requirements it usually specifies both: Meta's Instagram Platform documentation, for instance, asks for a MOV or MP4 container with HEVC or H264 inside it, progressive scan, and AAC audio. Container and codec are two separate decisions.
Use CRF, not a target bitrate
Encoders offer two broad modes. You can name a bitrate and let quality float, or name a quality level and let bitrate float. That second mode is CRF, the constant rate factor, and it is almost always what you want for making a file smaller without it looking bad. It spends bits where the picture is complicated and saves them where it is not, so a static slide costs almost nothing and a fast pan gets what it needs. Werner Robitza's widely cited CRF guide puts x264's default at 23 with a sane range of 18 to 28, and notes that a change of about 6 roughly halves or doubles the file. HandBrake calls the same control RF and states the position bluntly: always use constant quality unless you have a specific reason not to.
The point nearly every guide skips: it gets compressed twice
Nobody watching your video ever receives the file you uploaded. YouTube's help page on low quality after upload describes uploads being processed in stages, appearing first at low quality while higher resolutions finish over the following hours. That processing is a re-encode, into multiple resolutions and multiple codecs, and it is why YouTube publishes recommended upload settings at all. So if you crush your video to 2 Mbps before uploading to save time, the platform then re-encodes your already-damaged picture, and compression artefacts get compressed. The result is visibly worse than uploading a clean file at the recommended bitrate and letting the platform do its one pass. Compress for your hard drive and your email attachments. Do not pre-compress for a platform.
What YouTube and Meta actually publish
The two big platforms are not equally forthcoming, which is worth knowing before you trust a spec sheet you found elsewhere. YouTube publishes a genuinely detailed table: MP4 container with a fast-start moov atom, H.264 High Profile, AAC-LC or Opus audio at 48kHz, and specific SDR bitrates of 5 Mbps at 720p, 8 at 1080p, 16 at 1440p and 35 to 45 at 4K, with separate higher figures for HDR. Meta publishes far less. Its Instagram Platform media reference gives container, codec, progressive scan, closed GOP, 4:2:0 chroma, 23 to 60fps and AAC audio at up to 48kHz, but no comparable recommended bitrate. Most of the confident Meta bitrate numbers circulating online do not trace back to a Meta document.
Three practical routes, in order of effort
Your operating system will do it for free. On a Mac, right-click a video in Finder and use the Encode Selected Video Files quick action, which offers 480p, 720p, 1080p and 4K, plus a choice between higher quality and greater compatibility. HandBrake is the next step up: pick a preset, set RF somewhere in its recommended range of 20 to 24 for 1080p or 22 to 28 for 4K, and let it run. For repeatable work, ffmpeg does it in one line, such as ffmpeg -i input.mov -c:v libx264 -crf 23 -preset slow -c:a aac -b:a 128k output.mp4. Add -vf scale=-2:1080 to that command when the source is 4K and the destination is not.
When compression is the wrong fix
Sometimes the file is not badly encoded, it is just too long. A twenty-minute screen recording at 4K can pass 5 GB before you touch anything, and no encoder setting fixes a video that should have been three minutes. Trimming dead air, cropping to the frame you will actually publish, and cutting a long recording into the moments worth watching all reduce file size far more aggressively than any CRF value, and they improve the video while doing it. That last one is the part worth automating rather than scrubbing a timeline by hand, which is what FrameOS does from the transcript. Reach for the encoder after you have decided what is staying in.
FAQ
How do I compress a video without losing quality?
Use constant quality rather than a target bitrate. In HandBrake set RF around 20 to 24 for 1080p; in ffmpeg use -crf 23 with libx264. Werner Robitza's CRF guide puts the sane range at 18 to 28, where 18 is effectively indistinguishable from the source. Dropping the resolution to what you will actually publish usually saves more than any quality tweak.
Should I compress a video before uploading to YouTube?
Only enough to make the upload practical. YouTube re-encodes everything into multiple resolutions and codecs during processing, so a heavily compressed upload gets compressed a second time and the artefacts compound. Aim for YouTube's published recommendations instead: 8 Mbps at 1080p, 16 at 1440p, and 35 to 45 at 4K for standard frame rate SDR video.
What is the difference between MP4 and H.264?
MP4 is a container, a wrapper holding video, audio, subtitles and metadata. H.264 is a codec, the compression scheme that produces the video stream inside it. One MP4 might contain H.264, another HEVC, another AV1, with very different compatibility. That is why knowing a file is MP4 tells you almost nothing about whether a given device can play it.
Is HEVC or AV1 worth using instead of H.264?
For archiving and for your own storage, yes, since both reach the same quality at a lower bitrate. For uploads, less so. YouTube's recommended settings still specify H.264 High Profile, and Meta's Instagram documentation accepts HEVC or H264. Since the platform re-encodes anyway, the compatibility of H.264 is usually worth more than the bitrate you would save.
Sources
- YouTube recommended upload encoding settings · YouTube Help
- Low video quality after upload · YouTube Help
- IG User Media reference (Reels and video specifications) · Meta for Developers
- Adjusting quality (constant quality and RF values) · HandBrake
- CRF Guide (Constant Rate Factor in x264, x265 and libvpx) · Werner Robitza
Related pages
Keep reading
More Video Basics →How to record your screen on any device
Every device you own already has a screen recorder built in. The differences that matter are not the keyboard shortcut but what audio each one captures and how readable the result is on a phone.
8 minute readFree stock video sites, and what their licences actually say
Attribution rules differ by site and sometimes by clip. None of these libraries hands you a model release. Here is what each licence page says, in its own words.
9 minute readHow to reset your algorithm on Instagram and TikTok
Instagram's reset wipes recommendations across Feed, Reels and Explore. TikTok's refresh touches only the For You feed. Neither can be undone, and neither is as broad as most people assume.
8 minute readTurn one long video into a week of posts
300 credits for 3 days · no card
Start free