Skip to content

🎥 Make videos programmatically with React

fix timeout

Jonny Burger7f04409ea122
diff --git a/packages/renderer/src/combine-videos.ts b/packages/renderer/src/combine-videos.ts
index 1e46801444..179a51c33c 100644
--- a/packages/renderer/src/combine-videos.ts
+++ b/packages/renderer/src/combine-videos.ts
@@ -59,10 +59,12 @@ export const combineChunks = async ({
const shouldCreateAudio = resolvedAudioCodec !== null && !muted;
const shouldCreateVideo = !isAudioCodec(codec);
- const videoOutput = join(
- filelistDir,
- `video.${getFileExtensionFromCodec(codec, resolvedAudioCodec)}`,
- );
+ const videoOutput = shouldCreateVideo
+ ? join(
+ filelistDir,
+ `video.${getFileExtensionFromCodec(codec, resolvedAudioCodec)}`,
+ )
+ : null;
const audioOutput = shouldCreateAudio
? join(
@@ -106,14 +108,14 @@ export const combineChunks = async ({
);
await Promise.all(
[
- shouldCreateAudio
+ shouldCreateAudio && audioOutput
? createCombinedAudio({
audioBitrate,
filelistDir,
files: audioFiles,
indent,
logLevel,
- output: shouldCreateVideo ? (audioOutput as string) : output,
+ output: audioOutput,
resolvedAudioCodec,
seamless: seamlessAudio,
chunkDurationInSeconds,
@@ -128,7 +130,7 @@ export const combineChunks = async ({
})
: null,
- shouldCreateVideo && !seamlessVideo
+ shouldCreateVideo && !seamlessVideo && videoOutput
? combineVideoStreams({
codec,
filelistDir,
@@ -136,7 +138,7 @@ export const combineChunks = async ({
indent,
logLevel,
numberOfGifLoops,
- output: shouldCreateAudio ? videoOutput : output,
+ output: videoOutput,
files: videoFiles,
addRemotionMetadata: !shouldCreateAudio,
binariesDirectory,
diff --git a/packages/renderer/src/mux-video-and-audio.ts b/packages/renderer/src/mux-video-and-audio.ts
index 9ae33baaf2..72c53a1ac9 100644
--- a/packages/renderer/src/mux-video-and-audio.ts
+++ b/packages/renderer/src/mux-video-and-audio.ts
@@ -17,7 +17,7 @@ export const muxVideoAndAudio = async ({
fps,
cancelSignal,
}: {
- videoOutput: string;
+ videoOutput: string | null;
audioOutput: string | null;
output: string;
indent: boolean;
@@ -31,12 +31,12 @@ export const muxVideoAndAudio = async ({
Log.verbose({indent, logLevel}, 'Muxing video and audio together');
const command = [
'-hide_banner',
- '-i',
+ videoOutput ? '-i' : null,
videoOutput,
audioOutput ? '-i' : null,
audioOutput,
- '-c:v',
- 'copy',
+ videoOutput ? '-c:v' : null,
+ videoOutput ? 'copy' : null,
audioOutput ? '-c:a' : null,
audioOutput ? 'copy' : null,
`-metadata`,