Skip to main content

Trimming Audio

The <Audio /> tag supports the startFrom and endAt props.
With it, you can trim off parts of the audio.

MyComp.tsx
tsx
import {AbsoluteFill, Audio, staticFile, useVideoConfig} from 'remotion';
 
export const MyComposition = () => {
const {fps} = useVideoConfig();
 
return (
<AbsoluteFill>
<Audio src={staticFile('audio.mp3')} startFrom={2 * fps} endAt={4 * fps} />
</AbsoluteFill>
);
};

This will result the audio to play the range from 00:02:00 to 00:04:00, meaning the audio will play for 2 seconds.

The audio will still play immediately at the beginning - to see how to shift the audio to appear later in the composition, see the next article.