Skip to content

🎥 Make videos programmatically with React

[main] Ensuring movflags faststart is applied correctly when using Remotion Lambda

David Branagh-Miscampbell19409236f15a
diff --git a/packages/renderer/src/combine-video-streams.ts b/packages/renderer/src/combine-video-streams.ts
index bcd3a054d7..0b5c17b0a6 100644
--- a/packages/renderer/src/combine-video-streams.ts
+++ b/packages/renderer/src/combine-video-streams.ts
@@ -63,8 +63,8 @@ export const combineVideoStreams = async ({
encoder,
codec === 'h265' ? '-tag:v' : null,
codec === 'h265' ? 'hvc1' : null,
- codec === 'h264' ? '-movflags' : null,
- codec === 'h264' ? 'faststart' : null,
+ codec === 'h264' || codec === 'h264-ts' ? '-movflags' : null,
+ codec === 'h264' || codec === 'h264-ts' ? 'faststart' : null,
addRemotionMetadata ? `-metadata` : null,
addRemotionMetadata ? `comment=Made with Remotion ${VERSION}` : null,
'-y',
diff --git a/packages/renderer/src/mux-video-and-audio.ts b/packages/renderer/src/mux-video-and-audio.ts
index 72c53a1ac9..0a7fa3e835 100644
--- a/packages/renderer/src/mux-video-and-audio.ts
+++ b/packages/renderer/src/mux-video-and-audio.ts
@@ -39,6 +39,8 @@ export const muxVideoAndAudio = async ({
videoOutput ? 'copy' : null,
audioOutput ? '-c:a' : null,
audioOutput ? 'copy' : null,
+ '-movflags',
+ 'faststart',
`-metadata`,
`comment=Made with Remotion ${VERSION}`,
'-y',
diff --git a/packages/renderer/src/stitch-frames-to-video.ts b/packages/renderer/src/stitch-frames-to-video.ts
index 0ee431e59e..b8bc7da6f0 100644
--- a/packages/renderer/src/stitch-frames-to-video.ts
+++ b/packages/renderer/src/stitch-frames-to-video.ts
@@ -359,7 +359,7 @@ const innerStitchFramesToVideo = async (
x264Preset,
colorSpace,
}),
- codec === 'h264' ? ['-movflags', 'faststart'] : null,
+ codec === 'h264' || codec === 'h264-ts' ? ['-movflags', 'faststart'] : null,
// Ignore metadata that may come from remote media
['-map_metadata', '-1'],
['-metadata', `comment=Made with Remotion ${VERSION}`],