Order of Operations
Since Remotion v4.0.141, the order of operations is guaranteed to be the following for <Video>, <Audio>, <Html5Audio>, <Html5Video> and <OffthreadVideo>, :
- Trim audio (using
trimBefore). - Offset audio (by putting it in a
<Sequence>). - Stretch audio (by adding a
playbackRate).
Example for a 30 FPS composition which is 60 frames long:
- An
<Audio>tag has atrimBeforevalue of 45. The first 1.5 seconds of the audio get trimmed off. - The
<Audio>tag is in a<Sequence>which starts at30. The audio only begins playing at the 1.0 second timeline mark at the 1.5 second audio position. - The
<Audio>has aplaybackRateof2. The audio gets sped up by 2x, but the starting position and start offset is not affected. - The composition is 60 frames long, so the audio must stop at the 3.5 second mark:
(comp_duration - offset) * playback_rate + start_from
(60 - 30) * 2 + 45 => frame 105 or the 3.5 second mark - Result: The section of 1.5sec - 3.5sec gets cut out of the audio and is played in the Remotion timeline between frames 30 and 59 at 2x speed.