🎥 Make videos programmatically with React
don't require ffmpeg for lambda cli
Jonny Burger18f0381d9ebe
diff --git a/packages/cli/src/get-cli-options.ts b/packages/cli/src/get-cli-options.tsindex 1849b707c3..81e63f4498 100644--- a/packages/cli/src/get-cli-options.ts+++ b/packages/cli/src/get-cli-options.ts@@ -39,7 +39,10 @@ const getFinalCodec = async (options: {isLambda: boolean}) => {});if (codec === 'vp8' &&- !(await RenderInternals.ffmpegHasFeature('enable-libvpx'))+ !(await RenderInternals.ffmpegHasFeature({+ feature: 'enable-libvpx',+ isLambda: options.isLambda,+ }))) {Log.error("The Vp8 codec has been selected, but your FFMPEG binary wasn't compiled with the --enable-lipvpx flag."@@ -51,7 +54,10 @@ const getFinalCodec = async (options: {isLambda: boolean}) => {if (codec === 'h265' &&- !(await RenderInternals.ffmpegHasFeature('enable-gpl'))+ !(await RenderInternals.ffmpegHasFeature({+ feature: 'enable-gpl',+ isLambda: options.isLambda,+ }))) {Log.error("The H265 codec has been selected, but your FFMPEG binary wasn't compiled with the --enable-gpl flag."@@ -63,7 +69,10 @@ const getFinalCodec = async (options: {isLambda: boolean}) => {if (codec === 'h265' &&- !(await RenderInternals.ffmpegHasFeature('enable-libx265'))+ !(await RenderInternals.ffmpegHasFeature({+ feature: 'enable-libx265',+ isLambda: options.isLambda,+ }))) {Log.error("The H265 codec has been selected, but your FFMPEG binary wasn't compiled with the --enable-libx265 flag."@@ -93,13 +102,17 @@ const getAndValidateAbsoluteOutputFile = (return absoluteOutputFile;};-const getAndValidateShouldOutputImageSequence = async (- frameRange: FrameRange | null-) => {+const getAndValidateShouldOutputImageSequence = async ({+ frameRange,+ isLambda,+}: {+ frameRange: FrameRange | null;+ isLambda: boolean;+}) => {const shouldOutputImageSequence =Internals.getShouldOutputImageSequence(frameRange);- if (!shouldOutputImageSequence) {- // TODO: should not be required for lambda+ // When parsing options locally, we don't need FFMPEG because the render will happen on Lambda+ if (!shouldOutputImageSequence && !isLambda) {await RenderInternals.validateFfmpeg();}@@ -177,7 +190,10 @@ export const getCliOptions = async (options: {const shouldOutputImageSequence =options.type === 'still'? true- : await getAndValidateShouldOutputImageSequence(frameRange);+ : await getAndValidateShouldOutputImageSequence({+ frameRange,+ isLambda: options.isLambda,+ });const outputFile = options.isLambda? null: getOutputFilename({diff --git a/packages/docs/docs/lambda-changelog.md b/packages/docs/docs/lambda-changelog.mdindex 9625375e14..649c40ccea 100644--- a/packages/docs/docs/lambda-changelog.md+++ b/packages/docs/docs/lambda-changelog.md@@ -14,6 +14,12 @@ Keep track of changes to the APIs of Remotion Lambda here.1. Redeploy your function: `npx remotion lambda functions deploy`1. Migrate according to the changelog below:+## October 21st, 2021++- You can now import the functions `getRenderProgress()`, `renderVideoOnLambda()`, and `renderStillOnLambda()` via `@remotion/lambda/client` free of Node.JS dependencies. That means they should be importable in the browser and React Native and should be lightweight to bundle. This is not yet tested well, let us know your experiences!+- When rendering a video via the Lambda CLI, FFMPEG is no longer required.+- From `main` branch: Calling `getInputProps()` from `remotion` package on the server will no longer fail, but warn and return an empty object.+## October 20th, 2021Version hash: `3.0.0-lambda.2+a97302554`diff --git a/packages/renderer/src/ffmpeg-flags.ts b/packages/renderer/src/ffmpeg-flags.tsindex e8d516b989..0199d3f200 100644--- a/packages/renderer/src/ffmpeg-flags.ts+++ b/packages/renderer/src/ffmpeg-flags.ts@@ -15,15 +15,21 @@ export const getFfmpegBuildInfo = async () => {return buildConfig;};-export const ffmpegHasFeature = async (- feature: 'enable-gpl' | 'enable-libx265' | 'enable-libvpx'-) => {+export const ffmpegHasFeature = async (factors: {+ feature: 'enable-gpl' | 'enable-libx265' | 'enable-libvpx';+ isLambda: boolean;+}) => {+ // Lambda should have all features+ if (factors.isLambda) {+ return true;+ }+if (!binaryExists('ffmpeg')) {return false;}const config = await getFfmpegBuildInfo();- return config.includes(feature);+ return config.includes(factors.feature);};export const parseFfmpegVersion = (buildconf: string): FfmpegVersion => {