FFmpeg API Cloud LogoFFmpeg API Cloud

compress video ffmpeg

Compress video with FFmpeg

If you need to compress video with FFmpeg, the usual goal is to reduce file size without making the output unusable. This page shows the practical FFmpeg command, a ready-to-use FFmpeg API request, and an online tool you can test in the browser.

FFmpeg CLI

How to compress a video in FFmpeg

A common FFmpeg compression command uses H.264 video, AAC audio, and a CRF value to reduce file size while keeping quality acceptable. If you want a practical starting point for compressing video with FFmpeg, this is the command most people begin with.

FFmpeg compression command

Click any part of the command to see what it does.

FFmpeg compression command

ffmpeg

This runs the FFmpeg binary itself. Everything that follows tells FFmpeg how to read the source file and how to encode the compressed output.

API

Use the same video compression workflow through the FFmpeg API

If you need FFmpeg video compression inside your product, app, or backend workflow, the FFmpeg API gives you a faster path than building and maintaining encoding infrastructure yourself. You can send a ready-to-use args-based compression request, keep integration simple, and ship production FFmpeg capability without the usual setup and ops overhead.

Request

curl -X POST https://ffmpeg-api.cloud/v1/jobs \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "ffmpegArgs": [
    "-y",
    "-i",
    "{{input}}",
    "-c:v",
    "libx264",
    "-preset",
    "medium",
    "-crf",
    "28",
    "-c:a",
    "aac",
    "-b:a",
    "128k",
    "{{output}}"
  ],
  "inputs": {
    "input": {
      "type": "url",
      "url": "https://example.com/input.mp4"
    }
  },
  "outputs": {
    "output": {
      "fileName": "compressed-output.mp4"
    }
  }
}'

Response

{
  "jobId": "job_01hxyz...",
  "status": "queued",
  "runtimeSeconds": 0,
  "creditsCharged": 0,
  "createdAt": "2026-04-14T10:30:00.000Z"
}

Online tool

Try this FFmpeg API video compression tool online

Upload a source video, choose a CRF value, and run the compression job directly in the browser. It is the quickest way to test file-size reduction before you wire the same request into your own app or backend.

Live playground

Compress video with FFmpeg

Reduce video file size with a simple CRF-based FFmpeg API request.

Upload a file to generate a temporary source URL

Source URLs are valid for 1 hour. Max file size: 2GB.

Generated FFmpeg API request

This request is initialized from the current template, and you can edit it before running.

Use public URLs for inputs directly in this request. If you upload files above, copy the generated source URL into the request. In ffmpegArgs, each {} placeholder should match a key in inputs or outputs. For example, {} should match inputs.input, {} should match inputs.video, and {} should match outputs.output.

Use cases

Common ways to use FFmpeg video compression

Compression is useful when you want smaller files for uploads, delivery, previews, or downstream processing without rebuilding the same encoding workflow from scratch.

Reduce upload sizes for apps and forms

Compress video before user uploads hit product limits, attachment caps, or slow network paths.

Optimize delivery for websites and previews

Generate smaller MP4 outputs for landing pages, support docs, demos, and in-product previews.

Lower storage and transfer costs

Use FFmpeg video compression when you want smaller files for CDN delivery, backups, or repeated processing workflows.

FAQ

FFmpeg compress video FAQ

Common questions about compressing video with FFmpeg, tuning CRF, and using the same workflow through the FFmpeg API.

Related templates

Other FFmpeg templates

Explore other FFmpeg templates for trimming, resize, thumbnails, and more.