Skip to content

🎥 Make videos programmatically with React

Only set to muxing if parallel encoding was used

Jonny Burger0352a7f1d1c4
diff --git a/packages/docs/docs/renderer/render-media.mdx b/packages/docs/docs/renderer/render-media.mdx
index d22ca647c1..f7e1e26a14 100644
--- a/packages/docs/docs/renderer/render-media.mdx
+++ b/packages/docs/docs/renderer/render-media.mdx
@@ -279,7 +279,8 @@ const onProgress: RenderMediaOnProgress = ({renderedFrames, encodedFrames, encod
// Rendering frames and encoding into video
console.log('Encoding...');
} else if (stitchStage === 'muxing') {
- // Combining audio with video (only occurs when audio is present)
+ // If parallel rendering and encoding is being used, a second stage is used to
+ // encode the audio and combine it with the video. This stage does not occur on every render.
console.log('Muxing audio...');
}
// Amount of frames rendered into images
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index 085db9c845..266f9310c4 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -59,7 +59,6 @@ import {shouldUseParallelEncoding} from './prestitcher-memory-usage';
import {validateSelectedCodecAndProResCombination} from './prores-profile';
import type {OnArtifact} from './render-frames';
import {internalRenderFrames} from './render-frames';
-import {getShouldRenderAudio} from './render-has-audio';
import {
disableRepro,
enableRepro,
@@ -742,15 +741,6 @@ const internalRenderMediaRaw = ({
ensureOutputDirectory(absoluteOutputLocation);
}
- // Determine if audio will actually be rendered to decide on stitch stage
- const shouldRenderAudio =
- getShouldRenderAudio({
- assetsInfo,
- codec,
- enforceAudioTrack,
- muted: disableAudio,
- }) === 'yes';
-
const stitchStart = Date.now();
return internalStitchFramesToVideo({
width: Math.round(actualWidth),
@@ -767,13 +757,10 @@ const internalRenderMediaRaw = ({
crf,
assetsInfo,
onProgress: (frame: number) => {
- // Only set to 'muxing' if audio is actually being combined with video
- if (shouldRenderAudio) {
- stitchStage = 'muxing';
- }
// With seamless AAC concatenation, the amount of rendered frames
// might be longer, so we need to clamp it to avoid progress over 100%
if (preEncodedFileLocation) {
+ stitchStage = 'muxing';
muxedFrames = Math.min(frame, totalFramesToRender);
} else {
muxedFrames = Math.min(frame, totalFramesToRender);