Skip to main content

Encoding Guide

Backed by FFmpeg, Remotion allows you to configure a variety of encoding settings. The goal of this page is to help you navigate through the settings and to help you choose the right one.

Choosing a codec​

The main video codecs are h264 (default), h265, vp8, vp9, av1 and prores. Remotion also supports h264-mkv, h264-ts and gif. While H264 will work well in most cases, sometimes it's worth going for a different codec. Refer to the table below to see the advantages and drawbacks of each codec.

CodecFile extensionFile sizeEncoding timeBrowser compatibilityHardware acceleration possible

H.264 also known as MPEG-4

.mp4, .mov or .mkvMediumVery fast

Very good

macOS, Linux, Windows (NVIDIA GPU)

H.265 also known as HEVC

.mp4, .mkv or .hevcMediumFast

Very poor

macOS, Linux, Windows (NVIDIA GPU)
VP8.webm or .mkvSmallSlow

Okay

No
VP9.webm or .mkvVery smallVery slow

Okay

No
AV1.mp4, .webm or .mkvVery smallVery slow

Okay

No
ProRes.mov, .mkv or .mxfLargeFastNoneOn macOS
info

Click on a browser compatibility link to see exactly which browsers are supported on caniuse.com.

AV1 can achieve very small file sizes, but encoding is significantly slower than H.264 and H.265. Some runtimes ship only the essential codecs to stay lean, so AV1 output is not available on Remotion Lambda or Linux ARM64 GNU.

Set the codec option.

Hardware acceleration is available from v4.0.228.

Parallel encoding​

Remotion can encode video frames while other frames are still being rendered. See Parallel encoding for when it is enabled, memory usage and how to opt out.

Quality using the CRF setting​

Applies only to h264, h265, vp8, vp9 and av1.

No matter which codec you end up using, there's always a tradeoff between file size and video quality. You can control it by setting the so called CRF (Constant Rate Factor). The lower the number, the better the quality, the higher the number, the smaller the file is – of course at the cost of quality.

Be cautious: Every codec has it's own range of acceptable values and a different default. So while 23 will look very good on a H264 video, it will look terrible on a WebM video. Use this chart to determine which CRF value to use:

CodecMinimum - Best qualityMaximum - Best compressionDefault
H26415118
H26505123
VP84639
VP906328
AV106330

Set the CRF option.

note

If you set crf while hardware acceleration is "required", the render throws an error. With "if-possible", setting crf makes Remotion fall back to software encoding.

Quality using --video-bitrate and --audio-bitrate​

Use the video bitrate and audio bitrate options, or set them in the Studio Render Dialog.

The videoBitrate option cannot be combined with crf.

Quality using ProRes profile​

Applies only to prores codec.

For ProRes, there is no CRF option. Use the ProRes profile option.

You can also adjust the software encoder's bit budget using proResBitsPerMacroblock.

See Rendering ProRes for profile values, file size controls, and alpha channel support.

Audio-only export​

You can pass mp3, wav or aac as a codec. If you do it, an audio file will be output in the corresponding format. Quality settings will be ignored.

GIFs​

You can also render your video as a GIF.

Audio codecv3.3.42​

Using the --audio-codec flag, you can set the format of the audio that is embedded in the video. Not all codec and audio codec combinations are supported and certain combinations require a certain file extension and container format.

The container format will be automatically derived based on the file extension.

Video codecDefaultSupported audio codecsPossible file extensions
h264✅aac.mp4 (default), .mkv , .mov
pcm-16.mkv (default), .mov
mp3.mp4 (default), .mkv , .mov
h264-tspcm-16.ts (default)
✅aac.ts (default)
aac✅aac.aac (default), .3gp , .m4a , .m4b
pcm-16.wav (default)
h265✅aac.mp4 (default), .mkv , .hevc
pcm-16.mkv (default)
av1✅aac.mp4 (default), .mkv
opus.webm (default), .mkv
pcm-16.mkv (default)
mp3✅mp3.mp3 (default)
pcm-16.wav (default)
prores *aac.mov (default), .mkv , .mxf
✅pcm-16.mov (default), .mkv , .mxf
vp8✅opus.webm (default)
pcm-16.mkv (default)
vp9✅opus.webm (default)
pcm-16.mkv (default)
wav✅pcm-16.wav (default)

GIFs don't support audio.

* Note: In versions before v4.0.0 the default audio codec for ProRes was aac. Now it's pcm-16.

File extensions​

Specifying a file extension when rendering media will determine the default codec. You may override the codec using --codec as long as the combination is supported in the table above.

File extensionDefault codec
.3gpaac
.aacaac
.gifgif
.hevch265
.m4aaac
.m4baac
.mkvh264-mkv
.movprores
.mp3mp3
.mp4h264
.mxfprores
.wavwav
.webmvp8
.tsh264-ts

What other settings do you need?​

Which of the dozens of options that FFmpeg supports would you like to see exposed in Remotion? Let us know by opening an issue on our issue tracker!

See also​