Skip to content

🎥 Make videos programmatically with React

move type to bundler

Jonny Burger114703b23b10
diff --git a/packages/babel-loader/package.json b/packages/babel-loader/package.json
index 67cba597aa..6d414c12e7 100644
--- a/packages/babel-loader/package.json
+++ b/packages/babel-loader/package.json
@@ -37,8 +37,12 @@
"prettier": "^2.7.1",
"prettier-plugin-organize-imports": "^2.3.4",
"remotion": "3.3.44",
+ "@remotion/bundler": "3.3.44",
"typescript": "^4.7.0"
},
+ "peerDependencies": {
+ "@remotion/bundler": "3.3.44"
+ },
"keywords": [
"remotion",
"ffmpeg",
diff --git a/packages/babel-loader/src/index.ts b/packages/babel-loader/src/index.ts
index a4df961918..fc4a6901fa 100644
--- a/packages/babel-loader/src/index.ts
+++ b/packages/babel-loader/src/index.ts
@@ -1,4 +1,4 @@
-import type {WebpackConfiguration} from 'remotion';
+import type {WebpackConfiguration} from '@remotion/bundler';
import type {RuleSetUseItem} from 'webpack';
const envPreset = [
diff --git a/packages/bundler/src/bundle.ts b/packages/bundler/src/bundle.ts
index 82aa73a243..096d324ffc 100644
--- a/packages/bundler/src/bundle.ts
+++ b/packages/bundler/src/bundle.ts
@@ -1,13 +1,13 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
-import type {WebpackOverrideFn} from 'remotion';
import {promisify} from 'util';
import webpack from 'webpack';
import {isMainThread} from 'worker_threads';
import {copyDir} from './copy-dir';
import {indexHtml} from './index-html';
import {readRecursively} from './read-recursively';
+import type {WebpackOverrideFn} from './types';
import {webpackConfig} from './webpack-config';
const promisified = promisify(webpack);
diff --git a/packages/bundler/src/index.ts b/packages/bundler/src/index.ts
index c4fd9fb399..f112e11763 100644
--- a/packages/bundler/src/index.ts
+++ b/packages/bundler/src/index.ts
@@ -1,10 +1,11 @@
import {getConfig} from './bundle';
import {indexHtml} from './index-html';
+import {readRecursively} from './read-recursively';
+import type {WebpackOverrideFn} from './types';
import {cacheExists, clearCache} from './webpack-cache';
import {webpackConfig} from './webpack-config';
import esbuild = require('esbuild');
import webpack = require('webpack');
-import {readRecursively} from './read-recursively';
export const BundlerInternals = {
esbuild,
@@ -17,6 +18,7 @@ export const BundlerInternals = {
};
export {bundle, BundleOptions, LegacyBundleOptions} from './bundle';
+export {WebpackConfiguration, WebpackOverrideFn} from './types';
export {webpack};
export type WebpackConfiguration = webpack.Configuration;
diff --git a/packages/bundler/src/types.ts b/packages/bundler/src/types.ts
new file mode 100644
index 0000000000..1183ca9219
--- /dev/null
+++ b/packages/bundler/src/types.ts
@@ -0,0 +1,7 @@
+import webpack = require('webpack');
+
+export type WebpackConfiguration = webpack.Configuration;
+
+export type WebpackOverrideFn = (
+ currentConfiguration: WebpackConfiguration
+) => WebpackConfiguration;
diff --git a/packages/bundler/src/webpack-config.ts b/packages/bundler/src/webpack-config.ts
index e64793d0c8..4bdb0bcc67 100644
--- a/packages/bundler/src/webpack-config.ts
+++ b/packages/bundler/src/webpack-config.ts
@@ -1,11 +1,11 @@
import {createHash} from 'crypto';
import ReactDOM from 'react-dom';
-import type {WebpackConfiguration, WebpackOverrideFn} from 'remotion';
import {Internals} from 'remotion';
import webpack, {ProgressPlugin} from 'webpack';
import type {LoaderOptions} from './esbuild-loader/interfaces';
import {ReactFreshWebpackPlugin} from './fast-refresh';
import {jsonStringifyWithCircularReferences} from './stringify-with-circular-references';
+import type {WebpackConfiguration, WebpackOverrideFn} from './types';
import {getWebpackCacheName} from './webpack-cache';
import esbuild = require('esbuild');
diff --git a/packages/cli/src/preview-server/start-server.ts b/packages/cli/src/preview-server/start-server.ts
index ceb1acdd4f..b5445e006f 100644
--- a/packages/cli/src/preview-server/start-server.ts
+++ b/packages/cli/src/preview-server/start-server.ts
@@ -1,11 +1,10 @@
+import type { WebpackOverrideFn} from '@remotion/bundler';
import {BundlerInternals, webpack} from '@remotion/bundler';
import {RenderInternals} from '@remotion/renderer';
import fs from 'fs';
import http from 'http';
import os from 'os';
import path from 'path';
-// eslint-disable-next-line no-restricted-imports
-import type {WebpackOverrideFn} from 'remotion';
import {ConfigInternals} from '../config';
import {Log} from '../log';
import {wdm} from './dev-middleware';
diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts
index 7b3a6b9b7c..2a5e4bccd7 100644
--- a/packages/core/src/config.ts
+++ b/packages/core/src/config.ts
@@ -4,11 +4,6 @@
*/
type Concurrency = number | null;
-import type {Configuration} from 'webpack';
-type WebpackConfiguration = Configuration;
-type WebpackOverrideFn = (
- currentConfiguration: WebpackConfiguration
-) => WebpackConfiguration;
type BrowserExecutable = string | null;
type FrameRange = number | [number, number];
type FfmpegExecutable = string | null;
@@ -28,12 +23,12 @@ type CodecOrUndefined =
type Crf = number | undefined;
// New config format: Add new options only here.
-type FlatConfig = ObjectConfig['Bundling'] &
- ObjectConfig['Log'] &
- ObjectConfig['Preview'] &
- ObjectConfig['Puppeteer'] &
- ObjectConfig['Output'] &
- ObjectConfig['Rendering'] & {
+type FlatConfig = RemotionConfigObject['Bundling'] &
+ RemotionConfigObject['Log'] &
+ RemotionConfigObject['Preview'] &
+ RemotionConfigObject['Puppeteer'] &
+ RemotionConfigObject['Output'] &
+ RemotionConfigObject['Rendering'] & {
/**
* Set the audio codec to use for the output video.
* See the Encoding guide in the docs for defaults and available options.
@@ -41,59 +36,14 @@ type FlatConfig = ObjectConfig['Bundling'] &
setAudioCodec: (codec: 'pcm-16' | 'aac' | 'mp3' | 'opus') => void;
};
-// Legacy config format: New options to not need to be added here.
-type ObjectConfig = {
- /**
- * @deprecated New flat config format: You can now replace `Config.Preview.` with `Config.`
- */
- readonly Preview: {
- /**
- * Change the maximum amount of tracks that are shown in the timeline.
- * @param maxTracks The maximum amount of timeline tracks that you would like to show.
- * @default 15
- */
- readonly setMaxTimelineTracks: (maxTracks: number) => void;
- /**
- * Enable Keyboard shortcuts in the Remotion Preview.
- * @param enabled Boolean whether to enable the keyboard shortcuts
- * @default true
- */
- readonly setKeyboardShortcutsEnabled: (enableShortcuts: boolean) => void;
- /**
- * Set number of shared audio tags. https://www.remotion.dev/docs/player/autoplay#use-the-numberofsharedaudiotags-property
- * @param numberOfAudioTags
- * @default 0
- */
- readonly setNumberOfSharedAudioTags: (numberOfAudioTags: number) => void;
- /**
- * Enable Webpack polling instead of file system listeners for hot reloading in the preview.
- * This is useful if you are using a remote directory or a virtual machine.
- * @param interval
- * @default null
- */
- readonly setWebpackPollingInMilliseconds: (interval: number | null) => void;
- /**
- * Whether Remotion should open a browser when starting the Preview.
- * @param should
- * @default true
- */
- readonly setShouldOpenBrowser: (should: boolean) => void;
- };
- /**
- * @deprecated New flat config format: You can now replace `Config.Bundling.` with `Config.`
- */
- readonly Bundling: {
+declare global {
+ interface RemotionBundlingOptions {
/**
* Specify the entry point so you don't have to specify it in the
* CLI command
*/
readonly setEntryPoint: (src: string) => void;
- /**
- * Pass in a function which takes the current Webpack config
- * and return a modified Webpack configuration.
- * Docs: http://remotion.dev/docs/webpack
- */
- readonly overrideWebpackConfig: (fn: WebpackOverrideFn) => void;
+
/**
* Whether Webpack bundles should be cached to make
* subsequent renders faster. Default: true
@@ -111,238 +61,285 @@ type ObjectConfig = {
* You can set an absolute path or a relative path that will be resolved from the closest package.json location.
*/
readonly setPublicDir: (publicDir: string | null) => void;
- };
- /**
- * @deprecated New flat config format: You can now replace `Config.Log.` with `Config.`
- */
- readonly Log: {
- /**
- * Set the log level.
- * Acceptable values: 'error' | 'warning' | 'info' | 'verbose'
- * Default value: 'info'
- *
- * Set this to 'verbose' to get browser logs and other IO.
- */
- readonly setLevel: (
- newLogLevel: 'verbose' | 'info' | 'warn' | 'error'
- ) => void;
- };
- /**
- * @deprecated New flat config format: You can now replace `Config.Puppeteer.` with `Config.`
- */
- readonly Puppeteer: {
- /**
- * Specify executable path for the browser to use.
- * Default: null, which will make Remotion find or download a version of said browser.
- */
- readonly setBrowserExecutable: (
- newBrowserExecutablePath: BrowserExecutable
- ) => void;
- /**
- * Set how many milliseconds a frame may take to render before it times out.
- * Default: `30000`
- */
- readonly setDelayRenderTimeoutInMilliseconds: (
- newPuppeteerTimeout: number
- ) => void;
- /**
- * @deprecated Renamed to `setDelayRenderTimeoutInMilliseconds`.
- * Set how many milliseconds a frame may take to render before it times out.
- * Default: `30000`
- */
- readonly setTimeoutInMilliseconds: (newPuppeteerTimeout: number) => void;
- /**
- * Setting deciding whether to disable CORS and other Chrome security features.
- * Default: false
- */
- readonly setChromiumDisableWebSecurity: (should: boolean) => void;
- /**
- * Setting whether to ignore any invalid SSL certificates, such as self-signed ones.
- * Default: false
- */
- readonly setChromiumIgnoreCertificateErrors: (should: boolean) => void;
- /**
- * If false, will open an actual browser during rendering to observe progress.
- * Default: true
- */
- readonly setChromiumHeadlessMode: (should: boolean) => void;
- /**
- * Set the OpenGL rendering backend for Chrome. Possible values: 'egl', 'angle', 'swiftshader' and 'swangle'.
- * Default: 'swangle' in Lambda, null elsewhere.
- */
- readonly setChromiumOpenGlRenderer: (
- renderer: 'swangle' | 'angle' | 'egl' | 'swiftshader'
- ) => void;
- };
- /**
- * @deprecated New flat config format: You can now replace `Config.Rendering.` with `Config.`
- */
- readonly Rendering: {
- /**
- * Set a custom location for a .env file.
- * Default: `.env`
- */
- readonly setDotEnvLocation: (file: string) => void;
- /**
- * Sets how many Puppeteer instances will work on rendering your video in parallel.
- * Default: `null`, meaning half of the threads available on your CPU.
- */
- readonly setConcurrency: (newConcurrency: Concurrency) => void;
- /**
- * Set the JPEG quality for the frames.
- * Must be between 0 and 100.
- * Must be between 0 and 100.
- * Default: 80
- */
- readonly setQuality: (q: number | undefined) => void;
- /** Decide in which image format to render. Can be either 'jpeg' or 'png'.
- * PNG is slower, but supports transparency.
- */
- readonly setImageFormat: (format: 'png' | 'jpeg' | 'none') => void;
- /**
- * Render only a subset of a video.
- * Pass in a tuple [20, 30] to only render frames 20-30 into a video.
- * Pass in a single number `20` to only render a single frame as an image.
- * The frame count starts at 0.
- */
- readonly setFrameRange: (newFrameRange: FrameRange | null) => void;
- /**
- * Specify local ffmpeg executable.
- * Default: null, which will use ffmpeg available in PATH.
- */
- readonly setFfmpegExecutable: (ffmpegPath: FfmpegExecutable) => void;
- /**
- * Specify local ffprobe executable.
- * Default: null, which will use ffprobe available in PATH.
- */
- readonly setFfprobeExecutable: (ffprobePath: FfmpegExecutable) => void;
- /**
- * Scales the output dimensions by a factor.
- * Default: 1.
- */
- readonly setScale: (newScale: number) => void;
- /**
- * Specify which frames should be picked for rendering a GIF
- * Default: 1, which means every frame
- * https://remotion.dev/docs/render-as-gif
- */
- readonly setEveryNthFrame: (frame: number) => void;
- /**
- * Specify the number of Loop a GIF should have.
- * Default: null (means GIF will loop infinite)
- */
- readonly setNumberOfGifLoops: (newLoop: Loop) => void;
- /**
- * Disable audio output.
- * Default: false
- */
- readonly setMuted: (muted: boolean) => void;
- /**
- * Don't render an audio track if it would be silent.
- * Default: true
- */
- readonly setEnforceAudioTrack: (enforceAudioTrack: boolean) => void;
- };
- /**
- * @deprecated New flat config format: You can now replace `Config.Output.` with `Config.`
- */
- readonly Output: {
- /**
- * Set the output file location string. Default: `out/{composition}.{codec}`
- */
- readonly setOutputLocation: (newOutputLocation: string) => void;
- /**
- * If the video file already exists, should Remotion overwrite
- * the output? Default: true
- */
- readonly setOverwriteOutput: (newOverwrite: boolean) => void;
- /**
- * Sets the pixel format in FFMPEG.
- * See https://trac.ffmpeg.org/wiki/Chroma%20Subsampling for an explanation.
- * You can override this using the `--pixel-format` Cli flag.
- */
- readonly setPixelFormat: (
- format:
- | 'yuv420p'
- | 'yuva420p'
- | 'yuv422p'
- | 'yuv444p'
- | 'yuv420p10le'
- | 'yuv422p10le'
- | 'yuv444p10le'
- | 'yuva444p10le'
- ) => void;
- /**
- * @deprecated Use setCodec() and setImageSequence() instead.
- * Specify what kind of output you, either `mp4` or `png-sequence`.
- */
- readonly setOutputFormat: (newLegacyFormat: 'mp4' | 'png-sequence') => void;
- /**
- * Specify the codec for stitching the frames into a video.
- * Can be `h264` (default), `h265`, `vp8` or `vp9`
- */
- readonly setCodec: (newCodec: CodecOrUndefined) => void;
- /**
- * Set the Constant Rate Factor to pass to FFMPEG.
- * Lower values mean better quality, but be aware that the ranges of
- * possible values greatly differs between codecs.
- */
- readonly setCrf: (newCrf: Crf) => void;
- /**
- * Set to true if don't want a video but an image sequence as the output.
- */
- readonly setImageSequence: (newImageSequence: boolean) => void;
- /**
- * Overrides the height of a composition
- */
- readonly overrideHeight: (newHeight: number) => void;
- /**
- * Overrides the width of a composition
- */
- readonly overrideWidth: (newWidth: number) => void;
- /**
- * Set the ProRes profile.
- * This method is only valid if the codec has been set to 'prores'.
- * Possible values: 4444-xq, 4444, hq, standard, light, proxy. Default: 'hq'
- * See https://avpres.net/FFmpeg/im_ProRes.html for meaning of possible values.
- */
- readonly setProResProfile: (
- profile:
- | '4444-xq'
- | '4444'
- | 'hq'
- | 'standard'
- | 'light'
- | 'proxy'
- | undefined
- ) => void;
- /**
- * Override the arguments that Remotion passes to FFMPEG.
- * Consult https://remotion.dev/docs/renderer/render-media#ffmpegoverride before using this feature.
- */
- readonly overrideFfmpegCommand: (
- command: (info: {
- type: 'pre-stitcher' | 'stitcher';
- args: string[];
- }) => string[]
- ) => void;
+ }
+ // Legacy config format: New options to not need to be added here.
+ interface RemotionConfigObject {
+ /**
+ * @deprecated New flat config format: You can now replace `Config.Preview.` with `Config.`
+ */
+ readonly Preview: {
+ /**
+ * Change the maximum amount of tracks that are shown in the timeline.
+ * @param maxTracks The maximum amount of timeline tracks that you would like to show.
+ * @default 15
+ */
+ readonly setMaxTimelineTracks: (maxTracks: number) => void;
+ /**
+ * Enable Keyboard shortcuts in the Remotion Preview.
+ * @param enabled Boolean whether to enable the keyboard shortcuts
+ * @default true
+ */
+ readonly setKeyboardShortcutsEnabled: (enableShortcuts: boolean) => void;
+ /**
+ * Set number of shared audio tags. https://www.remotion.dev/docs/player/autoplay#use-the-numberofsharedaudiotags-property
+ * @param numberOfAudioTags
+ * @default 0
+ */
+ readonly setNumberOfSharedAudioTags: (numberOfAudioTags: number) => void;
+ /**
+ * Enable Webpack polling instead of file system listeners for hot reloading in the preview.
+ * This is useful if you are using a remote directory or a virtual machine.
+ * @param interval
+ * @default null
+ */
+ readonly setWebpackPollingInMilliseconds: (
+ interval: number | null
+ ) => void;
+ /**
+ * Whether Remotion should open a browser when starting the Preview.
+ * @param should
+ * @default true
+ */
+ readonly setShouldOpenBrowser: (should: boolean) => void;
+ };
+ /**
+ * @deprecated New flat config format: You can now replace `Config.Bundling.` with `Config.`
+ */
+ readonly Bundling: RemotionBundlingOptions;
+ /**
+ * @deprecated New flat config format: You can now replace `Config.Log.` with `Config.`
+ */
+ readonly Log: {
+ /**
+ * Set the log level.
+ * Acceptable values: 'error' | 'warning' | 'info' | 'verbose'
+ * Default value: 'info'
+ *
+ * Set this to 'verbose' to get browser logs and other IO.
+ */
+ readonly setLevel: (
+ newLogLevel: 'verbose' | 'info' | 'warn' | 'error'
+ ) => void;
+ };
+ /**
+ * @deprecated New flat config format: You can now replace `Config.Puppeteer.` with `Config.`
+ */
+ readonly Puppeteer: {
+ /**
+ * Specify executable path for the browser to use.
+ * Default: null, which will make Remotion find or download a version of said browser.
+ */
+ readonly setBrowserExecutable: (
+ newBrowserExecutablePath: BrowserExecutable
+ ) => void;
+ /**
+ * Set how many milliseconds a frame may take to render before it times out.
+ * Default: `30000`
+ */
+ readonly setDelayRenderTimeoutInMilliseconds: (
+ newPuppeteerTimeout: number
+ ) => void;
+ /**
+ * @deprecated Renamed to `setDelayRenderTimeoutInMilliseconds`.
+ * Set how many milliseconds a frame may take to render before it times out.
+ * Default: `30000`
+ */
+ readonly setTimeoutInMilliseconds: (newPuppeteerTimeout: number) => void;
+ /**
+ * Setting deciding whether to disable CORS and other Chrome security features.
+ * Default: false
+ */
+ readonly setChromiumDisableWebSecurity: (should: boolean) => void;
+ /**
+ * Setting whether to ignore any invalid SSL certificates, such as self-signed ones.
+ * Default: false
+ */
+ readonly setChromiumIgnoreCertificateErrors: (should: boolean) => void;
+ /**
+ * If false, will open an actual browser during rendering to observe progress.
+ * Default: true
+ */
+ readonly setChromiumHeadlessMode: (should: boolean) => void;
+ /**
+ * Set the OpenGL rendering backend for Chrome. Possible values: 'egl', 'angle', 'swiftshader' and 'swangle'.
+ * Default: 'swangle' in Lambda, null elsewhere.
+ */
+ readonly setChromiumOpenGlRenderer: (
+ renderer: 'swangle' | 'angle' | 'egl' | 'swiftshader'
+ ) => void;
+ };
+ /**
+ * @deprecated New flat config format: You can now replace `Config.Rendering.` with `Config.`
+ */
+ readonly Rendering: {
+ /**
+ * Set a custom location for a .env file.
+ * Default: `.env`
+ */
+ readonly setDotEnvLocation: (file: string) => void;
+ /**
+ * Sets how many Puppeteer instances will work on rendering your video in parallel.
+ * Default: `null`, meaning half of the threads available on your CPU.
+ */
+ readonly setConcurrency: (newConcurrency: Concurrency) => void;
+ /**
+ * Set the JPEG quality for the frames.
+ * Must be between 0 and 100.
+ * Must be between 0 and 100.
+ * Default: 80
+ */
+ readonly setQuality: (q: number | undefined) => void;
+ /** Decide in which image format to render. Can be either 'jpeg' or 'png'.
+ * PNG is slower, but supports transparency.
+ */
+ readonly setImageFormat: (format: 'png' | 'jpeg' | 'none') => void;
+ /**
+ * Render only a subset of a video.
+ * Pass in a tuple [20, 30] to only render frames 20-30 into a video.
+ * Pass in a single number `20` to only render a single frame as an image.
+ * The frame count starts at 0.
+ */
+ readonly setFrameRange: (newFrameRange: FrameRange | null) => void;
+ /**
+ * Specify local ffmpeg executable.
+ * Default: null, which will use ffmpeg available in PATH.
+ */
+ readonly setFfmpegExecutable: (ffmpegPath: FfmpegExecutable) => void;
+ /**
+ * Specify local ffprobe executable.
+ * Default: null, which will use ffprobe available in PATH.
+ */
+ readonly setFfprobeExecutable: (ffprobePath: FfmpegExecutable) => void;
+ /**
+ * Scales the output dimensions by a factor.
+ * Default: 1.
+ */
+ readonly setScale: (newScale: number) => void;
+ /**
+ * Specify which frames should be picked for rendering a GIF
+ * Default: 1, which means every frame
+ * https://remotion.dev/docs/render-as-gif
+ */
+ readonly setEveryNthFrame: (frame: number) => void;
+ /**
+ * Specify the number of Loop a GIF should have.
+ * Default: null (means GIF will loop infinite)
+ */
+ readonly setNumberOfGifLoops: (newLoop: Loop) => void;
+ /**
+ * Disable audio output.
+ * Default: false
+ */
+ readonly setMuted: (muted: boolean) => void;
+ /**
+ * Don't render an audio track if it would be silent.
+ * Default: true
+ */
+ readonly setEnforceAudioTrack: (enforceAudioTrack: boolean) => void;
+ };
+ /**
+ * @deprecated New flat config format: You can now replace `Config.Output.` with `Config.`
+ */
+ readonly Output: {
+ /**
+ * Set the output file location string. Default: `out/{composition}.{codec}`
+ */
+ readonly setOutputLocation: (newOutputLocation: string) => void;
+ /**
+ * If the video file already exists, should Remotion overwrite
+ * the output? Default: true
+ */
+ readonly setOverwriteOutput: (newOverwrite: boolean) => void;
+ /**
+ * Sets the pixel format in FFMPEG.
+ * See https://trac.ffmpeg.org/wiki/Chroma%20Subsampling for an explanation.
+ * You can override this using the `--pixel-format` Cli flag.
+ */
+ readonly setPixelFormat: (
+ format:
+ | 'yuv420p'
+ | 'yuva420p'
+ | 'yuv422p'
+ | 'yuv444p'
+ | 'yuv420p10le'
+ | 'yuv422p10le'
+ | 'yuv444p10le'
+ | 'yuva444p10le'
+ ) => void;
+ /**
+ * @deprecated Use setCodec() and setImageSequence() instead.
+ * Specify what kind of output you, either `mp4` or `png-sequence`.
+ */
+ readonly setOutputFormat: (
+ newLegacyFormat: 'mp4' | 'png-sequence'
+ ) => void;
+ /**
+ * Specify the codec for stitching the frames into a video.
+ * Can be `h264` (default), `h265`, `vp8` or `vp9`
+ */
+ readonly setCodec: (newCodec: CodecOrUndefined) => void;
+ /**
+ * Set the Constant Rate Factor to pass to FFMPEG.
+ * Lower values mean better quality, but be aware that the ranges of
+ * possible values greatly differs between codecs.
+ */
+ readonly setCrf: (newCrf: Crf) => void;
+ /**
+ * Set to true if don't want a video but an image sequence as the output.
+ */
+ readonly setImageSequence: (newImageSequence: boolean) => void;
+ /**
+ * Overrides the height of a composition
+ */
+ readonly overrideHeight: (newHeight: number) => void;
+ /**
+ * Overrides the width of a composition
+ */
+ readonly overrideWidth: (newWidth: number) => void;
+ /**
+ * Set the ProRes profile.
+ * This method is only valid if the codec has been set to 'prores'.
+ * Possible values: 4444-xq, 4444, hq, standard, light, proxy. Default: 'hq'
+ * See https://avpres.net/FFmpeg/im_ProRes.html for meaning of possible values.
+ */
+ readonly setProResProfile: (
+ profile:
+ | '4444-xq'
+ | '4444'
+ | 'hq'
+ | 'standard'
+ | 'light'
+ | 'proxy'
+ | undefined
+ ) => void;
+ /**
+ * Override the arguments that Remotion passes to FFMPEG.
+ * Consult https://remotion.dev/docs/renderer/render-media#ffmpegoverride before using this feature.
+ */
+ readonly overrideFfmpegCommand: (
+ command: (info: {
+ type: 'pre-stitcher' | 'stitcher';
+ args: string[];
+ }) => string[]
+ ) => void;
- /**
- * Set a target audio bitrate to be passed to FFMPEG.
- */
- readonly setAudioBitrate: (bitrate: string | null) => void;
+ /**
+ * Set a target audio bitrate to be passed to FFMPEG.
+ */
+ readonly setAudioBitrate: (bitrate: string | null) => void;
- /**
- * Set a target video bitrate to be passed to FFMPEG.
- * Mutually exclusive with setCrf().
- */
- readonly setVideoBitrate: (bitrate: string | null) => void;
- };
-};
+ /**
+ * Set a target video bitrate to be passed to FFMPEG.
+ * Mutually exclusive with setCrf().
+ */
+ readonly setVideoBitrate: (bitrate: string | null) => void;
+ };
+ }
+}
-export type ConfigType = ObjectConfig & FlatConfig;
+export type ConfigType = RemotionConfigObject & FlatConfig;
-export type {Concurrency, WebpackConfiguration, WebpackOverrideFn};
+export type {Concurrency};
const conf = {} as unknown as ConfigType;
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 87a3040189..9998494730 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -97,3 +97,6 @@ export const Experimental = {
Null,
useIsPlayer,
};
+
+export type WebpackOverrideFn =
+ "The 'WebpackOverrideFn' has been moved to '@remotion/bundler'. Update your imports and install '@remotion/bundler' if necessary.";
diff --git a/packages/core/src/internals.ts b/packages/core/src/internals.ts
index d0a59b3b5c..ec6abff941 100644
--- a/packages/core/src/internals.ts
+++ b/packages/core/src/internals.ts
@@ -1,4 +1,3 @@
-import type {Configuration} from 'webpack';
import {enableLegacyRemotionConfig} from './config';
import {
@@ -112,19 +111,11 @@ export const Internals = {
useRemotionEnvironment,
};
-type WebpackConfiguration = Configuration;
-
-type WebpackOverrideFn = (
- currentConfiguration: WebpackConfiguration
-) => WebpackConfiguration;
-
export type {
TComposition,
Timeline,
TCompMetadata,
TSequence,
- WebpackOverrideFn,
- WebpackConfiguration,
TAsset,
TimelineContextValue,
SetTimelineContextValue,
diff --git a/packages/example/src/webpack-override.ts b/packages/example/src/webpack-override.ts
index 1c40ed5c73..bab48ce7a7 100644
--- a/packages/example/src/webpack-override.ts
+++ b/packages/example/src/webpack-override.ts
@@ -1,5 +1,5 @@
+import {WebpackOverrideFn} from '@remotion/bundler';
import path from 'path';
-import {WebpackOverrideFn} from 'remotion';
type Bundler = 'webpack' | 'esbuild';
const WEBPACK_OR_ESBUILD = 'esbuild' as Bundler;
diff --git a/packages/lambda/package.json b/packages/lambda/package.json
index 3b7ed250e2..f491f285a9 100644
--- a/packages/lambda/package.json
+++ b/packages/lambda/package.json
@@ -44,6 +44,7 @@
"@jonny/eslint-config": "3.0.266",
"@remotion/compositor-linux-arm64-musl": "3.3.44",
"@remotion/compositor-linux-x64-musl": "3.3.44",
+ "@remotion/bundler": "3.3.44",
"@types/mime-types": "2.1.1",
"@types/minimist": "1.2.2",
"@types/node": "^14.14.14",
@@ -56,6 +57,9 @@
"vitest": "^0.24.3",
"zip-lib": "^0.7.2"
},
+ "peerDependencies": {
+ "@remotion/bundler": "3.3.44"
+ },
"publishConfig": {
"access": "public"
}
diff --git a/packages/lambda/src/api/deploy-site.ts b/packages/lambda/src/api/deploy-site.ts
index 674d46b241..40a0fdda33 100644
--- a/packages/lambda/src/api/deploy-site.ts
+++ b/packages/lambda/src/api/deploy-site.ts
@@ -1,4 +1,4 @@
-import type {WebpackOverrideFn} from 'remotion';
+import type {WebpackOverrideFn} from '@remotion/bundler';
import {lambdaDeleteFile, lambdaLs} from '../functions/helpers/io';
import type {AwsRegion} from '../pricing/aws-regions';
import {bundleSite} from '../shared/bundle-site';
diff --git a/packages/skia/package.json b/packages/skia/package.json
index 88bbbb780b..eb13216118 100644
--- a/packages/skia/package.json
+++ b/packages/skia/package.json
@@ -26,7 +26,8 @@
"peerDependencies": {
"@shopify/react-native-skia": "^0.1.139",
"react": ">=16.8.0",
- "react-dom": ">=16.8.0"
+ "react-dom": ">=16.8.0",
+ "@remotion/bundler": "3.3.44"
},
"devDependencies": {
"@jonny/eslint-config": "3.0.266",
@@ -38,7 +39,8 @@
"prettier-plugin-organize-imports": "^2.3.4",
"react": "18.0.0",
"react-dom": "18.0.0",
- "remotion": "3.2.39",
+ "remotion": "3.3.44",
+ "@remotion/bundler": "3.3.44",
"typescript": "^4.7.0"
},
"keywords": [
diff --git a/packages/skia/src/enable-skia.ts b/packages/skia/src/enable-skia.ts
index 13d751baaf..37cc21ec90 100644
--- a/packages/skia/src/enable-skia.ts
+++ b/packages/skia/src/enable-skia.ts
@@ -1,5 +1,5 @@
+import type {WebpackOverrideFn} from '@remotion/bundler';
import CopyPlugin from 'copy-webpack-plugin';
-import type {WebpackOverrideFn} from 'remotion';
export const enableSkia: WebpackOverrideFn = (currentConfiguration) => {
return {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 32a6f56282..43ccd01309 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -21,6 +21,7 @@ importers:
'@babel/preset-react': 7.14.5
'@babel/preset-typescript': 7.15.0
'@jonny/eslint-config': 3.0.266
+ '@remotion/bundler': 3.3.44
'@types/node': ^16.7.5
'@webhotelier/webpack-fast-refresh': 5.1.0
babel-loader: 8.2.2
@@ -43,6 +44,7 @@ importers:
webpack: 5.74.0
devDependencies:
'@jonny/eslint-config': 3.0.266_t54va6jeo5lf3vtqih5uiyrm5e
+ '@remotion/bundler': link:../bundler
'@types/node': 16.10.2
eslint: 8.25.0
prettier: 2.7.1
@@ -210,7 +212,6 @@ importers:
rimraf: ^3.0.2
typescript: ^4.7.0
vitest: 0.24.3
- webpack: 5.74.0
devDependencies:
'@jonny/eslint-config': 3.0.266_t54va6jeo5lf3vtqih5uiyrm5e
'@testing-library/react': 13.3.0_zpnidt7m3osuk7shl3s4oenomq
@@ -229,7 +230,6 @@ importers:
rimraf: 3.0.2
typescript: 4.7.2
- webpack: 5.74.0
packages/create-video:
specifiers:
@@ -984,6 +984,7 @@ importers:
packages/skia:
specifiers:
'@jonny/eslint-config': 3.0.266
+ '@remotion/bundler': 3.3.44
'@shopify/react-native-skia': ^0.1.139
'@types/react': 18.0.26
'@types/react-native': ^0.69.2
@@ -1000,6 +1001,7 @@ importers:
remotion: link:../core
devDependencies:
'@jonny/eslint-config': 3.0.266_t54va6jeo5lf3vtqih5uiyrm5e
+ '@remotion/bundler': link:../bundler
'@shopify/react-native-skia': 0.1.139_rlxvagb2l2jceoxbyljoesn5oa
'@types/react': 18.0.26
'@types/react-native': 0.69.2