Video file size API: MB per minute, what fits in free space, bitrate for a target size
Video size is just bitrate times time: MB = Mbps x seconds / 8. A minute of 4K at 30 fps from a phone is about 170 MB in HEVC and 350 MB in H.264; a minute of 1080p is 40 to 60 MB. This endpoint does that maths for typical recording settings, tells you how long fits on a card or phone, and works backwards from a size limit to the bitrate and ffmpeg commands that land under it.
/v1/video-size?preset=p4k_30&codec=hevc&duration=10 returns JSON. No key, CORS on, 60 requests a minute./v1/video-size
Video file size: MB for a length, what fits in free space, bitrate and ffmpeg commands for a target size. Change the values and press Send request to call the live API.
Parameters
| Name | Type | What it does | Default |
|---|---|---|---|
mode | string | size (default) | fits | target | presets | size |
preset | string | Recording setting: p720_30, p1080_30, p1080_60, p4k_24, p4k_30, p4k_60, slo1080, screen, call | p1080_30 |
codec | string | h264 or hevc (HEVC is about half the size) | hevc |
mbps | number | Custom bitrate in Mbps (overrides preset) | — |
duration | string | Length: minutes (12), mm:ss (3:45), h:mm:ss (1:20:00) or 1h20m | — |
free_gb | number | mode=fits: free space in GB | — |
target_mb | number | mode=target: size limit in MB | — |
audio_kbps | number | mode=target: audio bitrate, 0 for none | 128 |
Example
Request:
GET https://api.oddlathe.com/v1/video-size?preset=p4k_30&codec=hevc&duration=10
Response (generated by the real code when these docs were last built; random or time-based values will differ for you):
{
"mode": "size",
"setting": {
"preset": "p4k_30",
"label": "4K, 30 fps",
"codec": "hevc",
"mbps": 23
},
"seconds": 600,
"mb": 1725,
"gb": 1.725,
"gib": 1.607,
"mb_per_minute": 172.5,
"gb_per_hour": 10.35,
"fat32": {
"fits": true,
"max_seconds_one_file": 1494
},
"limits": [
{
"name": "Typical email attachment limit",
"mb": 25,
"fits": false
},
{
"name": "FAT32 single file",
"mb": 4295,
"fits": true
}
],
"summary": "About 1.73 GB for 10 min of 4K, 30 fps (HEVC)."
}
Code examples
curl 'https://api.oddlathe.com/v1/video-size?preset=p4k_30&codec=hevc&duration=10'const params = new URLSearchParams({
preset: "p4k_30",
codec: "hevc",
duration: "10"
});
const res = await fetch(`https://api.oddlathe.com/v1/video-size?${params}`);
if (!res.ok) throw new Error((await res.json()).error.message);
const data = await res.json();
console.log(data);import json, urllib.parse, urllib.request
params = urllib.parse.urlencode({"preset": "p4k_30", "codec": "hevc", "duration": "10"})
url = "https://api.oddlathe.com/v1/video-size?" + params
# Send a User-Agent: the edge network refuses Python's default one.
req = urllib.request.Request(url, headers={"User-Agent": "my-script/1.0"})
with urllib.request.urlopen(req, timeout=10) as r:
data = json.load(r)
print(data)When it's useful
- Upload forms that warn before a clip is too big, or suggest a compression target
- Storage planners for SD cards, drones, dashcams and phones: how many minutes of 4K fit in 64 GB?
- Scripts that compress recordings to a size limit with two-pass ffmpeg
- Teaching how bitrate, codec and resolution trade off against file size
Good to know
mode=size(default) takespresetandcodec, or a custommbps, plusduration. Returnsmb,gb,gib(as Windows shows it),mb_per_minute,gb_per_hour, a FAT32 4 GB single-file check and a typical 25 MB email-limit check.mode=fits&free_gb=64lists minutes of every preset that fit, and adds a headline for thepresetormbpsyou pass.mode=target&target_mb=25&duration=2:00returnsvideo_kbps(after audio and 3% headroom), a sensibleresolution,scale_toand two-passffmpegcommands (Linux/macOS and Windows). If it can't fit,okis false withmin_mb_needed.- Durations accept minutes (
12),3:45,1:20:00or1h 20m. Sizes are decimal MB and GB, as drives are sold. - Preset rates are rounded typical phone and camera figures; real files vary with motion, light and settings.
- Browser UI: Tooltern video size calculator with the same model and a film-strip view (nothing leaves your device).
How big a video is from a recording setting (or bitrate) and length: MB = Mbps x seconds / 8, with GiB as Windows shows it, whether it fits one FAT32 file and a typical 25 MB email limit. mode=fits says how many minutes of each setting fit in free space, mode=target gives the video bitrate (with 3% headroom), a sensible resolution and two-pass ffmpeg commands to land under a size limit, and mode=presets lists the typical rates. Pure maths; nothing is stored.
Errors
Errors are JSON like {"error": {"code": "…", "message": "…"}}. The ones this endpoint can return:
bad_param(400): a value is the wrong type or out of range (the message says which)rate_limited(429): over 60 requests a minute; wait for Retry-After seconds
Questions
How big is a minute of 4K video?
About 170 MB at 4K 30 fps in HEVC and about 350 MB in H.264. <code>/v1/video-size?preset=p4k_30&duration=1</code> returns 172.5 MB.
What bitrate gets a 2 minute video under 25 MB?
About 1,488 kbps video plus 128 kbps audio, which suits 720p. <code>/v1/video-size?mode=target&target_mb=25&duration=2:00</code> also returns the ffmpeg commands.
Why does Windows show a smaller number?
Windows counts in GiB (1,073,741,824 bytes) but labels it GB, so a 4.5 GB file shows as about 4.19 GB. The response includes <code>gib</code>.
Is anything stored?
Never. Pure maths on the query string.
Related endpoints
/v1/stream-dataStreaming data use: GB per hour, monthly allowance planner, film size, hours from GB/v1/input-lagInput lag: ms from button press to picture, split into six parts, with the biggest fixes ranked/v1/unitsConvert length, mass, temperature, data-size or data-rate units/v1/batteryPower bank maths: charges after losses, size needed, flight rule, multi-gadget plan
Prefer a page to an API?
- Video size calculator (size, what fits, target bitrate) on Tooltern: same job, nothing leaves your browser.
Published · OpenAPI 3.1 spec · Limits and privacy