Skip to content

🎥 Make videos programmatically with React

Merge branch 'main' into pr/168

Jonny Burger03a46d58c759
diff --cc packages/cli/src/render.tsx
index 7d1d47a1d9,e81558c980..638db90cb9
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@@ -160,42 -157,40 +173,43 @@@ export const render = async () =>
throw new Error(`Cannot find composition with ID ${compositionId}`);
}
- const {durationInFrames: frames} = config;
const outputDir = shouldOutputImageSequence
? absoluteOutputFile
- : await fs.promises.mkdtemp(path.join(os.tmpdir(), 'react-motion-render'));
+ : STITCH_FROM || (await prepareDistDir(RENDER_DIST));
+
+ if (!STITCH_FROM) {
+ const renderProgress = new cliProgress.Bar(
+ {
+ clearOnComplete: true,
+ etaBuffer: 50,
+ format: '[{bar}] {percentage}% | ETA: {eta}s | {value}/{total}',
+ },
+ cliProgress.Presets.shades_grey
+ );
- await renderFrames({
++ const rendered = await renderFrames({
+ config,
+ onFrameUpdate: (frame) => renderProgress.update(frame),
+ parallelism,
+ compositionId,
+ outputDir,
- onStart: () => {
++ onStart: ({frameCount}) => {
+ process.stdout.write(
+ `📼 (2/${steps}) Rendering frames (${getActualConcurrency(
+ parallelism
+ )}x concurrency)...\n`
+ );
- renderProgress.start(frames, 0);
++ renderProgress.start(frameCount, 0);
+ },
+ userProps,
+ webpackBundle: bundled,
+ imageFormat,
+ quality,
+ browser,
++ frameRange: frameRange ?? null,
+ });
+ renderProgress.stop();
+ }
+
- const renderProgress = new cliProgress.Bar(
- {
- clearOnComplete: true,
- etaBuffer: 50,
- format: '[{bar}] {percentage}% | ETA: {eta}s | {value}/{total}',
- },
- cliProgress.Presets.shades_grey
- );
- const rendered = await renderFrames({
- config,
- onFrameUpdate: (frame) => renderProgress.update(frame),
- parallelism,
- compositionId,
- outputDir,
- onStart: ({frameCount}) => {
- process.stdout.write(
- `📼 (2/${steps}) Rendering frames (${getActualConcurrency(
- parallelism
- )}x concurrency)...\n`
- );
- renderProgress.start(frameCount, 0);
- },
- userProps,
- webpackBundle: bundled,
- imageFormat,
- quality,
- browser,
- frameRange: frameRange ?? null,
- });
- renderProgress.stop();
if (process.env.DEBUG) {
Internals.perf.logPerf();
}