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.
Remotion supports 5 video codecs:
prores. The first two produce an output that will be an MP4, the last two are for generating WebM videos. 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.
|Codec||File extension||File size||Rendering time||Browser compatibility|
|H.264 also known as MPEG-4||.mp4 or .mkv||Large||Very fast||Very good|
|H.265 also known as HEVC||.mp4 or .hevc||Medium||Fast||Very poor|
|VP9||.webm||Very small||Very slow||Okay|
Click on a browser compatibility link to see exactly which browsers are supported on caniuse.com.
Applies only to
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:
- Since version 2.1.3, Remotion doesn't allow the CRF to be set to
0anymore because of the issues it causes on macOS/iOS and possible other scenarios. Set the CRF to 1 or higher.
|Codec||Minimum - Best quality||Maximum - Best compression||Default|
You can set a CRF in the config file using the
Config.Output.setCrf() function or use the
--crf command line flag.
Applies only to
|Value||FFMPEG setting||Bitrate||Supports alpha channel|
Higher bitrate means higher quality and higher file size.
You can pass
aac as a codec. If you do it, an audio file will be output in the corresponding format. Quality settings will be ignored.
You can set the codec to
h264-mkv to use the mkv container format together with the H264 codec. If you select this option, the audio will be encoded losslessly using the WAV codec.
This preset was created for Remotion Lambda, and is optimal for when concatenating multiple video clips into one.
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!