feat: ffmpeg v7 (#1777)

* adding ffmpeg v7

* Renaming id ffmpeg to ffmpeg7

* added space

* fixing formatting issue

* fix unit test workflow for forks

* merge ffmpeg v7 into existing extension

* verify md5 checksum

* fix dns resolution

* fix v7 install

* remove redundant code

* add changeset

* mark fluent-ffmpeg as external

* add docs

* Revert "mark fluent-ffmpeg as external"

This reverts commit 74cd317ae69c7453a22d3fa412ff00b402840b87.

---------

Co-authored-by: nicktrn <55853254+nicktrn@users.noreply.github.com>
This commit is contained in:
Rudra Sankha Sinhamahapatra
2025-05-13 16:57:35 +05:30
committed by GitHub
parent 21c0dc619e
commit 39f03085b4
3 changed files with 55 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@trigger.dev/build": patch
---
Add ffmpeg v7 support to existing extension: `ffmpeg({ version: "7" })`
+6 -2
View File
@@ -19,7 +19,11 @@ export default defineConfig({
});
```
By default, this will install the version of `ffmpeg` that is available in the Debian package manager. If you need a specific version, you can pass in the version as an argument:
By default, this will install the version of `ffmpeg` that is available in the Debian package manager (via `apt`).
## FFmpeg 7.x (static build)
If you need FFmpeg 7.x, you can pass `{ version: "7" }` to the extension. This will install a static build of FFmpeg 7.x instead of using the Debian package:
```ts
import { defineConfig } from "@trigger.dev/sdk/v3";
@@ -29,7 +33,7 @@ export default defineConfig({
project: "<project ref>",
// Your other config settings...
build: {
extensions: [ffmpeg({ version: "6.0-4" })],
extensions: [ffmpeg({ version: "7" })],
},
});
```
+44 -2
View File
@@ -1,12 +1,23 @@
import { BuildExtension } from "@trigger.dev/core/v3/build";
export type FfmpegOptions = {
/**
* The version of ffmpeg to install. If not provided, the latest version from apt will be installed.
* If set to '7' or starts with '7.', a static build of ffmpeg 7.x from johnvansickle.com will be used instead of apt.
* @example
* ffmpeg() // Installs latest ffmpeg from apt
* ffmpeg({ version: '7' }) // Installs static build of ffmpeg 7.x
* ffmpeg({ version: '7.0.1' }) // Installs static build of ffmpeg 7.x
* ffmpeg({ version: '6' }) // Version ignored, installs latest ffmpeg from apt
* ffmpeg({ version: '8' }) // Version ignored, installs latest ffmpeg from apt
*/
version?: string;
};
/**
* Add ffmpeg to the build, and automatically set the FFMPEG_PATH and FFPROBE_PATH environment variables.
* @param options.version The version of ffmpeg to install. If not provided, the latest version will be installed.
* @param options.version The version of ffmpeg to install. If not provided, the latest version from apt will be installed.
* If set to '7' or starts with '7.', a static build of ffmpeg 7.x from johnvansickle.com will be used instead of apt.
*
* @returns The build extension.
*/
@@ -22,10 +33,41 @@ export function ffmpeg(options: FfmpegOptions = {}): BuildExtension {
options,
});
// Use static build for version 7 or 7.x
if (options.version === "7" || options.version?.startsWith("7.")) {
context.addLayer({
id: "ffmpeg",
image: {
instructions: [
// Install ffmpeg after checksum validation
"RUN apt-get update && apt-get install -y --no-install-recommends wget xz-utils nscd ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists/* && " +
"wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz.md5 && " +
"wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz && " +
"md5sum -c ffmpeg-git-amd64-static.tar.xz.md5 && " +
"tar xvf ffmpeg-git-amd64-static.tar.xz -C /usr/bin --strip-components=1 --no-anchored 'ffmpeg' 'ffprobe' && " +
"rm ffmpeg-git-amd64-static.tar.xz*",
],
},
deploy: {
env: {
FFMPEG_PATH: "/usr/bin/ffmpeg",
FFPROBE_PATH: "/usr/bin/ffprobe",
},
override: true,
},
});
return;
} else if (options.version) {
context.logger.warn("Custom ffmpeg version not supported, ignoring", {
version: options.version,
});
}
// Default: use apt
context.addLayer({
id: "ffmpeg",
image: {
pkgs: options.version ? [`ffmpeg=${options.version}`] : ["ffmpeg"],
pkgs: ["ffmpeg"],
},
deploy: {
env: {