Compress a video to 8, 10, 25, 50 or 100 MB
A file size limit is a bitrate budget. How to work out the number for any limit and length, how many minutes fit at each resolution, three free ways to hit the target, and when an automated compress-to-size step is worth paying for.
Commands and runs tested on 28 October 2026 with ffmpeg 8.1.2. Third-party limits checked the same day.
An upload form, a chat app or a mail service rejects anything over its limit. Most compressors ask for a "quality" setting instead of a size, so you guess, and the result is either still too big or blurrier than it had to be. You do not have to guess: the size of a video file is its bitrate times its length, so the right setting for a given limit can be calculated.
This guide gives the arithmetic first, then the free tools that can hit a size on purpose, and only then our paid tool, which is for batches and automations.
Disclosure: Quarrywise, the publisher of this site, built and sells the Apify Actor described near the end. The free methods need nothing from us.
The formula: size = bitrate × length
Bitrates are given in kilobits per second (kb/s); 8 bits make a byte. So:
- Size in MB = (video kb/s + audio kb/s) × seconds ÷ 8,000
- Video kb/s for a limit = limit in MB × 8,000 ÷ seconds, minus the audio kb/s, then about 5% off
The 5% covers the MP4 container (its index grows with the number of frames) and the encoder landing a little above the bitrate you asked for. Leave it out and the file can come out over the limit. We tested exactly that on our 12-second sample video with a 1 MB (1,000,000 byte) target and 96 kb/s audio:
| Video bitrate asked for | How it was worked out | File size | Fits under 1,000,000 bytes? |
|---|---|---|---|
| 570 kb/s | 1 × 8,000 ÷ 12 − 96 = 570.7, no margin | 1,026,842 bytes | No |
| 540 kb/s | 570.7 − 5% = 542, rounded down | 981,568 bytes | Yes, 1.8% under |
The encoder delivered about 548 kb/s when asked for 540 and about 579 when asked for 570, so always aim below the limit, never at it.
Then pick the resolution the bitrate can carry
The same bitrate spread over more pixels looks worse. At small sizes, a sharp 720p picture beats a smeared 1080p one. A rule of thumb for H.264 at 30 frames per second, from the thresholds our own tool uses (about 0.035 bits per pixel per frame, below which H.264 visibly falls apart):
| Video bitrate | Highest resolution worth using |
|---|---|
| 2,200 kb/s or more | 1080p (1920×1080) |
| 1,000 kb/s or more | 720p (1280×720) |
| 550 kb/s or more | 540p (960×540) |
| 430 kb/s or more | 480p (854×480) |
| 250 kb/s or more | 360p (640×360) |
| about 100 kb/s or more | 240p, the last stop before it is not worth watching |
These are floors, not targets. Talking heads and screen recordings still look fine a little below them; sport, confetti and handheld footage need more. At 24 fps the same bitrate goes a bit further.
Three worked examples
- 3 minutes into 50 MB: 50 × 8,000 ÷ 180 = 2,222 kb/s in all. Minus 128 kb/s audio is 2,094, minus 5% is about 1,990 kb/s for the video. That is above the 720p floor and below 1080p's, so encode at 720p and 1,990 kb/s.
- 1 minute into 8 MB: 8 × 8,000 ÷ 60 = 1,067 kb/s. Minus 128 audio is 939, minus 5% is about 890 kb/s: 540p.
- 10 minutes into 100 MB: 100 × 8,000 ÷ 600 = 1,333 kb/s. Minus 128 audio is 1,205, minus 5% is about 1,145 kb/s: 720p.
How many minutes fit in 8, 10, 25, 50 and 100 MB
The longest video that still gets each resolution, for a 16:9 source at 30 fps with stereo audio (128 kb/s when the budget allows, less when it is tight). The last column is the longest video for which a watchable picture is possible at all, at the smallest picture size.
| Limit | 1080p up to | 720p up to | 480p up to | Watchable at all up to |
|---|---|---|---|---|
| 8 MB | 26 s | 56 s | 1 min 56 s | 6 min 16 s |
| 10 MB | 33 s | 1 min 10 s | 2 min 26 s | 7 min 50 s |
| 25 MB | 1 min 23 s | 2 min 56 s | 6 min 5 s | 19 min 36 s |
| 50 MB | 2 min 47 s | 5 min 52 s | 12 min 11 s | 39 min 12 s |
| 100 MB | 5 min 35 s | 11 min 45 s | 24 min 22 s | 78 min 25 s |
We computed these with our Actor's own planning code (the same floors as the table above and a 3% margin), not by encoding every case. Removing the audio buys more time: 25 MB then fits 1080p up to 1 min 28 s and a watchable picture up to about 32 minutes. For anything in the last column, consider whether a share link would serve the reader better than a tiny, soft picture.
Free option 1: ffmpeg two-pass to an exact size
ffmpeg is free, runs on Windows, macOS and Linux, and is the most precise free route. Two-pass encoding is what makes the size predictable: the first pass studies the video, the second spends the bitrate where it is needed and lands close to the average you set. This is the command we ran for the 1 MB result above (12-second 1080p input, 540 kb/s video at 480p, 96 kb/s audio):
ffmpeg -y -i input.mp4 -c:v libx264 -preset medium -b:v 540k -vf scale=-2:480 -pass 1 -an -f mp4 /dev/null
ffmpeg -y -i input.mp4 -c:v libx264 -preset medium -b:v 540k -vf scale=-2:480 -pass 2 -c:a aac -b:a 96k output.mp4
- Replace
540kwith your video bitrate from the formula and480with the height from the resolution table.-2keeps the aspect ratio with an even width. - For a portrait phone video, put the number on the width instead:
scale=480:-2. - The first pass writes nothing useful, so its output goes to
/dev/null. In Windows PowerShell or Command Prompt, writeNULinstead. We ran both versions; each produced the same 981,568-byte file in about two seconds on a desktop PC. - Check the result before you upload it. If it is over, lower
-b:vby a few percent and run both passes again.
When this is enough: you have ffmpeg (or can install it), you compress now and then, and you do not mind a minute of arithmetic per video.
Free option 2: HandBrake with an average bitrate
HandBrake is a free desktop app built on the same encoders. Its default is constant quality, which does not aim at a size. To aim at one, set the video quality to an average bitrate (kbps), enter the number from the formula, and turn on multi-pass (two-pass) encoding. Set the resolution in the Dimensions tab.
HandBrake's own documentation is candid about this: an average bitrate gives you control of the file size and takes away control of the quality, multi-pass encoding is recommended, and aiming for a file size is recommended against unless you really need to. When the limit is fixed, you really need to. Its "Turbo" first pass is faster, at some cost in quality.
When this is enough: you prefer a window to a command line, and you compress a handful of videos by hand.
Free option 3: web tools for a single clip (8mb.video and others)
For one clip, a web compressor is the quickest route because it does the arithmetic for you. 8mb.video, for example, offers 8, 10, 20, 25, 50 and 100 MB presets and a custom size up to 200 MB. Its page says videos are deleted from its server after 90 minutes or once downloaded, and asks for donations rather than listing a price (checked 28 October 2026). Other sites work similarly.
Before you use any web tool, check three things: how large an upload it accepts, how long it keeps your file, and whether the video is private enough to upload to a third party at all.
When this is enough: one clip now and then, by hand.
MB versus MiB: why a "25 MB" file is still rejected
A megabyte is 1,000,000 bytes to some software and 1,048,576 bytes (a mebibyte, MiB) to other software, which still labels it "MB". The gap is about 5%, exactly the margin people forget.
- Windows File Explorer counts in units of 1,024. We created a file of exactly 25,000,000 bytes; Explorer's Properties dialog shows it as 23.8 MB (the Size column in Details view shows 24,415 KB, also counted in units of 1,024).
- Current Apple systems count in units of 1,000. Apple's support article names OS X Leopard and earlier and iOS 10 and earlier as reporting sizes in the binary system.
- Email adds its own overhead. Attachments are sent base64-encoded, which turns every 3 bytes into 4 characters, so a file is about a third larger on the wire. Gmail's help page gives 25 MB for personal accounts and turns larger attachments into a Google Drive link (checked 28 October 2026). If a mail server counts the encoded message, a 25 MB attachment can bounce: aim for about 18 MB.
The safe rule: treat the limit as decimal megabytes (1,000,000 bytes) and stay a few percent under it. A file under 25,000,000 bytes fits however the destination counts.
Limits also change. Discord's patch notes of 8 September 2026, for example, announce that its free upload limit went from 10 MB to 20 MB. Check your destination's current number before you compress.
Many videos, or from Make, n8n or Zapier: our Actor
The free routes need a person: someone to run the numbers, check the size and redo the ones that came out over. That is fine for a few videos. It breaks down when videos arrive in a batch or through an automation, where nobody is watching each file. If you can run ffmpeg where the videos arrive, a script with a size check does this for free; the Actor is for where you cannot (Make, Zapier, n8n Cloud) or do not want to maintain the retry loop.
We built Compress Video to Size: Under 10 MB, 25 MB or Any on the Apify Store for that case. You give it links to video files (or upload them) and a limit in MB; it does the arithmetic and the resolution choice above, and:
- encodes in two passes (H.264 by default), checks the finished file and redoes it smaller if it
came out even one byte over, up to three encodes, so
output_bytesis never above the limit; - treats the limit as decimal MB, aims about 3% under it, and returns a
within_limitflag your workflow can branch on; - copies a video that already fits into MP4 without re-encoding, for the per-video price only, when it is already 8-bit, standard-range H.264 within 1080p and 30 fps (the defaults) with mono or stereo AAC or MP3 audio; other files, such as HEVC iPhone clips, are re-encoded;
- refuses a limit that is too small for a watchable picture, charges nothing, and tells you the smallest limit that would work;
- removes location, device and other metadata from every output.
A real run
We started two runs on 28 October 2026 with our public 12-second 1080p sample video (6.2 MB). The input for the first:
{
"videoUrls": ["https://quarrywise.com/samples/fit-to-size-test-1080p.mp4"],
"target": "custom",
"targetSizeMb": 1
}
A 1 MB limit for 12 seconds is the same budget per second as 8 MB for a 96-second clip, so it shows a real compression. The run took 19 seconds at the default 4 GB of memory. An excerpt of the dataset row:
{
"status": "compressed",
"within_limit": true,
"target_bytes": 1000000,
"input_bytes": 6184974,
"output_bytes": 991117,
"reduction_percent": 84,
"duration_seconds": 12,
"billed_seconds": 12,
"input_resolution": "1920x1080",
"resolution": "854x480",
"video_kbps": 544,
"audio_kbps": 96,
"passes": 2,
"attempts": 1,
"quality": "ok"
}
It chose 480p, as the hand calculation did, with 96 kb/s audio, landed 0.9% under the limit
in one attempt, and charged $0.034 (the math is below). The row also carries an
output_url, a download link for the MP4.
The second run used "targetSizeMb": 8. The 6.2 MB sample already fits, and it is
H.264 with AAC audio, so the Actor did not touch the picture:
{
"status": "copied",
"within_limit": true,
"target_bytes": 8000000,
"input_bytes": 6184974,
"output_bytes": 6184248,
"billed_seconds": 0,
"resolution": "1920x1080",
"note": "Already under the target: the streams were copied into MP4 without re-encoding (metadata removed). Only the per-video event was charged."
}
That run took 9 seconds and charged $0.01. The file is 726 bytes smaller because it was repackaged and its metadata removed. Try it with your own video at 8 or 50 MB, or open the ready-made example that compresses a video to 10 MB at 720p.
From Make, n8n, Zapier or your own code
Start the Actor through the Apify API, or Apify's modules for Make, n8n and Zapier, with the
same JSON, then read output_url and within_limit from the dataset row. Up
to 100 videos fit in one run (10 by default). Encoding happens on the CPU: at the default 4 GB
(one core), allow about 2 to 4 minutes per minute of 1080p output. The API's synchronous call waits
at most 300 seconds, so for anything longer than about a minute of video, start the run and pick up
the result when it finishes. Our
n8n guide for the 25 MB transcription limit
walks through a complete workflow.
What it does not do
- It takes video files, not pages: links to YouTube, TikTok, Instagram and other platforms are refused, as are streaming playlists and links behind a login.
- Output is MP4, at most 1080p and 60 fps, never enlarged. Limits from 0.5 to 1,000 MB; inputs up to 2,048 MB, up to 4K, and up to 120 minutes (30 by default, to protect your budget).
- No H.265 (HEVC) output. HEVC input, such as iPhone video, is accepted. AV1 output is available for players that support it.
What it costs, with the math
Pay per event, the same prices on every Apify plan:
- $0.01 per video saved under the limit
- $0.002 per second of output video ($0.12 a minute); the last partial second counts as a whole one
- $0.002 more per second when the input is above 1080p, for example 4K phone footage
- plus Apify's standard Actor start event, a fraction of a cent per run
- free: limits that are too small, videos still over the limit after three encodes, failed downloads and files that are not videos
| Job | Math | Cost |
|---|---|---|
| Our 12-second sample to 1 MB (the run above) | $0.01 + 12 × $0.002 | $0.034 |
| A video that already fits and is copied | $0.01 + 0 seconds | $0.01 |
| A 30-second clip to 8 MB | $0.01 + 30 × $0.002 | $0.07 |
| A 1-minute clip to 25 MB | $0.01 + 60 × $0.002 | $0.13 |
| A 1-minute 4K phone video to 25 MB | $0.01 + 60 × $0.002 + 60 × $0.002 | $0.25 |
| A 3-minute screen recording to 50 MB | $0.01 + 180 × $0.002 | $0.37 |
| A 10-minute video to 100 MB | $0.01 + 600 × $0.002 | $1.21 |
| A batch of 200 clips of 20 seconds each to 10 MB (2 runs of 100) | 200 × ($0.01 + 20 × $0.002) | $10.00 |
| A 30-minute recording into 10 MB (refused) | nothing encoded | $0 |
Re-encoded videos cost the same whatever the limit: the price follows the output length (doubled per second for input above 1080p), and a video that already fits and is copied costs $0.01 whatever its length. Set a maximum charge per run in Apify Console or the API and the Actor checks the remaining budget before each video and stops cleanly instead of starting one it cannot pay for. Apify's free plan includes a monthly usage credit; see Apify's pricing page for the current amount.
To be fair about price: for a long video you compress once, ffmpeg or HandBrake costs nothing and does the same job. The Actor earns its price when the work repeats, runs unattended, or must never hand a file over the limit to the next step.
FAQ
Can a video come out at exactly 8 MB?
Close, not exact. An encoder hits an average bitrate, not a byte count, so every method aims a little under the limit. In our tests the free two-pass command landed 1.8% under and the Actor 0.9% under.
Why lower the resolution instead of the quality?
At a fixed size they are the same trade, but fewer pixels with enough bits each look much better than full resolution with too few. A 1-minute clip in 8 MB looks better at 540p than at 1080p.
Does zipping the video help?
No. Video is already compressed, so a zip barely shrinks it, and most upload forms want the video file itself.
Should I remove the audio?
If nobody needs the sound, yes: in a tight budget, 128 kb/s of audio is a large share. For a 1-minute clip in 8 MB it is about 12% of the budget.
Can I compress a YouTube or TikTok video?
Not with our Actor: those are web pages, not video files, and their terms do not allow downloading. Use a video file you have the right to process.
Does the Actor keep my video?
No. Each video is downloaded to the run's temporary disk, encoded and deleted from that disk. The
compressed file and the result row are stored only in the run's own storage in your Apify account,
which Apify deletes after your plan's data retention period. Anyone with the
output_url can download the file until then, so do not post the link publicly.
Quarrywise is independent and isn't affiliated with or endorsed by Discord, Google, Apple, Microsoft, HandBrake, 8mb.video, Apify or the other services named here.
Sources
- ffmpeg documentation (the
-passoption) - HandBrake: constant quality versus average bit rate
- 8mb.video (checked 28 October 2026)
- Apple: how storage capacity is measured on Apple devices
- Gmail Help: send attachments with your Gmail message (checked 28 October 2026)
- Discord patch notes, 8 September 2026
- Compress Video to Size on the Apify Store