Skip to content

🎥 Make videos programmatically with React

Merge branch 'main' into ffmpeg-gif-2

Jonny Burgerf9ba54e7ec50
diff --cc packages/cli/src/parse-command-line.ts
index c5452dac45,da3cd8e525..42d251f62e
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@@ -93,10 -92,12 +94,16 @@@ export const parseCommandLine =
);
}
+ if (parsedCli.loop) {
+ Config.Rendering.setLoop(parsedCli.loop);
+ }
+
+ if (parsedCli['ffprobe-executable']) {
+ Config.Rendering.setFfprobeExecutable(
+ resolve(parsedCli['ffprobe-executable'])
+ );
+ }
+
if (typeof parsedCli['bundle-cache'] !== 'undefined') {
Config.Bundling.setCachingEnabled(parsedCli['bundle-cache'] !== 'false');
}
diff --cc packages/cli/src/render.tsx
index 31450abd6a,f506cdc223..5fd36605a4
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@@ -229,8 -227,6 +230,7 @@@ export const render = async ({renderAsG
Internals.Logging.getLogLevel(),
'verbose'
),
+ skipNFrames,
- loop,
envVariables,
frameRange,
parallelism,
@@@ -252,88 -249,45 +253,89 @@@
return;
}
- await renderMedia({
- outputLocation: absoluteOutputFile,
- codec,
- composition: config,
- crf,
- envVariables,
- ffmpegExecutable,
- ffprobeExecutable,
- frameRange,
- imageFormat,
- inputProps,
- onProgress: (update) => {
- encodedDoneIn = update.encodedDoneIn;
- encodedFrames = update.encodedFrames;
- renderedDoneIn = update.renderedDoneIn;
- stitchStage = update.stitchStage;
- renderedFrames = update.renderedFrames;
- updateRenderProgress();
- },
- puppeteerInstance,
- overwrite,
- parallelism,
- pixelFormat,
- proResProfile,
- quality,
- serveUrl: urlOrBundle,
- onDownload,
- dumpBrowserLogs: Internals.Logging.isEqualOrBelowLogLevel(
- Internals.Logging.getLogLevel(),
- 'verbose'
- ),
- onStart: ({frameCount}) => {
- totalFrames = frameCount;
- },
- chromiumOptions,
- timeoutInMilliseconds: Internals.getCurrentPuppeteerTimeout(),
- scale,
- port,
- });
+ if (renderAsGif || codec === 'gif') {
+ await renderGif({
+ outputLocation: absoluteOutputFile,
+ codec,
+ composition: config,
+ crf,
+ envVariables,
+ ffmpegExecutable,
+ frameRange,
+ imageFormat,
+ skipNFrames,
+ loop,
+ inputProps,
+ onProgress: (update) => {
+ encodedDoneIn = update.encodedDoneIn;
+ encodedFrames = update.encodedFrames;
+ renderedDoneIn = update.renderedDoneIn;
+ stitchStage = update.stitchStage;
+ renderedFrames = update.renderedFrames;
+ updateRenderProgress();
+ },
+ puppeteerInstance,
+ overwrite,
+ parallelism,
+ pixelFormat,
+ proResProfile,
+ quality,
+ serveUrl: urlOrBundle,
+ dumpBrowserLogs: Internals.Logging.isEqualOrBelowLogLevel(
+ Internals.Logging.getLogLevel(),
+ 'verbose'
+ ),
+ onStart: ({frameCount}) => {
+ totalFrames = frameCount;
+ },
+ chromiumOptions,
+ timeoutInMilliseconds: Internals.getCurrentPuppeteerTimeout(),
+ scale,
+ port,
+ });
+ } else {
+ await renderMedia({
+ outputLocation: absoluteOutputFile,
+ codec,
+ composition: config,
+ crf,
+ envVariables,
+ ffmpegExecutable,
++ ffprobeExecutable,
+ frameRange,
+ imageFormat,
- skipNFrames,
- loop,
+ inputProps,
+ onProgress: (update) => {
+ encodedDoneIn = update.encodedDoneIn;
+ encodedFrames = update.encodedFrames;
+ renderedDoneIn = update.renderedDoneIn;
+ stitchStage = update.stitchStage;
+ renderedFrames = update.renderedFrames;
+ updateRenderProgress();
+ },
+ puppeteerInstance,
+ overwrite,
+ parallelism,
+ pixelFormat,
+ proResProfile,
+ quality,
+ serveUrl: urlOrBundle,
+ onDownload,
+ dumpBrowserLogs: Internals.Logging.isEqualOrBelowLogLevel(
+ Internals.Logging.getLogLevel(),
+ 'verbose'
+ ),
+ onStart: ({frameCount}) => {
+ totalFrames = frameCount;
+ },
+ chromiumOptions,
+ timeoutInMilliseconds: Internals.getCurrentPuppeteerTimeout(),
+ scale,
+ port,
++ loop,
++ skipNFrames,
+ });
+ }
Log.info();
Log.info();
@@@ -357,5 -311,14 +359,14 @@@
Log.warn('Do you have minimum required Node.js version?');
}
- Log.info(chalk.green('\nYour video is ready!'));
+ Log.info(chalk.green(`\nYour ${renderAsGif ? 'gif' : 'video'} is ready!`));
+
+ if (
+ Internals.Logging.isEqualOrBelowLogLevel(
+ Internals.Logging.getLogLevel(),
+ 'verbose'
+ )
+ ) {
+ Internals.perf.logPerf();
+ }
};