🎥 Make videos programmatically with React
passing remotionRoot and executableFfmpeg to combineVideos
Patric Salvisberg04a14901ab66
diff --git a/packages/lambda/src/functions/helpers/concat-videos.ts b/packages/lambda/src/functions/helpers/concat-videos.tsindex 9de491f579..bd30889b1a 100644--- a/packages/lambda/src/functions/helpers/concat-videos.ts+++ b/packages/lambda/src/functions/helpers/concat-videos.ts@@ -1,4 +1,4 @@-import type {Codec} from '@remotion/renderer';+import type {Codec, FfmpegExecutable} from '@remotion/renderer';import {combineVideos, RenderInternals} from '@remotion/renderer';import fs, {createWriteStream,@@ -165,6 +165,8 @@ export const concatVideosS3 = async ({expectedBucketOwner,fps,numberOfGifLoops,+ ffmpegExecutable,+ remotionRoot,}: {bucket: string;expectedFiles: number;@@ -176,6 +178,8 @@ export const concatVideosS3 = async ({expectedBucketOwner: string;fps: number;numberOfGifLoops: number | null;+ ffmpegExecutable: FfmpegExecutable;+ remotionRoot: string;}) => {const outdir = join(RenderInternals.tmpDir(CONCAT_FOLDER_TOKEN), 'bucket');if (existsSync(outdir)) {@@ -213,6 +217,8 @@ export const concatVideosS3 = async ({codec: codecForCombining,fps,numberOfGifLoops,+ ffmpegExecutable,+ remotionRoot,});combine.end();diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.tsindex 1174f434bf..1d3d7e935d 100644--- a/packages/lambda/src/functions/launch.ts+++ b/packages/lambda/src/functions/launch.ts@@ -416,6 +416,8 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {expectedBucketOwner: options.expectedBucketOwner,fps,numberOfGifLoops: params.numberOfGifLoops,+ ffmpegExecutable: null,+ remotionRoot: process.cwd(),});if (!encodingStop) {encodingStop = Date.now();diff --git a/packages/renderer/src/combine-videos.ts b/packages/renderer/src/combine-videos.tsindex de6302d7de..2c4d81f8aa 100644--- a/packages/renderer/src/combine-videos.ts+++ b/packages/renderer/src/combine-videos.ts@@ -4,21 +4,14 @@ import execa from 'execa';import {rmdirSync, rmSync, writeFileSync} from 'fs';import {join} from 'path';import type {Codec} from './codec';+import type {FfmpegExecutable} from './ffmpeg-executable';+import {getExecutableFfmpeg} from './ffmpeg-flags';import {getAudioCodecName} from './get-audio-codec-name';import {isAudioCodec} from './is-audio-codec';import {parseFfmpegProgress} from './parse-ffmpeg-progress';import {truthy} from './truthy';-export const combineVideos = async ({- files,- filelistDir,- output,- onProgress,- numberOfFrames,- codec,- fps,- numberOfGifLoops,-}: {+type Options = {files: string[];filelistDir: string;output: string;@@ -27,7 +20,23 @@ export const combineVideos = async ({codec: Codec;fps: number;numberOfGifLoops: number | null;-}) => {+ remotionRoot: string;+ ffmpegExecutable: FfmpegExecutable;+};++export const combineVideos = async (options: Options) => {+ const {+ files,+ filelistDir,+ output,+ onProgress,+ numberOfFrames,+ codec,+ fps,+ numberOfGifLoops,+ ffmpegExecutable,+ remotionRoot,+ } = options;const fileList = files.map((p) => `file '${p}'`).join('\n');const fileListTxt = join(filelistDir, 'files.txt');@@ -35,7 +44,7 @@ export const combineVideos = async ({try {const task = execa(- 'ffmpeg',+ await getExecutableFfmpeg(ffmpegExecutable, remotionRoot),[isAudioCodec(codec) ? null : '-r',isAudioCodec(codec) ? null : String(fps),