Prerequisites
- A project with Trigger.dev initialized
- FFmpeg installed on your machine for local development
Build configuration
Add the FFmpeg build extension to yourtrigger.config.ts. This ensures FFmpeg is available in
the deployed container:
trigger.config.ts
Build extensions customize the build process and the container
image used when deploying tasks. You’ll also need
@trigger.dev/build in your devDependencies.fluent-ffmpeg, add it to external in your config to
prevent it from being bundled:
trigger.config.ts
Example 1: Compress a video
This task fetches a video from a URL, compresses it using H.264 with reduced resolution and bitrate, then uploads the result to Cloudflare R2.trigger/ffmpeg-compress-video.ts
Example 2: Extract audio from a video
This task extracts the audio track from a video, converts it to PCM WAV format, and uploads it to R2.trigger/ffmpeg-extract-audio.ts
Example 3: Generate a thumbnail
This task captures a single frame from the 5-second mark of a video and uploads the JPEG thumbnail to R2.trigger/ffmpeg-generate-thumbnail.ts
Local development
When running locally withtrigger.dev dev, build extensions are not applied. You need FFmpeg
installed directly on your machine:
- macOS
- Ubuntu/Debian
- Windows