Skip to content

🎥 Make videos programmatically with React

lambda refinements

Jonny Burger17e31a198910
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index c635e76bbc..83ab70ee6d 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -8,13 +8,12 @@ import chalk from 'chalk';
import {mkdirSync} from 'fs';
import path from 'path';
import {Config, Internals} from 'remotion';
-import {CliInternals} from '.';
import {getCliOptions} from './get-cli-options';
import {getCompositionId} from './get-composition-id';
import {handleCommonError} from './handle-common-errors';
import {initializeRenderCli} from './initialize-render-cli';
import {Log} from './log';
-import {parsedCli} from './parse-command-line';
+import {parsedCli, quietFlagProvided} from './parse-command-line';
import {
createOverwriteableCliOutput,
makeRenderingProgress,
@@ -118,9 +117,7 @@ export const still = async () => {
throw new Error(`Cannot find composition with ID ${compositionId}`);
}
- const renderProgress = createOverwriteableCliOutput(
- CliInternals.quietFlagProvided()
- );
+ const renderProgress = createOverwriteableCliOutput(quietFlagProvided());
const renderStart = Date.now();
try {
diff --git a/packages/core/src/config/codec.ts b/packages/core/src/config/codec.ts
index 8548b02b2b..cf6b572496 100644
--- a/packages/core/src/config/codec.ts
+++ b/packages/core/src/config/codec.ts
@@ -24,7 +24,6 @@ export const getOutputCodecOrUndefined = (): CodecOrUndefined => {
export const DEFAULT_CODEC: Codec = 'h264';
const DEFAULT_LAMBDA_CODEC: Codec = 'h264-mkv';
-// eslint-disable-next-line complexity
export const getFinalOutputCodec = ({
codec: inputCodec,
fileExtension,
diff --git a/packages/core/src/test/log.test.ts b/packages/core/src/test/log.test.ts
index bfeae7b4b4..117509d1e6 100644
--- a/packages/core/src/test/log.test.ts
+++ b/packages/core/src/test/log.test.ts
@@ -1,4 +1,3 @@
-import {Internals} from '..';
import {
getLogLevel,
isEqualOrBelowLogLevel,
@@ -48,9 +47,7 @@ describe('loglevel comparison', () => {
['error', 'error'],
])('%s is equal or below %s', (level1, level2) => {
setLogLevel(level1);
- expect(
- isEqualOrBelowLogLevel(Internals.Logging.getLogLevel(), level2)
- ).toEqual(true);
+ expect(isEqualOrBelowLogLevel(getLogLevel(), level2)).toEqual(true);
});
test.each<[LogLevel, LogLevel]>([
@@ -62,8 +59,6 @@ describe('loglevel comparison', () => {
['error', 'warn'],
])('%s is not equal or below %s', (level1, level2) => {
setLogLevel(level1);
- expect(
- isEqualOrBelowLogLevel(Internals.Logging.getLogLevel(), level2)
- ).toEqual(false);
+ expect(isEqualOrBelowLogLevel(getLogLevel(), level2)).toEqual(false);
});
});
diff --git a/packages/core/src/use-unsafe-video-config.ts b/packages/core/src/use-unsafe-video-config.ts
index a9477e2991..0daae05c99 100644
--- a/packages/core/src/use-unsafe-video-config.ts
+++ b/packages/core/src/use-unsafe-video-config.ts
@@ -13,7 +13,7 @@ export const useUnsafeVideoConfig = (): VideoConfig | null => {
return null;
}
- const {id, durationInFrames, fps, height, width} = video;
+ const {id, durationInFrames, fps, height, width, defaultProps} = video;
return {
id,
@@ -21,6 +21,7 @@ export const useUnsafeVideoConfig = (): VideoConfig | null => {
height,
fps,
durationInFrames: ctxDuration ?? durationInFrames,
+ defaultProps,
};
}, [ctxDuration, video]);
};
diff --git a/packages/core/src/video-config.ts b/packages/core/src/video-config.ts
index 0bf69b8286..878c829924 100644
--- a/packages/core/src/video-config.ts
+++ b/packages/core/src/video-config.ts
@@ -4,4 +4,5 @@ export type VideoConfig = {
fps: number;
durationInFrames: number;
id: string;
+ defaultProps: unknown;
};
diff --git a/packages/docs/docs/3-0-migration.md b/packages/docs/docs/3-0-migration.md
index d338efeb62..964358b9f2 100644
--- a/packages/docs/docs/3-0-migration.md
+++ b/packages/docs/docs/3-0-migration.md
@@ -32,8 +32,18 @@ The necessary information is now embedded in `assetsInfo`, in the return value o
**Upgrade path**: Remove the `imageFormat` option from `stitchFramesToVideo()`.
+## `useVideoConfig` returns `id` and `defaultProps`
+
+TODO
+
## Removed `webpackBundle` from `stitchFramesToVideo` API
+TODO
+
## Renamed `browserInstance` to `puppeteerInstance` in `getCompositions()`
+TODO
+
## Renamed `config` in `renderFrames()` to `composition`
+
+TODO
diff --git a/packages/docs/docs/the-fundamentals.md b/packages/docs/docs/the-fundamentals.md
index 0775c615a4..3288013dea 100644
--- a/packages/docs/docs/the-fundamentals.md
+++ b/packages/docs/docs/the-fundamentals.md
@@ -71,6 +71,8 @@ export const RemotionVideo: React.FC = () => {
fps={30}
width={1920}
height={1080}
+ // Optionally, you can define props that get passed to the component
+ defaultProps={{ hello: "world" }}
/>
</>
);
diff --git a/packages/docs/docs/use-video-config.md b/packages/docs/docs/use-video-config.md
index 3c26004790..0ce44a0177 100644
--- a/packages/docs/docs/use-video-config.md
+++ b/packages/docs/docs/use-video-config.md
@@ -10,6 +10,8 @@ Namely, `useVideoConfig` will return an object with the following properties:
- `height`: The height of the composition in pixels.
- `fps`: The frame rate of the composition, in frames per seconds.
- `durationInFrames` The duration of the composition in frames.
+- `id`: The composition ID.
+- `defaultProps`: The object that you have defined as the `defaultProps` in your composition.
Remember that you control these properties by passing them as props to `<Composition>`. Read the page about [the fundamentals](/docs/the-fundamentals) to learn how to define a composition.