🎥 Make videos programmatically with React
map supported codecs
Jonny Burger60d1a6c8e90a
diff --git a/packages/renderer/src/combine-video-streams.ts b/packages/renderer/src/combine-video-streams.tsindex 0b5c17b0a6..5cba074d2a 100644--- a/packages/renderer/src/combine-video-streams.ts+++ b/packages/renderer/src/combine-video-streams.ts@@ -63,8 +63,6 @@ export const combineVideoStreams = async ({encoder,codec === 'h265' ? '-tag:v' : null,codec === 'h265' ? 'hvc1' : 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/combine-videos.ts b/packages/renderer/src/combine-videos.tsindex 179a51c33c..ca50e60b83 100644--- a/packages/renderer/src/combine-videos.ts+++ b/packages/renderer/src/combine-videos.ts@@ -36,6 +36,20 @@ type Options = {muted: boolean;};+const codecSupportsFastStart: {[key in Codec]: boolean} = {+ 'h264-mkv': false,+ 'h264-ts': false,+ h264: true,+ h265: true,+ aac: false,+ gif: false,+ mp3: false,+ prores: true,+ vp8: false,+ vp9: false,+ wav: false,+};+export const combineChunks = async ({files,filelistDir,@@ -168,6 +182,7 @@ export const combineChunks = async ({binariesDirectory,fps,cancelSignal,+ addFaststart: codecSupportsFastStart[codec],});onProgress(numberOfFrames);rmSync(filelistDir, {recursive: true});diff --git a/packages/renderer/src/mux-video-and-audio.ts b/packages/renderer/src/mux-video-and-audio.tsindex 0a7fa3e835..09403d8680 100644--- a/packages/renderer/src/mux-video-and-audio.ts+++ b/packages/renderer/src/mux-video-and-audio.ts@@ -16,6 +16,7 @@ export const muxVideoAndAudio = async ({binariesDirectory,fps,cancelSignal,+ addFaststart,}: {videoOutput: string | null;audioOutput: string | null;@@ -26,6 +27,7 @@ export const muxVideoAndAudio = async ({fps: number;onProgress: (p: number) => void;cancelSignal: CancelSignal | undefined;+ addFaststart: boolean;}) => {const startTime = Date.now();Log.verbose({indent, logLevel}, 'Muxing video and audio together');@@ -39,8 +41,8 @@ export const muxVideoAndAudio = async ({videoOutput ? 'copy' : null,audioOutput ? '-c:a' : null,audioOutput ? 'copy' : null,- '-movflags',- 'faststart',+ addFaststart ? '-movflags' : null,+ addFaststart ? 'faststart' : null,`-metadata`,`comment=Made with Remotion ${VERSION}`,'-y',