Skip to content

🎥 Make videos programmatically with React

cool

Jonny Burger3959d418eb37
diff --git a/packages/lambda/src/functions/helpers/concat-videos.ts b/packages/lambda/src/functions/helpers/concat-videos.ts
index 41b382f432..e807e38eea 100644
--- a/packages/lambda/src/functions/helpers/concat-videos.ts
+++ b/packages/lambda/src/functions/helpers/concat-videos.ts
@@ -221,7 +221,7 @@ export const concatVideosS3 = async ({
files,
filelistDir,
output: outfile,
- onProgress: (p) => onProgress(p),
+ onProgress,
numberOfFrames,
codec,
fps,
diff --git a/packages/renderer/src/combine-videos.ts b/packages/renderer/src/combine-videos.ts
index 610065cc7d..19abb27ec6 100644
--- a/packages/renderer/src/combine-videos.ts
+++ b/packages/renderer/src/combine-videos.ts
@@ -56,21 +56,24 @@ export const combineVideos = async ({
const shouldCreateAudio = resolvedAudioCodec !== null;
const shouldCreateVideo = !isAudioCodec(codec);
- const newLocal = shouldCreateAudio
- ? `audio.${
- resolvedAudioCodec === 'pcm-16'
- ? 'wav'
- : resolvedAudioCodec === 'opus'
- ? 'opus'
- : getFileExtensionFromCodec(resolvedAudioCodec, null)
- }`
- : null;
- const audioOutput = newLocal ? join(filelistDir, newLocal) : null;
const videoOutput = join(
filelistDir,
- 'video.' + getFileExtensionFromCodec(codec, resolvedAudioCodec),
+ `video.${getFileExtensionFromCodec(codec, resolvedAudioCodec)}`,
);
+ const audioOutput = shouldCreateAudio
+ ? join(
+ filelistDir,
+ `audio.${
+ resolvedAudioCodec === 'pcm-16'
+ ? 'wav'
+ : resolvedAudioCodec === 'opus'
+ ? 'opus'
+ : getFileExtensionFromCodec(resolvedAudioCodec, null)
+ }`,
+ )
+ : null;
+
if (shouldCreateAudio) {
await createCombinedAudio({
audioBitrate,
@@ -78,7 +81,7 @@ export const combineVideos = async ({
files,
indent,
logLevel,
- output: shouldCreateVideo && audioOutput ? audioOutput : output,
+ output: shouldCreateVideo ? (audioOutput as string) : output,
resolvedAudioCodec,
seamless: resolvedAudioCodec === 'aac',
chunkDurationInSeconds,
@@ -106,14 +109,14 @@ export const combineVideos = async ({
});
}
- if (!(shouldCreateAudio && shouldCreateVideo)) {
+ if (!(audioOutput && shouldCreateVideo)) {
rmSync(filelistDir, {recursive: true});
return;
}
try {
await muxVideoAndAudio({
- audioOutput: audioOutput as string,
+ audioOutput,
indent,
logLevel,
onProgress,