diff --git a/packages/build/src/extensions/core/ffmpeg.ts b/packages/build/src/extensions/core/ffmpeg.ts index 84a91d7061..953c2bf688 100644 --- a/packages/build/src/extensions/core/ffmpeg.ts +++ b/packages/build/src/extensions/core/ffmpeg.ts @@ -38,3 +38,40 @@ export function ffmpeg(options: FfmpegOptions = {}): BuildExtension { }, }; } + +/** + * Add ffmpeg 7.x to the build, and automatically set the FFMPEG_PATH and FFPROBE_PATH environment variables. + * This uses the static build from johnvansickle.com to install the latest 7.x version. + * + * @returns The build extension. + */ + +export function ffmpeg7(): BuildExtension { + return { + name: "ffmpeg7", + onBuildComplete(context) { + if (context.target === "dev") { + return; + } + + context.logger.debug("Adding ffmpeg 7"); + + context.addLayer({ + id: "ffmpeg7", + image: { + instructions:[ + "RUN apt-get update && apt-get install -y --no-install-recommends wget xz-utils && apt-get clean && rm -rf /var/lib/apt/lists/*", + "RUN wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz -O ffmpeg.tar.xz && tar xvf ffmpeg.tar.xz -C /usr/bin --strip-components=1 --no-anchored 'ffmpeg' 'ffprobe' && rm ffmpeg.tar.xz", + ], + }, + deploy: { + env: { + FFMPEG_PATH: "/usr/bin/ffmpeg", + FFPROBE_PATH: "/usr/bin/ffprobe", + }, + override: true, + } + }) + } + } +} \ No newline at end of file