运算顺序
自 Remotion v4.0.141 起,<Video>、<Audio>、<Html5Audio>、<Html5Video> 和 <OffthreadVideo> 的操作顺序保证如下:
🌐 Since Remotion v4.0.141, the order of operations is guaranteed to be the following for <Video>, <Audio>, <Html5Audio>, <Html5Video> and <OffthreadVideo>, :
- 修剪音频(使用
trimBefore)。 - 通过将音频放入
<Sequence>来偏移音频。 - 拉伸音频(通过添加
playbackRate)。
一个30帧每秒、总长60帧的合成示例:
🌐 Example for a 30 FPS composition which is 60 frames long:
- 一个
<Audio>标签的trimBefore值为 45。音频的前 1.5 秒被剪掉。 <Audio>标签位于从30开始的<Sequence>中。音频仅在时间轴的 1.0 秒标记处、音频位置的 1.5 秒处开始播放。<Audio>拥有一个playbackRate为2。音频会加速 2 倍,但起始位置和起始偏移不受影响。- 该作品长度为60帧,因此音频必须在3.5秒处停止: > (comp_duration - offset) * playback_rate + start_from > (60 - 30) * 2 + 45 => 第105帧或3.5秒处
- 结果:音频中1.5秒到3.5秒的部分被剪切,并以2倍速度在Remotion时间线上第30帧到第59帧之间播放。