How to compress a screen recording under 10 MB (ffmpeg, two-pass)
Many tools cap uploads at 10 MB. The ffmpeg two-pass commands we use to fit a two-minute screen recording under the limit, and the bitrate math behind them.
Ten megabytes is the number that keeps coming back. GitHub caps videos at 10 MB in repositories on a free plan. Linear's free plan refused our 2 min 43 demo until we brought it under 10 MB. Chat tools change their limits often, but the safe target stays roughly the same.
A raw screen recording blows through that in seconds. Here is how we bring a two-minute recording under 10 MB without turning the text into soup, with commands you can paste.
The arithmetic first
File size is bitrate times duration. That's the whole trick. Pick the size, divide by the duration, and you get the bitrate to encode at.
10 MB is 10 × 8 × 1,024 = 81,920 kilobits. Keep about 6% for the container and a safety margin, take out the audio, and the rest is for the picture:
video kbps = (10 × 8192 × 0.94) / seconds − audio kbps
For our 2 min 43 demo (163 seconds) with 96 kb/s audio:
(10 × 8192 × 0.94) / 163 − 96 ≈ 376 kb/s
Our prototype, encoded at about 360 kb/s, came out at 9.1 MB. The margin also covers tools that count a megabyte as 1,000,000 bytes instead of 1,048,576: 94% of 10 MiB is 9.86 million bytes, still under 10 million.
The commands
Two passes. The first one analyzes the video and writes a log. The second one encodes, spending bits where the picture changes and saving them where it doesn't.
in=demo.mov
out=demo-10mb.mp4
d=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$in")
v=$(awk -v d="$d" 'BEGIN { printf "%d", 10 * 8192 * 0.94 / d - 96 }')
ffmpeg -y -i "$in" -vf "scale=-2:720:flags=lanczos" -c:v libx264 -preset slow \
-b:v "${v}k" -pass 1 -an -f mp4 /dev/null
ffmpeg -i "$in" -vf "scale=-2:720:flags=lanczos" -c:v libx264 -preset slow \
-b:v "${v}k" -pass 2 -c:a aac -b:a 96k -movflags +faststart "$out"
What each choice does:
scale=-2:720brings the video to 720 pixels tall and keeps the width even. For a vertical video, usescale=720:-2to fix the width instead.flags=lanczosis a sharper resampler than the default. On text, it is the difference between crisp and blurry letters.libx264is H.264, the codec every browser and chat app plays inline.-preset slowspends more time to get more quality out of the same bitrate. Worth it for a file you encode once.-pass 1and-pass 2hit the target size reliably. The first pass writesffmpeg2pass-0.login the current folder; delete it afterwards.-movflags +faststartmoves the index to the start of the file, so it starts playing before it has fully downloaded.
Why 720p and not 1080p
At a few hundred kilobits per second, 1080p has too many pixels to feed. The encoder starves, and fine detail such as small text smears first. At 720p, the same bitrate covers fewer pixels, and text stays readable.
Most people watch these videos in a chat thread or a ticket, often on a laptop screen at a fraction of full size, or on a phone. 720p is plenty there. Keep the full 1080p original for the share page or a download.
Why two-pass instead of CRF
The usual advice for ffmpeg is CRF (constant rate factor): -crf 23 and let the encoder decide. CRF targets a quality, not a size. A quiet screen recording might come out at 4 MB, a busy one at 30 MB. You only find out after encoding.
When the limit is a hard number, two-pass with a target bitrate is the right tool. It lands within a few percent of the size you asked for, every time.
When the bitrate gets too low
The formula always gives a number, but below a point the picture suffers. As a rough guide, if the video bitrate drops well under 250 kb/s at 720p, text starts to smear during scrolling and transitions. At that point you have three options:
- Cut the video. A tighter edit is usually a better video anyway. See How long should a demo video be?.
- Drop the frame rate with
-r 30if the source is at 60 fps. Screen recordings rarely need 60. - Share a link instead of the file. Host the full-quality version and post a link with a poster image.
Make recordings that compress well
Screen recordings compress very well when most of the screen stays still. A few habits help:
- Avoid animated backgrounds and auto-playing carousels in the recorded area.
- Hide the noise: notification badges, a clock that ticks, a cursor that wanders when nothing happens.
- Record at the size you need. A browser window at 1440 or 1920 pixels wide, captured at a high device scale factor, gives crisp text. We go into it in Crisp browser screen recordings with Playwright.
- Don't use H.265 for sharing. HEVC files are smaller, but not every browser and chat app plays them inline. H.264 is the safe choice.
What we do automatically
Every video Pullscene renders is checked against a size limit (10 MB by default). When the full-quality video is bigger, a second file is made next to it with exactly the commands above: 720p, Lanczos scaling, H.264 two-pass at the computed bitrate, AAC audio at 96 kb/s, fast start. That small version is the one posted to tools with an upload limit, while the share link plays the original.
Frequently asked questions
How do I make a video smaller than 10 MB?
Re-encode it with a target bitrate: divide 10 MB (about 82,000 kilobits, minus a 6% margin) by the duration in seconds, subtract the audio bitrate, and encode with ffmpeg in two passes at 720p with H.264.
Is two-pass encoding better than CRF?
For a size limit, yes. CRF targets a constant quality, so the final size is unpredictable. Two-pass with a target bitrate lands close to the size you ask for.
What resolution should a compressed screen recording use?
720p for a file that must stay under 10 MB. At low bitrates, 1080p spreads the bits over too many pixels and small text blurs first.
Does H.265 make smaller files?
Usually, at the same quality. But not every browser and chat app plays HEVC inline, so for a file you share, H.264 in an MP4 container is the safer choice.