剪辑音频
<Html5Audio /> 标签支持 trimBefore 和 trimAfter 属性。
使用它,你可以裁剪音频的部分内容。
🌐 The <Html5Audio /> tag supports the trimBefore and trimAfter props.
With it, you can trim off parts of the audio.
MyComp.tsximport {AbsoluteFill ,Html5Audio ,staticFile ,useVideoConfig } from 'remotion'; export constMyComposition = () => { const {fps } =useVideoConfig (); return ( <AbsoluteFill > <Html5Audio src ={staticFile ('audio.mp3')}trimBefore ={2 *fps }trimAfter ={4 *fps } /> </AbsoluteFill > ); };
这将导致音频播放从 00:02:00 到 00:04:00 的范围,这意味着音频将播放 2 秒。
🌐 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.
遗留属性
你也可以使用已弃用的 startFrom 和 endAt 属性,但建议使用新的 trimBefore 和 trimAfter 属性。