Pick a size, turn it into a bitrate and send it to ReelSDK's POST /v1/ffmpeg. A 129 MB, 30-second 1080p clip with a 5 MB budget comes back at 4.6 MB for under 1 cent, at $0.02 per compute minute.
Video compression API
Yes: a 5 MB budget over 30 seconds leaves about 1,200 kb/s for video once the audio takes its 128k, so you send ReelSDK -b:v 1200k with a matching -maxrate and one pass lands under the target.
Use casesUpdated
The request
POST /v1/ffmpeg
Compress a video to a size budget in one ffmpeg call: a 129 MB 1080p clip fits a 5 MB target at 4.6 MB, for under 1 cent.
curl "https://api.reelsdk.com/v1/ffmpeg?wait=120" \
-H "Authorization: Bearer $REELSDK_KEY" \
--json '{
"inputs": {
"launch-master.mp4": "https://api.reelsdk.com/f/lib/in/use-cases/launch-master.mp4"
},
"args": [
"-i", "launch-master.mp4", "-c:v", "libx264", "-b:v", "1200k",
"-maxrate", "1200k", "-bufsize", "2400k", "-preset", "medium", "-c:a",
"aac", "-b:a", "128k", "-movflags", "+faststart", "compressed-5mb.mp4"
],
"outputs": ["compressed-5mb.mp4"]
}'const res = await fetch("https://api.reelsdk.com/v1/ffmpeg?wait=120", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.REELSDK_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": {
"launch-master.mp4": "https://api.reelsdk.com/f/lib/in/use-cases/launch-master.mp4"
},
"args": [
"-i", "launch-master.mp4", "-c:v", "libx264", "-b:v", "1200k",
"-maxrate", "1200k", "-bufsize", "2400k", "-preset", "medium", "-c:a",
"aac", "-b:a", "128k", "-movflags", "+faststart", "compressed-5mb.mp4"
],
"outputs": ["compressed-5mb.mp4"]
}),
});
const { job } = await res.json();{
"job": {
"id": "job_clapmfn4hq3zra7tt43j",
"op": "ffmpeg",
"status": "succeeded",
"stage": null,
"created_at": "2026-11-07T02:01:01.630Z",
"finished_at": "2026-11-07T02:01:31.923Z",
"outputs": {
"compressed-5mb.mp4": "https://api.reelsdk.com/f/out/job_clapmfn4hq3zra7tt43j/compressed-5mb.mp4?s=..."
},
"result": null,
"duration_s": 30.018,
"error": null,
"usage": {
"output_seconds": 30.018,
"audio_seconds": 0,
"tts_characters": 0,
"images": 0
},
"poll_url": "https://api.reelsdk.com/v1/jobs/job_clapmfn4hq3zra7tt43j"
}
}From a size to a bitrate
To fit a 30-second clip into a 5 MB budget, you have about 1,330 kb/s in total. Take away 128 kb/s for -c:a aac at -b:a 128k and that leaves about 1,200 kb/s for the video stream, so you set -b:v 1200k in args on POST /v1/ffmpeg. Adding -maxrate 1200k with -bufsize 2400k stops peaks from pushing past that cap.
The source launch-master.mp4 is a 129 MB 1080p master. Encoding with libx264, -preset medium and -movflags +faststart returned compressed-5mb.mp4 at 4.6 MB, just under the budget, at the same resolution and frame rate.
At a glance
Ways to compress a video to a target size
| Option | Price | Limits | What you run |
|---|---|---|---|
| ffmpeg on your own machine | Free; LGPL 2.1 or later, or GPL 2 or later with GPL libraries such as libx264 | Your CPU, disk and bandwidth | ffmpeg builds, a job queue, storage |
| AWS Lambda with an ffmpeg layer | $0.0000166667 per GB-second plus $0.20 per 1M requests (x86, US East) | 900 s per run, 10,240 MB memory and /tmp, 250 MB of code and layers, 6 MB sync payload | The layer, S3 in and out, retries |
| FFmpeg Micro | 1 token per 10 s of input, 500 tokens for $5; this 30 s input: about 3 tokens, $0.03 | 100 MB input on the free plan, 1,024 MB on Starter and Pro | API calls |
| ReelSDK | $0.02 per compute minute; under 1 cent for this 30 s clip | 500 MB per file, 1 GB per job, 10 minutes of run time | One HTTP call |
Sources: FFmpeg license and legal, AWS Lambda quotas, AWS Lambda pricing, FFmpeg Micro pricing, checked November 2026.
One pass, not two
Two-pass encoding (-pass) is refused on the ffmpeg endpoint because each declared output in outputs is one file. A single pass with -maxrate lands under the target rather than right on it, so leave yourself a bit of headroom when you pick the numbers.
If you'd rather fix the quality and let the file size follow, drop the bitrate flags and use -crf 28. Here is how the two CRF runs came out against the same 30 s source:
compressed.mp4: H.264 (libx264) at-crf 28and-preset mediumcame back at 6.9 MB after about 49 seconds of compute, about 1.6 cents.compressed-hevc.mp4: H.265 with the same settings came back smaller, at 4.3 MB, but took about 63 seconds of compute, about 2 cents at $0.02 per compute minute.
curl "https://api.reelsdk.com/v1/ffmpeg?wait=120" \
-H "Authorization: Bearer $REELSDK_KEY" \
--json '{
"inputs": {
"launch-master.mp4": "https://api.reelsdk.com/f/lib/in/use-cases/launch-master.mp4"
},
"args": [
"-i", "launch-master.mp4", "-c:v", "libx264", "-crf", "28", "-preset",
"medium", "-c:a", "aac", "-b:a", "128k", "-movflags", "+faststart",
"compressed.mp4"
],
"outputs": ["compressed.mp4"]
}'Big files
For this run, ReelSDK fetched the 129 MB launch-master.mp4 straight from its URL in inputs. You can pass up to 50 inputs per job, up to 500 MB each and 1 GB per job. If you have a local file instead of a URL, one upload takes up to 100 MiB and is kept 7 days, while files over 100 MiB go up as a multipart upload.
On AWS Lambda, synchronous requests and responses are capped at a 6 MB payload, so files this size have to move through S3 first.
What it costs
What this job cost
- Compute: fetching the input, running ffmpeg and storing the file
- 28.1 s
- Rate
- $0.02 per compute minute
- Charged
- $0.0094
Billed per second with a 1 s minimum. Machine start-up is not billed, and failed jobs cost $0.
Limits
What one request takes
- Input files
- 500 MB each, 1 GB per job
- Job run time
- Up to 10 minutes
- Two-pass encoding
- Refused; use one pass with
-maxrate - Frame size
- Up to 8192 px per side and 37.7 megapixels
- Waiting for a result
- 60 s by default, up to 300 s
- Output retention
- 7 days
How it works
From request to file
Host the input
Any public http or https URL on the default port works, as long as it has no username or password in it; ReelSDK downloads it before ffmpeg starts. A local file goes up with
POST /v1/uploads?filename=clip.mp4first: up to 100 MiB per upload, kept 7 days, and larger files go up as a multipart upload.Send the arguments
-b:v 1200ksets the average video bitrate from the budget,-maxrate 1200k -bufsize 2400kcaps the peaks,-preset mediumtrades encode time for quality, and-c:a aac -b:a 128ksets the sound. The call waits up to 120 s with?wait=120.Download the result
Every file is listed under
job.outputs, and the links work for 7 days, so copy what you keep. For long jobs, send?wait=0with awebhook_urland fetchGET /v1/jobs/{id}when the webhook arrives.
FAQ
Questions, answered
Can I output H.264 and H.265 in the same job, or change the preset?
args is a JSON array handed straight to ffmpeg without a shell, so you can pass the -preset and codec flags you need, as long as they are on the allowlist. A single job accepts up to 20 files in outputs, so you can write both compressed-5mb.mp4 and compressed-hevc.mp4 in one call. Output files are kept for 7 days.
Why did the 5 MB target come out at 4.6 MB?
Because -pass is refused, the encoder runs a single pass constrained by -b:v 1200k, -maxrate 1200k, and -bufsize 2400k. Without a first pass log file to map the whole clip, -maxrate keeps bitrate spikes down and lands under the 5 MB mark, at 4.6 MB.
How does the cost compare to FFmpeg Micro and AWS Lambda?
ReelSDK pricing is $0.02 per compute minute, billed per second with a 1 s minimum, and failed jobs cost $0 (you get $0.50 of free credit at sign-up). This clip billed about 28 seconds of compute, under 1 cent, and the machine start-up wasn't billed. FFmpeg Micro charges 1 token per 10 seconds of input (3 tokens or $0.03 for a 30 s input at the 500 tokens for $5 top-up rate), and caps inputs at 100 MB on the free plan or 1,024 MB on Starter and Pro. AWS Lambda charges $0.0000166667 per GB-second (x86, US East) plus $0.20 per 1M requests.
- Compress a video with ffmpegShrink a video with ffmpeg: CRF 28 in x264 or x265, a smaller frame or a slower preset, with the size and quality each one gets you.
- Choose a CRF value in ffmpegWhat CRF does in libx264, the file size and VMAF score for CRF 18, 23, 28 and 33 on one clip, and how x265's scale differs.
- Video compressorShrink a video in your browser with a size and resolution you pick, free and without uploading it, or with one API call.
- Resize videoRender 9:16, 1:1, 4:5 and 16:9 copies of one video in a single ffmpeg call, about 2 cents for all 4 from a 30 s clip.
- Video conversionConvert WebM, MKV or MOV to MP4 and back in one ffmpeg call, about a third of a cent for a 30 s clip.
- Trim videoCut a clip out of a longer video by URL, frame-accurate or by stream copy, for under a fifth of a cent per 10-second cut.
- FFmpeg API reference: POST /v1/ffmpegPOST /v1/ffmpeg runs ffmpeg 8.1 with your own arguments: up to 50 inputs of 500 MB, 20 outputs and 600 s per command, with tested recipes for GIFs, thumbnails and subtitles.
Sources, checked November 2026
Ready to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
