Skip to main content

Audio Sample Rate

Match the sample rate of your audio input to the output sample rate to get the best audio quality.

Default behavior

By default, Remotion renders all audio at 48000 Hz (48 kHz).

All audio sources — regardless of their original sample rate — are resampled to the output sample rate during rendering.
This means a 44100 Hz source embedded in a Remotion composition will be upsampled to 48000 Hz.

This is because when the Remotion renderer starts, it doesn't know which assets will be added.
There can also be multiple audios with multiple sample rates in a single composition, which is why Remotion resamples all audio to 48000 Hz by default.

Overriding the sample ratev4.0.448

You can change the output sample rate:

Via renderMedia()

render.ts
import {bundle} from '@remotion/bundler'; import {renderMedia, selectComposition} from '@remotion/renderer'; const bundled = await bundle({entryPoint: './src/index.ts'}); const composition = await selectComposition({ serveUrl: bundled, id: 'MyComp', }); await renderMedia({ composition, serveUrl: bundled, codec: 'h264', sampleRate: 44100, });

Via renderMediaOnWeb()

web-render.ts
import {renderMediaOnWeb} from '@remotion/web-renderer'; const MyComp: React.FC = () => null; const {getBlob} = await renderMediaOnWeb({ composition: { component: MyComp, durationInFrames: 100, fps: 30, width: 1920, height: 1080, id: 'MyComp', }, sampleRate: 44100, });

Via CLI flag

npx remotion render MyComp --sample-rate=44100

Via config file

This only affects the default in the Studio and CLI commands.

remotion.config.ts
import {Config} from '@remotion/cli/config'; Config.setSampleRate(44100);

Via the Studio render dialog

In the Remotion Studio render dialog, you can select the sample rate from a dropdown in the Audio tab.

Matching the sample rate of your source audio

You can set the sample rate based on input props using calculateMetadata().

src/Root.tsx
import React from 'react'; import {CalculateMetadataFunction, Composition} from 'remotion'; import {Input, ALL_FORMATS, UrlSource} from 'mediabunny'; import {MyComp, MyCompProps} from './MyComp'; const calculateMetadata: CalculateMetadataFunction< MyCompProps > = async ({props}) => { const input = new Input({ formats: ALL_FORMATS, source: new UrlSource(props.src, { getRetryDelay: () => null, }), }); const audioTrack = await input.getPrimaryAudioTrack(); return { props, defaultSampleRate: audioTrack?.sampleRate ?? undefined, }; }; export const Root: React.FC = () => { return ( <Composition id="MyComp" component={MyComp} durationInFrames={1} fps={30} width={1920} height={1080} defaultProps={{src: 'https://remotion.media/video.mp4'}} calculateMetadata={calculateMetadata} /> ); };

The defaultSampleRate returned by calculateMetadata() has lower priority than the CLI flag or settings in the Studio dialog.

Mixing audio with different sample rates

When a composition uses multiple audio sources with different sample rates, all of them are resampled to the single output sample rate. There is no way to preserve multiple sample rates in a single output file — this is a fundamental limitation of audio containers.

Choose the sample rate that matches the majority of your sources, or the highest sample rate among them to minimize quality loss.

Sample rate during preview

During preview in the Remotion Studio, audio is always played back at 48000 Hz. This cannot currently be changed.

This means previewed audio may sound slightly different from the final render if you use a custom sample rate. The rendered output will use the correct sample rate.

See also