Skip to content

🎥 Make videos programmatically with React

Merge branch 'v4' into move-slowest-frames-to-return-type

Jonny Burgerf25aef0e7ec0
diff --cc packages/cli/src/render.tsx
index 3528c95fb4,20036a21cd..d1dfac1778
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@@ -342,13 -340,17 +340,16 @@@ export const render = async (remotionRo
},
puppeteerInstance,
onDownload,
- downloadMap,
+ internal: {
+ downloadMap,
+ onCtrlCExit: registerCleanupJob,
+ },
- onSlowestFrames: (slowestFrames) => {
- Log.verbose();
- Log.verbose(`Slowest frames:`);
- slowestFrames.forEach(({frame, time}) => {
- Log.verbose(`Frame ${frame} (${time.toFixed(3)}ms)`);
- });
- },
+ });
+
+ Log.verbose();
+ Log.verbose(`Slowest frames:`);
+ slowestFrames.forEach(({frame, time}) => {
+ Log.verbose(`Frame ${frame} (${time.toFixed(3)}ms)`);
});
Log.info();
diff --cc packages/docs/docs/4-0-migration.md
index 8210eba94d,ad111f4865..b4e91164ba
--- a/packages/docs/docs/4-0-migration.md
+++ b/packages/docs/docs/4-0-migration.md
@@@ -29,13 -29,28 +29,33 @@@ Upgrade `remotion` and all packages sta
Run `npm i `, `yarn` or `pnpm i` respectively afterwards.
+ ## Config file changes
+
+ ```diff
+ - import {Config} from 'remotion';
+ + import {Config} from '@remotion/cli/config';
+ ```
+
## Dropped support for Lambda `architecture`
- When deploying a Lambda, you were able to previously choose between `arm64` and `x86_64` architectures. From v4.0 on, only `arm64` is supported. It should be faster, cheaper and not have any different behaviors than `x86_64`.
+ When deploying a Lambda, you were previously able to choose between the `arm64` and `x86_64` architecture.
+ From v4.0 on, only `arm64` is supported. It should be faster, cheaper and not have any different behavior than `x86_64`.
+
+ **How to upgrade**: Remove the `architecture` option from `estimatePrice()` and `deployFunction()`.
+
+ ## Rich timeline removed
+
+ The option to use the "Rich timeline" has been removed due to performance problems.
+ The timeline is now always in simple mode, but supports more timeline layers at once.
+
+ ## ProRes videos now export uncompressed audio by default
+
+ Previously, the `aac` audio codec was the default for ProRes exports. The default is now `pcm_s16le` which stands for uncompressed 16-bit low-endian PCM audio.
+ This change was made since users export ProRes mainly for getting high-quality footage to be further used in video editing programs.
- **How to upgrade**: Remove the `architecture` option from `estimatePrice()`, `deployFunction()`.
+ ## No more FFmpeg install, `ffmpegExecutable` option removed
+
+## Moved `onSlowestFrames` API
+
+In V3, `onSlowestFrames` has been a callback function that you could pass to `renderMedia()`.
+In V4, this API has been moved to the [return type](/docs/renderer/render-media#return-value).
diff --cc packages/docs/docs/renderer/render-media.md
index 79ae9d20f7,1a455ea01d..ba4ab90d32
--- a/packages/docs/docs/renderer/render-media.md
+++ b/packages/docs/docs/renderer/render-media.md
@@@ -429,26 -415,21 +417,38 @@@ const onSlowestFrames: OnSlowestFrames
};
```
+ ### ~~`ffmpegExecutable`~~
+
+ _removed in v4.0, string, optional_
+
+ An absolute path overriding the `ffmpeg` executable to use.
+
+ ### ~~`ffprobeExecutable?`~~ <AvailableFrom v="3.0.17" />
+
+ _removed in v4.0, optional_
+
+ An absolute path overriding the `ffprobe` executable to use.
+
## Return Value
-_since v3.0.26_
+_**from v4.0.0:**_
+
+The return value is an object with the following properties:
+
+- `buffer`: If `outputLocation` is not specified or `null`, contains a buffer, otherwise `null`.
+- `slowestFrames`: An array of the 10 slowest frames in the shape of `{frame:<Frame number>, time:<Time to render frame ms>}`. You can use this information to optimise your render times.
+
+```ts twoslash
+import type { SlowFrame } from "@remotion/renderer";
+const slowestFrames: SlowFrame[] = [];
+// ---cut---
+console.log("The slowest 10 frames are:");
+for (const slowFrame of slowestFrames) {
+ console.log(`Frame ${slowFrame.frame} (${slowFrame.time}ms)`);
+}
+```
+
+_**from v3.0.26**:_
If `outputLocation` is not specified or `null`, the return value is a Promise that resolves a `Buffer`. If an output location is specified, the return value is a Promise that resolves no value.
diff --cc packages/renderer/src/render-media.ts
index d1637abdca,f05e3171e7..b0c2fdbac1
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@@ -182,11 -175,10 +178,9 @@@ export const renderMedia = (
ffmpegOverride,
audioBitrate,
videoBitrate,
- onSlowestFrames,
audioCodec,
...options
-}: RenderMediaOptions): Promise<Buffer | null> => {
+}: RenderMediaOptions): Promise<RenderMediaResult> => {
- const remotionRoot = findRemotionRoot();
- validateFfmpeg(ffmpegExecutable ?? null, remotionRoot, 'ffmpeg');
validateQuality(options.quality);
validateQualitySettings({crf, codec, videoBitrate});
validateBitrate(audioBitrate, 'audioBitrate');