Guide

Resize a video with an API

How do I change a video's resolution over an API?

Use the scale filter with a fixed height and -2 for the width: -vf scale=-2:720. The -2 keeps the aspect ratio and rounds the width to an even number, which H.264 requires.

The ffmpeg command

What you would run locally, for reference.

ffmpeg -i input.mp4 \
  -vf scale=-2:720 \
  -c:v libx264 -crf 23 -c:a copy \
  output.mp4

The API request

The same flags, sent as JSON. Authenticate with Authorization: Token <your-api-token>.

POST /api/ffmpeg/job/
{
  "global_options": [
    "-y"
  ],
  "inputs": [
    {
      "input_source": "https://example.com/input.mp4"
    }
  ],
  "outputs": [
    {
      "filename": "output.mp4",
      "options": [
        "-vf",
        "scale=-2:720",
        "-c:v",
        "libx264",
        "-crf",
        "23",
        "-c:a",
        "copy"
      ]
    }
  ]
}

Worth knowing

  • Use -2 and not -1: -1 can land on an odd width, which libx264 rejects outright.
  • -c:a copy passes the audio through untouched — faster, cheaper, and no generation loss, since resizing has nothing to do with the audio track.

What it costs

Jobs bill in processing seconds — the CPU time this one actually uses — with a floor of 25 seconds per GB pulled out of storage to run it, so a stream-copy still counts. Uploading the output and downloading it afterwards are free. See the plans.

Related guides

Start free API reference

Ask me for anything

QuickFFmpeg is early and plenty is still missing. Tell me what you need and it goes straight to the top of my list.

This arrives anonymously. Log in first if you'd like an answer.