ffmpeg on AWS Lambda without owning the Lambda
Lambda can run ffmpeg — but you inherit the packaging, the cold starts, and the ops. Fotovid takes all three off your plate: send a request, get a hosted file, skip the layer builds.
// handler.mjs — Node 18+ runtime (global fetch)
export const handler = async (event) => {
const { videoUrl, logoUrl } = JSON.parse(event.body);
const res = await fetch("https://api.fotovid.co/v1/video/watermark", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FOTOVID_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
source_url: videoUrl,
params: { type: "image", watermark_image_url: logoUrl, position: "bottom-right" },
}),
});
const { url } = await res.json();
return { statusCode: 200, body: JSON.stringify({ url }) };
};You just wanted to watermark an upload
Yes, Lambda can run ffmpeg. You build a layer under the 250MB unzipped limit, wire /tmp for scratch (up to 10GB), and stay inside the 15-minute cap. Then the real work starts: pinning a static ffmpeg build, tuning memory so a 1080p encode doesn't time out, eating cold starts on the first request, and owning all of it forever. That's a lot of infrastructure to stand up just to stamp a logo on a video.
- Package and version a static ffmpeg binary as a layer, under the 250MB unzipped limit
- Tune memory and timeout per operation so encodes don't fail at the 15-minute wall
- Absorb cold-start latency on the exact request a user is waiting on
- Maintain, patch, and monitor an ffmpeg Lambda you never wanted to own
Ways teams try to run ffmpeg on AWS Lambda
Before Fotovid these were the options — each one is work you'd rather not own.
| Option | What it costs you | Verdict |
|---|---|---|
| Bundle ffmpeg into your AWS Lambda function | Fits only via a layer you package, cold-start, and tune yourself | |
| Self-host a container or VM | Always-on cost plus patching, scaling, and monitoring | |
| Run a job queue + worker | New infra: a queue, workers, retries, dead-letter handling | |
| Transcode in the browser (WASM) | Slow, memory-hungry, and crashes on mobile | |
| Call the Fotovid API | One HTTPS request; nothing to run, package, or scale |
Your first call in three steps
- 1Grab a free API key
Create a Fotovid key to get a token in the form p6_<key_id>:<secret>. Send it as an Authorization: Bearer header on every request. No AWS role, no layer, no build pipeline — usage runs on credits ($1 = 100 credits, most operations cost 1 credit).
- 2POST your video to /v1/video/watermark
Call POST https://api.fotovid.co/v1/video/watermark with the standard envelope: a source_url pointing at your input over HTTPS, plus a params object. For a watermark, set type (image, text, or combo), the watermark_image_url or text, a position like bottom-right, and optional opacity, scale, and padding. Fotovid pulls the source, runs ffmpeg, and returns synchronously — no queue to poll, no Lambda to keep warm.
- 3Use the hosted result URL
The response is flat JSON: an id, type, and a url pointing at the finished, Fotovid-hosted file (plus expires_at and, for video, duration). Hand that URL straight to your frontend or download it to store your own copy. Same flow works for /v1/video/trim, /v1/video/extract-audio, /v1/video/extract-cover, /v1/video/probe, and the image and audio endpoints.
Frequently asked questions
Ship it with one API call
Grab a free key and make your first call in under five minutes.
