Run FFmpeg from Cloudflare Workers

A Worker can't start the FFmpeg binary. It sends the command to Rendobar instead, which reads the video from your R2 bucket and writes the output back.

Guide
FFmpeg API
Updated
November 2026
src/index.ts (Cloudflare Worker)
import { createClient } from "@rendobar/sdk";
export default {
async fetch(req: Request, env: Env) {
const { key }: { key: string } = await req.json();
const rb = createClient({ apiKey: env.RENDOBAR_API_KEY });
// Read the upload from your R2 bucket, write the WebM back.
const job = await rb.jobs.create({
type: "ffmpeg",
inputs: { source: `storage://assets/${key}` },
params: {
command: "ffmpeg -i source -c:v libvpx-vp9 -crf 30 -b:v 0 out.webm",
},
destinations: ["storage://assets/encoded"],
});
// Returns in milliseconds. The file arrives in R2 on its own.
return Response.json({ jobId: job.id }, { status: 202 });
},
};

Versus

Worker vs Rendobar

TopicWorkerRendobar FFmpeg
CPU1 thread Workers can't start threads64 cores
Memory128 MB The input, the output and the code share it336 GB
Longest run5 min of CPU 10 ms on Free, 30 s by default on Paid9 hours On Pro and Studio. 1 hour on Free.
DiskIn memory Files count against the same 128 MB512 GB Per job

Cloudflare figures from the Workers limits and WebAssembly pages, checked 15 November 2026.

Workers have no GPU. An NVENC command runs on one of these, on Pro and Studio.

  • NVIDIA L4

    Memory
    24 GB
    NVENC engines
    2
  • NVIDIA L40S

    Memory
    48 GB
    NVENC engines
    3
  • NVIDIA RTX PRO 6000

    Memory
    96 GB
    NVENC engines
    4

How

How it works

  1. Connect your R2 bucket, once

    Create an R2 token with read and write on one bucket and add it to Rendobar. Its ID is what storage:// points at.

    Storage connection in Rendobar
    ID
    assets
    Provider
    Cloudflare R2
    Bucket
    assets
    Endpoint
    https://<account-id>.r2.cloudflarestorage.com
  2. The Worker sends the job

    That's the code at the top of this page. One request comes back in milliseconds, so the Worker spends almost no CPU and never holds the video. The command runs as written, on up to 64 cores or an NVENC GPU, for up to 9 hours.

    What rb.jobs.create returns
    id
    job_8f2c41d07a6e4b19
    type
    ffmpeg
    status
    waiting
  3. Hear when the file is in R2

    When every destination has the output, your Worker gets a signed job.deliveries_settled webhook. Verify it, then mark the video ready.

    src/webhook.ts (same Worker, POST /webhook)
    import { verifyWebhook } from "@rendobar/sdk/webhooks";
    export async function onWebhook(req: Request, env: Env) {
    const raw = await req.text();
    if (!(await verifyWebhook(raw, req.headers, env.RENDOBAR_WEBHOOK_SECRET))) {
    return new Response("Bad signature", { status: 401 });
    }
    const { event, data } = JSON.parse(raw);
    if (event === "job.deliveries_settled") {
    // Every destination has the file. Mark the video ready.
    await env.DB.prepare("UPDATE videos SET ready = 1 WHERE job_id = ?")
    .bind(data.jobId)
    .run();
    }
    return new Response("ok");
    }

FAQ

Frequently asked questions

Can Cloudflare Workers run FFmpeg?

No. A Worker runs JavaScript and WebAssembly in a V8 isolate, so it can't start the native ffmpeg binary, and it gets 128 MB of memory and at most 5 minutes of CPU. Send the command to Rendobar's FFmpeg API from the Worker instead: one request, and native FFmpeg runs the job.

Does ffmpeg.wasm work in a Worker now that the limit is 64 MiB?

It fits, but it can't do a real transcode. The @ffmpeg/core 0.12.10 WebAssembly file is 30.74 MiB (read from the npm registry on 15 November 2026), under the 64 MiB limit Cloudflare set on 4 September 2026. Workers can't start threads, so it encodes on one core, and the input, the output and the WebAssembly heap all share 128 MB. The full write-up has the bundle math.

Does sending the job fit the Worker CPU limit?

Yes. The Worker makes one HTTPS request and returns, and time spent waiting on the network doesn't count as CPU. Even the 10 ms budget on the Free plan covers it.

How do I run FFmpeg on a video stored in R2?

Connect the bucket to Rendobar once with an R2 token scoped to it. Then name the object as a storage:// input and a folder as the destination. The job reads from R2 and writes the output back, and the video never passes through the Worker.

Can I encode with a GPU from a Worker?

Yes. The Worker sends the same request with an NVENC encoder in the command, such as h264_nvenc, and the job runs on an NVIDIA L4, L40S or RTX PRO 6000. GPU encoding is on Pro and Studio, see pricing.

How long can a job run?

Up to 9 hours on Pro and Studio and 1 hour on Free. The Worker returns as soon as the job is created, so its own limits never apply to the encode.

What does it cost?

Jobs are billed per second of compute. A VP9 transcode we measured used 2.2 cores for 6.1 seconds and cost $0.0071. Every account starts with $5 of free credit and no card, and Rendobar bills nothing while you're not running jobs. Plans are on the pricing page.

Your command. Our infrastructure.

Bring your own commands. Run them on scalable CPU and GPU infrastructure, and pay only for compute time.