🎥 Make videos programmatically with React
add comments
JonnyBurger1fc1d2492f7c
diff --git a/packages/media/src/convert-audiodata/convert-audiodata.ts b/packages/media/src/convert-audiodata/convert-audiodata.tsindex 1a9e7f1631..8df0191529 100644--- a/packages/media/src/convert-audiodata/convert-audiodata.ts+++ b/packages/media/src/convert-audiodata/convert-audiodata.ts@@ -33,6 +33,13 @@ export const convertAudioData = ({} = audioData;const ratio = currentSampleRate / TARGET_SAMPLE_RATE;+ // Always rounding down start timestamps and rounding up end durations+ // to ensure there are no gaps when the samples don't align+ // In @remotion/renderer inline audio mixing, we also round down the sample start+ // timestamp and round up the end timestamp+ // This might lead to overlapping, hopefully aligning perfectly!+ // Test case: https://github.com/remotion-dev/remotion/issues/5758+const frameOffset = Math.floor(trimStartInSeconds * audioData.sampleRate);const unroundedFrameCount =numberOfFrames -diff --git a/packages/renderer/src/assets/inline-audio-mixing.ts b/packages/renderer/src/assets/inline-audio-mixing.tsindex 2eceb90401..e9dff940ff 100644--- a/packages/renderer/src/assets/inline-audio-mixing.ts+++ b/packages/renderer/src/assets/inline-audio-mixing.ts@@ -238,6 +238,10 @@ export const makeInlineAudioMixing = (dir: string) => {const positionInSeconds =(asset.frame - firstFrame) / fps - (isFirst ? 0 : trimLeftOffset);+ // Always rounding down to ensure there are no gaps when the samples don't align+ // In @remotion/media, we also round down the sample start timestamp and round up the end timestamp+ // This might lead to overlapping, hopefully aligning perfectly!+ // Test case: https://github.com/remotion-dev/remotion/issues/5758const position =Math.floor(positionInSeconds * DEFAULT_SAMPLE_RATE) *NUMBER_OF_CHANNELS *