Skip to content

🎥 Make videos programmatically with React

fix lambda fps shift

Jonny Burger0265e81eaba4
diff --git a/packages/lambda/src/functions/helpers/concat-videos.ts b/packages/lambda/src/functions/helpers/concat-videos.ts
index 3b51e1b320..c97ff892fe 100644
--- a/packages/lambda/src/functions/helpers/concat-videos.ts
+++ b/packages/lambda/src/functions/helpers/concat-videos.ts
@@ -162,6 +162,7 @@ export const concatVideosS3 = async ({
region,
codec,
expectedBucketOwner,
+ fps,
}: {
bucket: string;
expectedFiles: number;
@@ -171,6 +172,7 @@ export const concatVideosS3 = async ({
region: AwsRegion;
codec: Codec;
expectedBucketOwner: string;
+ fps: number;
}) => {
const outdir = join(RenderInternals.tmpDir(CONCAT_FOLDER_TOKEN), 'bucket');
if (existsSync(outdir)) {
@@ -206,6 +208,7 @@ export const concatVideosS3 = async ({
onProgress: (p) => onProgress(p, encodingStart),
numberOfFrames,
codec: codecForCombining,
+ fps,
});
combine.end();
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index 6d535497b3..c9b3da6aa2 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -284,6 +284,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
region: getCurrentRegionInFunction(),
codec: params.codec,
expectedBucketOwner: options.expectedBucketOwner,
+ fps: comp.fps,
});
if (!encodingStop) {
encodingStop = Date.now();
diff --git a/packages/renderer/src/combine-videos.ts b/packages/renderer/src/combine-videos.ts
index 8ead582ac0..d64ff57e55 100644
--- a/packages/renderer/src/combine-videos.ts
+++ b/packages/renderer/src/combine-videos.ts
@@ -14,6 +14,7 @@ export const combineVideos = async ({
onProgress,
numberOfFrames,
codec,
+ fps,
}: {
files: string[];
filelistDir: string;
@@ -21,6 +22,7 @@ export const combineVideos = async ({
onProgress: (p: number) => void;
numberOfFrames: number;
codec: Codec;
+ fps: number;
}) => {
const fileList = files.map((p) => `file '${p}'`).join('\n');
@@ -31,6 +33,8 @@ export const combineVideos = async ({
const task = execa(
'ffmpeg',
[
+ Internals.isAudioCodec(codec) ? null : '-r',
+ Internals.isAudioCodec(codec) ? null : String(fps),
'-f',
'concat',
'-safe',