Azure Functions + ReelSDK $0.02 per compute minute, first $0.50 free
Call ffmpeg from an Azure Function inside its 230 s HTTP window
ReelSDK runs the encode for $0.02 per compute minute and answers inside the 230 s an HTTP-triggered function gets, whatever its timeout says. Wait 200 s and let a webhook take the rest: a 20-second landscape clip comes back as a 1080x1920 vertical with a blurred background in about 12 seconds.
- Node.js v4 programming model, one fetch per render
- A 200 s wait answers before the 230 s cut
- Slower renders finish at a signed webhook function
Timeout value of 00:05:00 exceeded by function 'Functions.Analyticshandler' (Id: '78a8fa14-0b05-440a-9a81-6c0ebda9237b'). Initiating cancellation.
The same job as one call to ReelSDK
import { app } from "@azure/functions";
app.http("vertical", {
methods: ["POST"],
handler: async () => {
const res = await fetch("https://api.reelsdk.com/v1/ffmpeg?wait=200", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.REELSDK_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
inputs: { "in.mp4": "https://api.reelsdk.com/f/lib/in/seo-int/nasa-vision.mp4" },
args: [
"-i", "in.mp4", "-filter_complex",
"[0:v]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,gblur=sigma=40[bg];[0:v]scale=1080:-2[fg];[bg][fg]overlay=(W-w)/2:(H-h)/2",
"-c:v", "libx264", "-preset", "veryfast", "-crf", "23", "-c:a", "aac", "-movflags", "+faststart", "vertical.mp4",
],
outputs: ["vertical.mp4"],
}),
});
const { job, error } = await res.json();
if (!res.ok) return { status: res.status, jsonBody: { error } };
return { status: res.status, jsonBody: { id: job.id, status: job.status, video: job.outputs["vertical.mp4"] ?? null } };
},
});
Why ffmpeg breaks here
230 s per response, whatever the timeout says
Regardless of the function app timeout setting, 230 s is the most an HTTP-triggered function can take to respond, because of the default idle timeout of Azure Load Balancer. Behind that, functionTimeout defaults to 5 min on the Consumption plan, 10 min at most, and to 30 min on Flex Consumption, Premium and Dedicated, with no upper bound. A run that passes its timeout ends with Timeout value of 00:05:00 exceeded by function and the language worker restarts.
Running ffmpeg in the function means a static build in the package or a custom container, and the encode shares the instance's memory: 512 MB, 2,048 MB or 4,096 MB on Flex Consumption, with 0.25, 1 or 2 cores. With ReelSDK the function sends one HTTPS request and holds it with ?wait=200, under the 230 s limit. A render that takes longer comes back as a 202 and finishes at your webhook, with up to 10 min per job. Raw ffmpeg costs $0.02 per compute minute, billed by the second.
Azure Functions next to ReelSDK
| Limit | Azure Functions | ReelSDK |
|---|---|---|
| HTTP response | 230 s, whatever the timeout setting | A 200 s wait answers inside it, a webhook delivers the rest |
| Function timeout | Consumption 5 min (10 max); Flex, Premium and Dedicated 30 min (unbounded) | Up to 10 min per job |
| Memory | 512, 2,048 or 4,096 MB per Flex Consumption instance | A separate machine for every job |
| ffmpeg | Ship a static build or a custom container | ffmpeg 8.1 on the render machine |
| Free usage | Flex: 250,000 executions and 100,000 GB-s a month | Failed jobs are free |
Azure Functions limits from Azure Functions hosting options and timeouts, checked November 2026.
Set it up
A render function and a webhook function
You need a ReelSDK key and its webhook secret. The render function waits up to 200 s for the result, and a second, anonymous function receives the renders that take longer. Both use the Node.js v4 programming model.
Add three app settings
Add
REELSDK_KEY,REELSDK_WEBHOOK_SECRETandPUBLIC_URLas application settings, and tolocal.settings.jsonfor local runs.PUBLIC_URLis the app's default domain from its Overview page, withhttps://in front.Application settings - REELSDK_KEY
- Your ReelSDK API key
- REELSDK_WEBHOOK_SECRET
- The key's webhook secret
- PUBLIC_URL
- https:// plus the app's default domain
Render inside the HTTP window
verticaltakes a video URL, posts it to/v1/ffmpeg?wait=200and passes awebhook_urlbuilt fromPUBLIC_URL. A render that finishes inside 200 s comes back as a 200 with the mp4 URL; a slower one returns a 202 with the job id before the 230 s cut.src/functions/vertical.tsTry it import { app, type HttpRequest, type InvocationContext } from "@azure/functions"; const ARGS = [ "-i", "in.mp4", "-filter_complex", "[0:v]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,gblur=sigma=40[bg];[0:v]scale=1080:-2[fg];[bg][fg]overlay=(W-w)/2:(H-h)/2", "-c:v", "libx264", "-preset", "veryfast", "-crf", "23", "-c:a", "aac", "-movflags", "+faststart", "vertical.mp4", ]; export async function vertical(request: HttpRequest, context: InvocationContext) { const { video_url } = (await request.json()) as { video_url: string }; // 200 s stays under the 230 s HTTP limit; a slower job answers 202 and the webhook delivers it const res = await fetch("https://api.reelsdk.com/v1/ffmpeg?wait=200", { method: "POST", headers: { Authorization: `Bearer ${process.env.REELSDK_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ inputs: { "in.mp4": video_url }, args: ARGS, outputs: ["vertical.mp4"], webhook_url: `${process.env.PUBLIC_URL}/api/reelsdk-webhook`, }), }); const { job, error } = await res.json(); if (!res.ok) return { status: res.status, jsonBody: { error } }; context.log("reelsdk job", job.id, job.status); return { status: res.status, jsonBody: { id: job.id, status: job.status, video: job.outputs["vertical.mp4"] ?? null } }; } app.http("vertical", { methods: ["POST"], authLevel: "function", handler: vertical });Catch slower renders on the webhook
reelsdk-webhookusesauthLevel: "anonymous", because the signature check is the authentication. It reads the raw body withrequest.text(), verifiesReelsdk-Signatureand answers 200; ReelSDK gives each delivery 15 s and retries up to 6 attempts over about 7 h. The render handler returns vertical.mp4 in about 12 seconds for a 20-second clip, and the webhook function accepts a signed delivery and refuses one signed with the wrong secret.src/functions/reelsdk-webhook.ts import { createHmac, timingSafeEqual } from "node:crypto"; import { app, type HttpRequest, type InvocationContext } from "@azure/functions"; export async function reelsdkWebhook(request: HttpRequest, context: InvocationContext) { const body = await request.text(); if (!verifyReelsdkSignature(request.headers.get("reelsdk-signature") ?? "", body, process.env.REELSDK_WEBHOOK_SECRET!)) { return { status: 401, body: "invalid signature" }; } const job = JSON.parse(body); // We save job.status and job.outputs["vertical.mp4"] for job.id here context.log("reelsdk job finished", job.id, job.status); return { status: 200, body: "ok" }; } app.http("reelsdk-webhook", { methods: ["POST"], authLevel: "anonymous", handler: reelsdkWebhook }); function verifyReelsdkSignature(header: string, body: string, secret: string) { const parts = Object.fromEntries(header.split(",").map((part) => part.split("=", 2))); const age = Math.abs(Date.now() / 1000 - Number(parts.t)); if (!/^[0-9a-f]{64}$/i.test(parts.v1 ?? "") || !(age <= 300)) return false; const expected = createHmac("sha256", secret).update(`${parts.t}.${body}`).digest(); return timingSafeEqual(expected, Buffer.from(parts.v1, "hex")); }
FAQ
Video on Azure Functions, answered
Why does my HTTP-triggered Azure Function stop answering at 230 seconds?
230 s is the most an HTTP-triggered function can take to respond, whatever functionTimeout says, because of the default idle timeout of Azure Load Balancer. Answer before it: ?wait=200 returns the result inside the window when the render is quick, and a 202 with the job id when it isn't.
Can I install ffmpeg on Azure Functions?
You can ship a static ffmpeg build in the deployment package or run a custom container, and the encode shares the instance's memory, 512 MB, 2,048 MB or 4,096 MB on Flex Consumption. With ReelSDK the function sends JSON over HTTPS and ffmpeg 8.1 runs on ReelSDK's machines.
Does this work on the Consumption plan?
Yes. Consumption stops runs after 5 minutes by default and 10 at most, and the function waits 200 s at most, or answers at once if you send Prefer: respond-async. Linux Consumption retires on 30 September 2028, and Microsoft moves those apps to Flex Consumption.
How do I verify the ReelSDK webhook in an Azure Function?
Read the raw body with request.text(), split t and v1 out of Reelsdk-Signature and compare v1 with the hex HMAC-SHA256 of t, a dot and the body, keyed with REELSDK_WEBHOOK_SECRET. Reject a t more than 300 s old. Retries carry the same Idempotency-Key, <job id>:<status>.
What does it cost?
Raw ffmpeg on ReelSDK is $0.02 per compute minute, billed by the second, and failed jobs are free; captions and slideshows are $0.03 per output minute. On Azure, Flex Consumption includes 250,000 executions and 100,000 GB-s a month per subscription, and the function runs for the wait, not for the encode.
The same fix on other platforms
All integrationsReady to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
