Configuration file
To configure Remotion, create a remotion.config.ts
file in the root of your Remotion project.
These options will apply to CLI commands such as npx remotion studio
and npx remotion render
.
The configuration file has no effect when using SSR APIs.
You can control several behaviors of Remotion here.
remotion.config.tsts
import {Config } from "@remotion/cli/config";Config .setConcurrency (8);Config .setPixelFormat ("yuv444p");Config .setCodec ("h265");
remotion.config.tsts
import {Config } from "@remotion/cli/config";Config .setConcurrency (8);Config .setPixelFormat ("yuv444p");Config .setCodec ("h265");
Old config file format
In v3.3.39, a new config file format was introduced which flattens the options so they can more easily be discovered using TypeScript autocompletion.
Previously, each config option was two levels deep:
remotion.config.tsts
import { Config } from "@remotion/cli/config";// ---cut---Config.Bundling.setCachingEnabled(false);
remotion.config.tsts
import { Config } from "@remotion/cli/config";// ---cut---Config.Bundling.setCachingEnabled(false);
From v3.3.39 on, all options can be accessed directly from the Config
object.
remotion.config.tsts
Config .setCachingEnabled (false);
remotion.config.tsts
Config .setCachingEnabled (false);
The old way is deprecated, but will work for the foreseeable future.
overrideWebpackConfig()v1.1.0
Allows you to insert your custom Webpack config. See the page about custom Webpack configs for more information.
remotion.config.tsts
Config .overrideWebpackConfig ((currentConfiguration ) => {// Return a new Webpack configurationreturn {...currentConfiguration ,// new configuration};});
remotion.config.tsts
Config .overrideWebpackConfig ((currentConfiguration ) => {// Return a new Webpack configurationreturn {...currentConfiguration ,// new configuration};});
setCachingEnabled()v2.0.0
Enable or disable Webpack caching. Default is true
which will make the Webpack step in the first run a bit slower but will massively speed up subsequent runs.
remotion.config.tsts
Config .setCachingEnabled (false);
remotion.config.tsts
Config .setCachingEnabled (false);
The command line flag --bundle-cache
will take precedence over this option.
setPort()
Define on which port Remotion should start it's HTTP servers.
HTTP servers
By default, Remotion will try to find a free port.
If you specify a port, but it's not available, Remotion will throw an error.
When starting the Remotion Studio, a server will be started to host it.
During rendering, a HTTP server is also started in the background to serve the Webpack bundle.
remotion.config.tsts
Config .setPort (3003);
remotion.config.tsts
Config .setPort (3003);
The command line flag --port
will take precedence over this option.
setPublicDir()v3.2.13
Define the location of the public/
directory.
By default it is a folder named "public" inside the current working directory.
You can either set an absolute path, or a relative path that will be resolved from the closest package.json location.
remotion.config.tsts
Config .setPublicDir ("./publico");
remotion.config.tsts
Config .setPublicDir ("./publico");
The command line flag --public-dir
will take precedence over this option.
setEntryPoint()v3.2.40
Sets the Remotion entry point, you don't have to specify it for CLI commands.
remotion.config.tsts
Config .setEntryPoint ("./src/index.ts");
remotion.config.tsts
Config .setEntryPoint ("./src/index.ts");
If you pass an entry point as a CLI argument, it will take precedence.
setLevel()v2.0.1
Increase or decrease the amount of log messages in the CLI. Acceptable values:
error
: Silent except error messages.warn
: Only showing errors and warnings.info
(default): Default output - besides errors and warnings, prints progress and output location.verbose
: All of the above, plus browser logs and other debug info.
remotion.config.tsts
Config .setLevel ("verbose");
remotion.config.tsts
Config .setLevel ("verbose");
The command line flag --log
will take precedence over this option.
setMaxTimelineTracks()v2.1.10
Set how many tracks are being displayed in the timeline in the Studio at most. This does not affect your video, just the amount of tracks shown when previewing. Default 15
.
remotion.config.tsts
Config .setMaxTimelineTracks (20);
remotion.config.tsts
Config .setMaxTimelineTracks (20);
setKeyboardShortcutsEnabled()v3.2.11
Whether the Studio should react to keyboard shortcuts. Default true
.
remotion.config.tsts
Config .setKeyboardShortcutsEnabled (false);
remotion.config.tsts
Config .setKeyboardShortcutsEnabled (false);
The command line flag --disable-keyboard-shortcuts
will take precedence over this option.
setWebpackPollingInMilliseconds()v3.3.11
Enables Webpack polling instead of the file system event listeners for hot reloading. This is useful if you are inside a virtual machine or have a remote file system.
remotion.config.tsts
Config .setWebpackPollingInMilliseconds (1000);
remotion.config.tsts
Config .setWebpackPollingInMilliseconds (1000);
The command line flag --webpack-poll
will take precedence over this option.
setNumberOfSharedAudioTags()v3.3.2
How many shared audio tags should be mounted in the Studio. Shared audio tags can help prevent playback issues due to audio autoplay policies of the browser. See this article which covers the same option but for the Player. Default 0
, meaning no autoplay policies are circumvented.
remotion.config.tsts
Config .setNumberOfSharedAudioTags (5);
remotion.config.tsts
Config .setNumberOfSharedAudioTags (5);
setShouldOpenBrowser()v3.3.19
Whether Remotion should open a browser when starting the Studio. Default true
.
remotion.config.tsts
Config .setShouldOpenBrowser (false);
remotion.config.tsts
Config .setShouldOpenBrowser (false);
setBrowserExecutable()v1.5.0
Set a custom Chrome or Chromium executable path. By default Remotion will try to find an existing version of Chrome on your system and if not found, it will download one. This flag is useful if you don't have Chrome installed in a standard location and you want to prevent downloading an additional browser or need support for the H264 codec.
remotion.config.tsts
Config .setBrowserExecutable ("/usr/bin/google-chrome-stable");
remotion.config.tsts
Config .setBrowserExecutable ("/usr/bin/google-chrome-stable");
The command line flag --browser-executable
will take precedence over this option.
setDelayRenderTimeoutInMilliseconds()v2.6.3
previously named "setTimeoutInMilliseconds"
Define how long a single frame may take to resolve all delayRender()
calls before it times out. Default: 30000
remotion.config.tsts
Config .setDelayRenderTimeoutInMilliseconds (60000);
remotion.config.tsts
Config .setDelayRenderTimeoutInMilliseconds (60000);
The command line flag --timeout
will take precedence over this option.
setChromiumDisableWebSecurity()v2.6.5
This will most notably disable CORS among other security features during rendering.
remotion.config.tstsx
Config .setChromiumDisableWebSecurity (true);
remotion.config.tstsx
Config .setChromiumDisableWebSecurity (true);
The command line flag --disable-web-security
will take precedence over this option.
setChromiumIgnoreCertificateErrors()v2.6.5
Results in invalid SSL certificates, such as self-signed ones, being ignored during rendering.
remotion.config.tstsx
Config .setChromiumIgnoreCertificateErrors (true);
remotion.config.tstsx
Config .setChromiumIgnoreCertificateErrors (true);
The command line flag --ignore-certificate-errors
will take precedence over this option.
setChromiumHeadlessMode()v2.6.5
By default true
. Disabling it will open an actual Chrome window where you can see the render happen.
remotion.config.tstsx
Config .setChromiumHeadlessMode (false);
remotion.config.tstsx
Config .setChromiumHeadlessMode (false);
The command line flag --disable-headless
will take precedence over this option.
setChromiumOpenGlRenderer
Select the OpenGL renderer backend for Chromium.
remotion.config.tstsx
Config .setChromiumOpenGlRenderer ("angle");
remotion.config.tstsx
Config .setChromiumOpenGlRenderer ("angle");
Changelog
- From Remotion v2.6.7 until v3.0.7, the default for Remotion Lambda was
swiftshader
, but from v3.0.8 the default isswangle
(Swiftshader on Angle) since Chrome 101 added support for it. - From Remotion v2.4.3 until v2.6.6, the default was
angle
, however it turns out to have a small memory leak that could crash long Remotion renders.
"angle"
,"egl"
,"swiftshader"
"swangle"
null
- Chromium's default
Default for local rendering: null
.
Default for Lambda rendering: "swangle"
.
The command line flag --gl
will take precedence over this option.
setConcurrency()
Sets how many Puppeteer instances will work on rendering your video in parallel.
Default: null
, meaning half of the threads available on your CPU.
remotion.config.tsts
Config .setConcurrency (8);
remotion.config.tsts
Config .setConcurrency (8);
The command line flag --concurrency
will take precedence over this option.
Try to set your concurrency to os.cpus().length
to all the threads available on your CPU for faster rendering. The drawback is that other parts of your system might slow down.
setVideoImageFormat()v4.0.0
Determines which in which image format to render the frames. Either:
jpeg
- the fastest option (default)png
- slower, but supports transparencynone
- don't render images, just calculate audio information
remotion.config.tsts
Config .setVideoImageFormat ("png");
remotion.config.tsts
Config .setVideoImageFormat ("png");
setStillImageFormat()v4.0.0
Determines which in which image format to render the frames. Either:
png
(default)jpeg
pdf
webp
remotion.config.tsts
Config .setStillImageFormat ("pdf");
remotion.config.tsts
Config .setStillImageFormat ("pdf");
setImageFormat()v1.4.0
Removed in v4.0
Replaced in v4.0 with setVideoImageFormat()
and setStillImageFormat()
Determines which in which image format to render the frames. Either:
jpeg
- the fastest option (default from v1.1)png
- slower, but supports transparencynone
- don't render images, just calculate audio information (available from v2.0)
remotion.config.tsts
import { Config } from "@remotion/cli/config";// ---cut---Config.setImageFormat("png");
remotion.config.tsts
import { Config } from "@remotion/cli/config";// ---cut---Config.setImageFormat("png");
The command line flag --image-format
will take precedence over this option.
setScale()v2.6.7
Scales the output frames by the factor you pass in. For example, a 1280x720px frame will become a 1920x1080px frame with a scale factor of 1.5
. Vector elements like fonts and HTML markups will be rendered with extra details. Default: 1
.
remotion.config.tsts
Config .setScale (2);
remotion.config.tsts
Config .setScale (2);
The command line flag --scale
will take precedence over this option.
setMuted()v3.2.1
Disables audio output. Default false
.
remotion.config.tsts
Config .setMuted (true);
remotion.config.tsts
Config .setMuted (true);
The command line flag --muted
will take precedence over this option.
setEnforceAudioTrack()v3.2.1
Render a silent audio track if there would be none otherwise. Default false
.
remotion.config.tsts
Config .setEnforceAudioTrack (true);
remotion.config.tsts
Config .setEnforceAudioTrack (true);
The command line flag --enforce-audio-track
will take precedence over this option.
setFrameRange()v2.0.0
Pass a number to render a still frame or a tuple to render a subset of a video. The frame sequence is zero-indexed.
remotion.config.tsts
Config .setFrameRange (90); // To render only the 91st frame
remotion.config.tsts
Config .setFrameRange (90); // To render only the 91st frame
or
remotion.config.tsts
Config .setFrameRange ([0, 20]); // Render a video only containing the first 21 frames
remotion.config.tsts
Config .setFrameRange ([0, 20]); // Render a video only containing the first 21 frames
The command line flag --frames
will take precedence over this option.
setJpegQuality()
The JPEG quality of each frame. Must be a number between 0 and 100. Will not work if you render PNG frames. Default: 80.
remotion.config.tsts
Config .setJpegQuality (90);
remotion.config.tsts
Config .setJpegQuality (90);
The command line flag --jpeg-quality
will take precedence over this option.
setQuality()
Renamed to setJpegQuality
in v4.0.0
.
setDotEnvLocation()
Set a custom location for a .env
file. You can specify an absolute path or a relative path in which case it gets resolved based on the current working directory.
remotion.config.tsts
Config .setDotEnvLocation (".my-env");
remotion.config.tsts
Config .setDotEnvLocation (".my-env");
The command line flag --env-file
will take precedence over this option.
setEveryNthFrame()
This option may only be set when rendering GIFs. It determines how many frames are rendered, while the other ones gets skipped in order to lower the FPS of the GIF.
For example, if the fps
is 30, and everyNthFrame
is 2, the FPS of the GIF is 15
.
remotion.config.tsts
Config .setEveryNthFrame (2);
remotion.config.tsts
Config .setEveryNthFrame (2);
The command line flag --every-nth-frame
will take precedence over this option.
setNumberOfGifLoops()
This option may only be set when rendering GIFs. If it is set, it will limit the amount of times a GIF will loop. If set to 0
, the GIF will play once, if set to 1
, it will play twice. If set to null
or not set at all, it will play forever.
remotion.config.tsts
Config .setNumberOfGifLoops (2);
remotion.config.tsts
Config .setNumberOfGifLoops (2);
The command line flag --number-of-gif-loops
will take precedence over this option.
setOutputLocation()v3.1.6
Set the output location of the video or still, relative to the current working directory. The default is out/{composition}.{container}
. For example, out/HelloWorld.mp4
.
remotion.config.tsts
Config .setOutputLocation ("out/video.mp4");
remotion.config.tsts
Config .setOutputLocation ("out/video.mp4");
If you pass another argument to the render command, it will take precedence: npx remotion render src/index.ts HelloWorld out/video.mp4
.
setOverwriteOutput()
Set this to false
to prevent overwriting Remotion outputs when they already exists.
remotion.config.tsts
Config .setOverwriteOutput (false);
remotion.config.tsts
Config .setOverwriteOutput (false);
In version 1.x, the default behavior was inverse - Remotion would not override by default.
setPixelFormat()
Controls the pixel format in FFmpeg. Read more about it here. Acceptable values: yuv420p
, yuv422p
, yuv444p
, yuv420p10le
, yuv422p10le
, yuv444p10le
. Since v1.4, yuva420p
is also supported for transparent WebM videos. Since v2.1.7, yuva444p10le
is also supported for transparent ProRes videos
Default value: yuv420p
remotion.config.tsts
Config .setPixelFormat ("yuv420p");
remotion.config.tsts
Config .setPixelFormat ("yuv420p");
The command line flag --pixel-format
will take precedence over this option.
setCodec()v1.4.0
Choose one of the supported codecs: h264
(default), h265
, vp8
, vp9
.
h264
is the classic MP4 file as you know it.h265
is the successor of H264, with smaller file sizes. Also known as HEVC. Poor browser compatibility.vp8
is the codec for WebM.vp9
is the next-generation codec for WebM. Lower file size, longer compression time.prores
is a common codec if you want to import the output into another video editing program (available from v2.1.6)mp3
will export audio only as an MP3 file (available from v2.0)wav
will export audio only as an WAV file (available from v2.0)aac
will export audio only as an AAC file (available from v2.0)
remotion.config.tsts
Config .setCodec ("h265");
remotion.config.tsts
Config .setCodec ("h265");
The command line flag --codec
will take precedence over this option.
See also: Encoding guide
setAudioCodec()
remotion.config.tsts
Config .setAudioCodec ("pcm-16");
remotion.config.tsts
Config .setAudioCodec ("pcm-16");
Choose the encoding of your audio.
- The default is dependent on the chosen
codec
. - Choose
pcm-16
if you need uncompressed audio. - Not all video containers support all audio codecs.
- This option takes precedence if the
codec
option also specifies an audio codec.
The command line flag --audio-codec
will take precedence over this option.
Refer to the Encoding guide to see defaults and supported combinations.
setProResProfile()v2.1.6
Set the ProRes profile. This option is only valid if the codec has been set to prores
.
Possible values: 4444-xq
, 4444
, hq
, standard
, light
, proxy
.
See here for explanation of possible values.
Default: hq
remotion.config.tsts
Config .setProResProfile ("4444");
remotion.config.tsts
Config .setProResProfile ("4444");
The command line flag --prores-profile
will take precedence over this option.
See also: Encoding guide, Transparent videos
setImageSequence()v1.4.0
Set to true if you want to output an image sequence instead of a video.
remotion.config.tsts
Config .setImageSequence (true);
remotion.config.tsts
Config .setImageSequence (true);
The command line flag --sequence
will take precedence over this option.
overrideHeight()v3.2.40
Overrides the height of the rendered video.
remotion.config.tsts
Config .overrideHeight (600);
remotion.config.tsts
Config .overrideHeight (600);
The command line flag --height
will take precedence over this option.
(see h264 validation?)
overrideWidth()v3.2.40
Overrides the width of the rendered video.
remotion.config.tsts
Config .overrideWidth (900);
remotion.config.tsts
Config .overrideWidth (900);
The command line flag --width
will take precedence over this option
setOutputFormat()
Removed in v4.0.0
Deprecated. Use setCodec()
and setImageSequence()
instead.
Either 'mp4'
or 'png-sequence'
.
remotion.config.tsts
import { Config } from "@remotion/cli/config";// ---cut---Config.setOutputFormat("mp4");
remotion.config.tsts
import { Config } from "@remotion/cli/config";// ---cut---Config.setOutputFormat("mp4");
The command line flags --sequence
and --codec
will take precedence over this option.
The command line flag --quality
will take precedence over this option.
setCrf()v1.4.0
The "Constant Rate Factor" (CRF) of the output. Use this setting to tell FFmpeg how to trade off size and quality.
Ranges for CRF scale, by codec:
h264
crf range is 1-51 where crf 18 is default.h265
crf range is 0-51 where crf 23 is default.vp8
crf range is 4-63 where crf 9 is default.vp9
crf range is 0-63 where crf 28 is default.
The lowest value is lossless, and the highest value is the worst quality possible. Higher values decrease the filesize at the cost of quality.
The range is exponential, so increasing the CRF value +6 results in roughly half the bitrate / file size, while -6 leads to roughly twice the bitrate.
Choose the highest CRF value that still provides an acceptable quality. If the output looks good, then try a higher value. If it looks bad, choose a lower value.
remotion.config.tsts
Config .setCrf (16);
remotion.config.tsts
Config .setCrf (16);
The command line flag --crf
will take precedence over this option.
setVideoBitrate()
v3.2.32
Specify the target bitrate for the generated video.
The syntax for FFMPEGs -b:v
parameter should be used.
FFmpeg may encode the video in a way that will not result in the exact video bitrate specified.
This option cannot be set if --crf
is set.
Example values: 512K
for 512 kbps, 1M
for 1 Mbps.
remotion.config.tsts
Config .setVideoBitrate ("1M");
remotion.config.tsts
Config .setVideoBitrate ("1M");
The command line flag --video-bitrate
will take precedence over this option.
setAudioBitrate
v3.2.32
Specify the target bitrate for the generated audio.
The syntax for FFMPEGs -b:a
parameter should be used.
FFmpeg may encode the video in a way that will not result in the exact audio bitrate specified.
Example values: 128K
for 128 kbps, 1M
for 1 Mbps.
Default: 320k
remotion.config.tsts
Config .setAudioBitrate ("128K");
remotion.config.tsts
Config .setAudioBitrate ("128K");
The command line flag --audio-bitrate
will take precedence over this option.
overrideFfmpegCommandv3.2.22
Modifies the FFmpeg command that Remotion uses under the hood. It works reducer-style, meaning that you pass a function that takes a command as an argument and returns a new command.
remotion.config.tstsx
Config .overrideFfmpegCommand (({args }) => {// Define the custom FFmpeg options as an array of stringsconstcustomFfmpegOptions = ["-profile:v","main","-video_track_timescale","90000","-color_primaries","bt709","-color_trc","bt709","-strict","experimental",];// The customFfmpegOptions are inserted before the last element to ensure// they appear before the ffmpeg's output pathargs .splice (args .length - 1, 0, ...customFfmpegOptions );returnargs ;});
remotion.config.tstsx
Config .overrideFfmpegCommand (({args }) => {// Define the custom FFmpeg options as an array of stringsconstcustomFfmpegOptions = ["-profile:v","main","-video_track_timescale","90000","-color_primaries","bt709","-color_trc","bt709","-strict","experimental",];// The customFfmpegOptions are inserted before the last element to ensure// they appear before the ffmpeg's output pathargs .splice (args .length - 1, 0, ...customFfmpegOptions );returnargs ;});
The function you pass must accept an object as it's only parameter which contains the following properties:
type
: Either"stitcher"
or"pre-stitcher"
. If enough memory and CPU is available, Remotion may use parallel rendering and encoding, which means that a pre-stitcher process gets spawned before all frames are rendered. You can tell whether parallel encoding is enabled by adding--log=verbose
to your render command.args
: An array of strings that is passed as arguments to the FFmpeg command.
Your function must return a modified array of strings.
Using this feature is discouraged. Before using it, we want to make you aware of some caveats:
- The render command can change with any new Remotion version, even when it is a patch upgrade. This might break your usage of this feature.
- Depending on the selected codec, available CPU and RAM, Remotion may or may not use "parallel encoding" which will result in multiple FFmpeg commands being executed. Your function must be able to handle being called multiple times.
- The FFmpeg binary provided by Remotion supports only a small subset of FFmpeg commands, therefore not every passed option will be applied.
- This feature is not available when using Remotion Lambda.
Before you use this hack, reach out to the Remotion team on Discord and ask us if we are open to implement the feature you need in a clean way - we often do implement new features quickly based on users feedback.
setFfmpegExecutable()
removed in v4.0
Allows you to use a custom FFmpeg binary. Must be an absolute path. By default, this is null and the FFmpeg in PATH
will be used.
remotion.config.tsts
import { Config } from "@remotion/cli/config";// ---cut---Config.setFfmpegExecutable("/path/to/custom/ffmpeg");
remotion.config.tsts
import { Config } from "@remotion/cli/config";// ---cut---Config.setFfmpegExecutable("/path/to/custom/ffmpeg");
The command line flag --ffmpeg-executable
will take precedence over this option.
setFfprobeExecutable()
removed in v4.0
Allows you to use a custom ffprobe
binary. Must be an absolute path. By default, this is null and the ffprobe
in PATH
will be used.
remotion.config.tsts
import { Config } from "@remotion/cli/config";// ---cut---Config.setFfprobeExecutable("/path/to/custom/ffprobe");
remotion.config.tsts
import { Config } from "@remotion/cli/config";// ---cut---Config.setFfprobeExecutable("/path/to/custom/ffprobe");
The command line flag --ffprobe-executable
will take precedence over this option.