Guide

Convert MP4 to WebM with an API

How do I convert an MP4 to WebM over an API?

POST the file to /api/ffmpeg/job/ with -c:v libvpx-vp9 and -c:a libopus, then poll the job until it reports success. WebM only accepts VP8/VP9 video and Vorbis/Opus audio, so the audio has to be re-encoded too — copying AAC into a .webm container fails.

The ffmpeg command

What you would run locally, for reference.

ffmpeg -i input.mp4 \
  -c:v libvpx-vp9 -crf 33 -b:v 0 \
  -c:a libopus -b:a 96k \
  output.webm

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.webm",
      "options": [
        "-c:v",
        "libvpx-vp9",
        "-crf",
        "33",
        "-b:v",
        "0",
        "-c:a",
        "libopus",
        "-b:a",
        "96k"
      ]
    }
  ]
}

Worth knowing

  • -b:v 0 is not optional with VP9: without it -crf is ignored and you get constrained-quality mode instead of constant quality.
  • VP9 is markedly slower than H.264. Since jobs bill CPU time, the same clip costs more as WebM than as MP4 — worth knowing before you convert a library.

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.