Trigger.dev + ReelSDK $0.02 per compute minute, first $0.50 free
Run ffmpeg from Trigger.dev tasks without sizing up the machine
The default small-1x has 0.5 GB of RAM. Hand the encode to ReelSDK at $0.02 per compute minute with a wait token and one fetch, instead of a run that ends in TASK_PROCESS_OOM_KILLED. A large-1x machine costs about 2 cents a minute.
- No build extension and no external entry
- The task waits on a token while ReelSDK renders
- Job read back with the key before the links are trusted
TASK_PROCESS_OOM_KILLED. Your run was terminated due to exceeding the machine's memory limit. Try increasing the machine preset in your task options or replay using a larger machine.
Source: Trigger.dev machines
The same job as one call to ReelSDK
import { task, wait } from "@trigger.dev/sdk";
export const extractAudio = task({
id: "extract-audio",
run: async (payload: { videoUrl: string }) => {
// We create the token first, so even an instant finish has somewhere to land
const token = await wait.createToken({ timeout: "2h" });
const res = await fetch("https://api.reelsdk.com/v1/ffmpeg", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.REELSDK_KEY}`,
"Content-Type": "application/json",
Prefer: "respond-async",
},
body: JSON.stringify({
inputs: { "in.mp4": payload.videoUrl },
args: ["-i", "in.mp4", "-vn", "-af", "loudnorm=I=-16:TP=-1.5:LRA=11", "-c:a", "libmp3lame", "-b:a", "192k", "audio.mp3"],
outputs: ["audio.mp3"],
webhook_url: token.url,
}),
});
const { job, error } = await res.json();
if (!res.ok) throw new Error(`reelsdk ${res.status}: ${JSON.stringify(error)}`);
const delivery = await wait.forToken<{ id: string; status: string }>(token.id);
if (!delivery.ok) throw new Error(`reelsdk job ${job.id} did not report back within 2 hours`);
// The token URL takes any POST, so we read the job back with the key
const check = await fetch(`https://api.reelsdk.com/v1/jobs/${job.id}`, {
headers: { Authorization: `Bearer ${process.env.REELSDK_KEY}` },
});
const { job: done } = await check.json();
if (done.status !== "succeeded") throw new Error(`reelsdk job ${job.id} ${done.status}: ${JSON.stringify(done.error)}`);
return { audio: done.outputs["audio.mp3"] as string };
},
});
Why ffmpeg breaks here
The encode runs on whatever machine the task has
Add ffmpeg() from @trigger.dev/build/extensions/core to build.extensions and Trigger.dev installs the Debian ffmpeg package in the task image; ffmpeg({ version: "7" }) installs a static 7.x build and sets FFMPEG_PATH and FFPROBE_PATH, and fluent-ffmpeg has to go in external. The encode then runs on the task's machine. The default small-1x has 0.5 vCPU and 0.5 GB of RAM, and a run that goes past its memory ends with TASK_PROCESS_OOM_KILLED. Presets go up to large-2x with 8 vCPU and 16 GB, billed per second: $0.0000338 on small-1x, $0.00034 on large-1x.
With ReelSDK the task only makes HTTP calls. It creates a wait token first, so even a job that finishes at once has somewhere to report, passes token.url to ReelSDK as webhook_url, and waits on wait.forToken; Trigger.dev Cloud pauses a task that waits longer than a few seconds. ReelSDK POSTs the finished job to the token URL, the JSON body becomes the token's output, and the task reads the job back with the key before it trusts the links. The encode costs $0.02 per compute minute, billed by the second, and failed jobs are free.
A Trigger.dev task next to ReelSDK
| Limit | Trigger.dev task | ReelSDK |
|---|---|---|
| ffmpeg | ffmpeg() build extension: Debian package or a static 7.x | ffmpeg 8.1, nothing to install |
| Memory | 0.5 GB on small-1x by default, up to 16 GB on large-2x | Rendering runs off the task machine |
| Disk | 10 GB on every preset | Inputs up to 500 MB each, 1 GB per job |
| Run length | No maximum; the smallest maxDuration is 5 s | Jobs up to 10 min |
| Price | $0.0000338 a second on small-1x, $0.00034 on large-1x | $0.02 per compute minute, billed by the second |
Trigger.dev limits from Trigger.dev machines, checked November 2026.
Set it up
One key, one task
The task needs no build extension and no external entry, because it only makes fetch calls. We type-checked it against @trigger.dev/sdk v4 and ran the same ReelSDK request on the live API.
Add the key
In the project's environment variables in the Trigger.dev dashboard, set
REELSDK_KEYfor every environment the task runs in.Environment variables - REELSDK_KEY
- Your ReelSDK API key
Create the token, start the job, wait
The task in the fix block creates a token with a 2 h timeout, which covers the 60 min within which every ReelSDK job succeeds or fails, sends
POST /v1/ffmpegwithPrefer: respond-asyncandwebhook_url: token.url, and waits onwait.forToken. The clip comes back as a loudness-normalized mp3 in about 5 seconds.Trigger it
Trigger
extract-audiofrom your backend with avideoUrlin the payload. When the token times out,delivery.okis false and the task throws; the job stays readable withGET /v1/jobs/{id}for 7 days.
FAQ
Video on Trigger.dev, answered
Can Trigger.dev tasks run ffmpeg?
Yes. Add ffmpeg() from @trigger.dev/build/extensions/core to build.extensions in trigger.config.ts and it installs the Debian ffmpeg package; ffmpeg({ version: "7" }) installs a static 7.x build. The encode then runs on the task's own machine, 0.5 vCPU and 0.5 GB of RAM on the default small-1x.
Why does my ffmpeg task end with TASK_PROCESS_OOM_KILLED?
The run used more memory than its machine has, and Trigger.dev's message suggests a larger machine preset. Presets go from small-1x with 0.5 GB up to large-2x with 16 GB. Sending the encode to ReelSDK keeps it off the task's memory; the task itself only makes HTTP calls.
How does ReelSDK complete a Trigger.dev wait token?
The task passes token.url as webhook_url. When the job finishes, ReelSDK POSTs the job JSON to that URL, Trigger.dev completes the token with the body as its output, and wait.forToken returns. ReelSDK makes up to 6 attempts over about 7 hours, 15 s each.
Why read the job back after the token completes?
A POST to token.url completes the token with whatever JSON it carries. The task fetches GET /v1/jobs/{id} with REELSDK_KEY and only returns links from a job that succeeded.
Is ReelSDK cheaper than a bigger Trigger.dev machine?
At list prices, small-1x costs about $0.002 a minute and large-1x with 4 vCPU and 8 GB about 2 cents a minute, against $0.02 per compute minute on ReelSDK. ReelSDK doesn't bill failed jobs and adds captions, transcription and voiceover in the same API.
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.
