Run FFmpeg from Vercel and Next.js

A Vercel function tops out at 2 vCPU, 800 seconds and a 4.5 MB request, with no GPU. Your route sends the FFmpeg command to Rendobar instead, and the video goes by URL, never through the function.

Guide
FFmpeg API
Updated
November 2026
app/api/transcode/route.ts (Next.js on Vercel)
import { createClient } from "@rendobar/sdk";
const rb = createClient({ apiKey: process.env.RENDOBAR_API_KEY! });
export async function POST(req: Request) {
const { videoUrl }: { videoUrl: string } = await req.json();
// The video goes to Rendobar by URL, never through this function.
const job = await rb.jobs.create({
type: "ffmpeg",
params: {
command: `ffmpeg -i ${videoUrl} -c:v libx264 -crf 23 -c:a aac out.mp4`,
},
});
// Returns in milliseconds. The finished job arrives on your webhook.
return Response.json({ jobId: job.id }, { status: 202 });
}

Versus

Vercel function vs Rendobar

TopicVercel functionRendobar FFmpeg
CPU2 vCPU 1 vCPU on Hobby64 cores
Memory4 GB 2 GB on Hobby336 GB
Longest run800 s 300 s on Hobby9 hours On Pro and Studio. 1 hour on Free.
Disk500 MB of /tmp512 GB Per job
Video in4.5 MB request body 413 FUNCTION_PAYLOAD_TOO_LARGE past itA URL Inputs up to 10 GB on Pro and Studio

Vercel figures from the function limits and runtimes pages, checked 15 November 2026.

Vercel functions 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. Add two environment variables

    Put your Rendobar API key and webhook secret in the project's environment variables, then register the webhook at /api/rendobar-webhook.

    Vercel project, environment variables
    RENDOBAR_API_KEY
    rb_••••••••
    RENDOBAR_WEBHOOK_SECRET
    ••••••••
  2. The route sends the job

    That's the code at the top of this page. It passes the video's URL, so nothing hits the 4.5 MB body limit, and it returns long before the 300 s timeout. Any command from the recipes works the same way.

    What rb.jobs.create returns
    id
    job_8f2c41d07a6e4b19
    type
    ffmpeg
    status
    waiting
  3. Hear when it's done

    When the job finishes, the webhook route gets a signed job.completed event with the output's URL.

    app/api/rendobar-webhook/route.ts
    import { verifyWebhook } from "@rendobar/sdk/webhooks";
    export async function POST(req: Request) {
    const raw = await req.text();
    if (!(await verifyWebhook(raw, req.headers, process.env.RENDOBAR_WEBHOOK_SECRET!))) {
    return new Response("Bad signature", { status: 401 });
    }
    const { event, data } = JSON.parse(raw);
    if (event === "job.completed") {
    // data.output.file.url is the finished MP4. Save it with your own code.
    await saveVideo(data.jobId, data.output.file.url);
    }
    return new Response("ok");
    }

FAQ

Frequently asked questions

Can I run FFmpeg in a Vercel function?

Only inside a function's limits: up to 2 vCPU, 4 GB of memory, 800 seconds and a 4.5 MB request body, with no GPU. A long, large or GPU encode stops there. Send the command to Rendobar's FFmpeg API from the function instead: the video goes by URL and the job runs for up to 9 hours.

Why does my upload fail with 413 FUNCTION_PAYLOAD_TOO_LARGE?

Vercel caps a function's request body at 4.5 MB, and most videos are larger. Upload the file to storage straight from the browser and send Rendobar its URL. A job takes inputs of up to 10 GB on Pro and Studio.

Why does FFmpeg stop with FUNCTION_INVOCATION_TIMEOUT?

The function reached its maximum duration: 300 seconds on Hobby and up to 800 on Pro. A Rendobar job isn't bound by it, because the route returns as soon as the job is created and the encode runs for up to 9 hours.

Does the FFmpeg binary fit in a Vercel function?

It has to share the 250 MB bundle limit with your code and dependencies, and every cold start loads it. Sending the command to Rendobar keeps the function small: the route only imports the SDK.

Can I encode with a GPU from Vercel?

Vercel functions have no GPU. Put an NVENC encoder such as h264_nvenc in the command and the job runs on an NVIDIA L4, L40S or RTX PRO 6000, on Pro and Studio.

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.