Skip to content

🎥 Make videos programmatically with React

@remotion/renderer: Fix numberOfGifLoops being ignored on Lambda

Jonny Burger32198be9de77
diff --git a/packages/renderer/src/combine-chunks.ts b/packages/renderer/src/combine-chunks.ts
index 8b57e06efb..1e53c40d26 100644
--- a/packages/renderer/src/combine-chunks.ts
+++ b/packages/renderer/src/combine-chunks.ts
@@ -246,6 +246,7 @@ export const internalCombineChunks = async ({
cancelSignal,
addFaststart: codecSupportsFastStart[codec],
metadata,
+ numberOfGifLoops,
});
onProgress({totalProgress: 1, frames: numberOfFrames});
rmSync(filelistDir, {recursive: true});
diff --git a/packages/renderer/src/mux-video-and-audio.ts b/packages/renderer/src/mux-video-and-audio.ts
index dfb36c80da..5cbce21df8 100644
--- a/packages/renderer/src/mux-video-and-audio.ts
+++ b/packages/renderer/src/mux-video-and-audio.ts
@@ -1,4 +1,5 @@
import {callFf} from './call-ffmpeg';
+import {convertNumberOfGifLoopsToFfmpegSyntax} from './convert-number-of-gif-loops-to-ffmpeg';
import type {LogLevel} from './log-level';
import {Log} from './logger';
import type {CancelSignal} from './make-cancel-signal';
@@ -18,6 +19,7 @@ export const muxVideoAndAudio = async ({
cancelSignal,
addFaststart,
metadata,
+ numberOfGifLoops,
}: {
videoOutput: string | null;
audioOutput: string | null;
@@ -30,6 +32,7 @@ export const muxVideoAndAudio = async ({
cancelSignal: CancelSignal | undefined;
addFaststart: boolean;
metadata?: Record<string, string> | null;
+ numberOfGifLoops: number | null;
}) => {
const startTime = Date.now();
Log.verbose({indent, logLevel}, 'Muxing video and audio together');
@@ -44,6 +47,10 @@ export const muxVideoAndAudio = async ({
videoOutput ? 'copy' : null,
audioOutput ? '-c:a' : null,
audioOutput ? 'copy' : null,
+ numberOfGifLoops === null ? null : '-loop',
+ numberOfGifLoops === null
+ ? null
+ : convertNumberOfGifLoopsToFfmpegSyntax(numberOfGifLoops),
addFaststart ? '-movflags' : null,
addFaststart ? 'faststart' : null,
...makeMetadataArgs(metadata ?? {}),