Skip to content

🎥 Make videos programmatically with React

Fix how GIF loops work on Lambda

Jonny Burgerc0994c1b055d
diff --git a/packages/lambda/src/api/render-media-on-lambda.ts b/packages/lambda/src/api/render-media-on-lambda.ts
index 0a3d870096..b4476d417a 100644
--- a/packages/lambda/src/api/render-media-on-lambda.ts
+++ b/packages/lambda/src/api/render-media-on-lambda.ts
@@ -188,7 +188,7 @@ export const renderMediaOnLambda = (
logLevel: options.logLevel ?? 'info',
maxRetries: options.maxRetries ?? 1,
muted: options.muted ?? false,
- numberOfGifLoops: options.numberOfGifLoops ?? 0,
+ numberOfGifLoops: options.numberOfGifLoops ?? null,
offthreadVideoCacheSizeInBytes:
options.offthreadVideoCacheSizeInBytes ?? null,
outName: options.outName ?? null,
diff --git a/packages/renderer/src/combine-videos.ts b/packages/renderer/src/combine-videos.ts
index 10befe3e20..916b44be6a 100644
--- a/packages/renderer/src/combine-videos.ts
+++ b/packages/renderer/src/combine-videos.ts
@@ -9,6 +9,7 @@ import {
} from './audio-codec';
import {callFf} from './call-ffmpeg';
import type {Codec} from './codec';
+import {convertNumberOfGifLoopsToFfmpegSyntax} from './convert-number-of-gif-loops-to-ffmpeg';
import {isAudioCodec} from './is-audio-codec';
import type {LogLevel} from './log-level';
import {Log} from './logger';
@@ -65,9 +66,7 @@ export const combineVideos = async (options: Options) => {
numberOfGifLoops === null ? null : '-loop',
numberOfGifLoops === null
? null
- : typeof numberOfGifLoops === 'number'
- ? String(numberOfGifLoops)
- : '-1',
+ : convertNumberOfGifLoopsToFfmpegSyntax(numberOfGifLoops),
isAudioCodec(codec) ? null : '-c:v',
isAudioCodec(codec) ? null : codec === 'gif' ? 'gif' : 'copy',
resolvedAudioCodec ? '-c:a' : null,