Skip to content

🎥 Make videos programmatically with React

Docs: Clarify `enforceAudioTrack` behavior

JonnyBurger615d9d7118b3
diff --git a/packages/docs/docs/cli/render.mdx b/packages/docs/docs/cli/render.mdx
index c244f3944f..0d11c23a1d 100644
--- a/packages/docs/docs/cli/render.mdx
+++ b/packages/docs/docs/cli/render.mdx
@@ -166,7 +166,7 @@ For example only every second frame, every third frame and so on. Only works for
### `--enforce-audio-track`<AvailableFrom v="3.2.1" />
-[Render a silent audio track if there wouldn't be one otherwise.](/docs/cli/render#--enforce-audio-track).
+<Options cli id="enforce-audio-track" />
### `--disallow-parallel-encoding`<AvailableFrom v="4.0.315" />
diff --git a/packages/docs/docs/cloudrun/rendermediaoncloudrun.mdx b/packages/docs/docs/cloudrun/rendermediaoncloudrun.mdx
index 9feed7cf7c..b3b72347c3 100644
--- a/packages/docs/docs/cloudrun/rendermediaoncloudrun.mdx
+++ b/packages/docs/docs/cloudrun/rendermediaoncloudrun.mdx
@@ -308,7 +308,7 @@ Before v4.0.76, this was "100%" by default. It is now aligned to the other serve
### `enforceAudioTrack?`
-Render a silent audio track if there wouldn't be any otherwise.
+<Options id="enforce-audio-track" />
### `preferLossless?`<AvailableFrom v="4.0.123"/>
diff --git a/packages/docs/docs/config.mdx b/packages/docs/docs/config.mdx
index 5c55585e50..5c5e63d44e 100644
--- a/packages/docs/docs/config.mdx
+++ b/packages/docs/docs/config.mdx
@@ -242,10 +242,10 @@ Override keyboard shortcuts for Studio commands. Shortcuts that are omitted keep
import {Config} from '@remotion/cli/config';
// ---cut---
Config.setKeyboardShortcuts({
- playPause: {key: 'q'},
- quickSwitcher: {key: 'p', commandOrControl: true},
- toggleSnapping: {key: 's', shift: true},
- render: null,
+ playPause: {key: 'q'},
+ quickSwitcher: {key: 'p', commandOrControl: true},
+ toggleSnapping: {key: 's', shift: true},
+ render: null,
});
```
@@ -555,7 +555,7 @@ The [command line flag](/docs/cli/render#--disallow-parallel-encoding) `--disall
## `setEnforceAudioTrack()`<AvailableFrom v="3.2.1" />
-Render a silent audio track if there would be none otherwise. Default `false`.
+<Options id="enforce-audio-track" />
```ts twoslash title="remotion.config.ts"
import {Config} from '@remotion/cli/config';
diff --git a/packages/docs/docs/distributed-rendering.mdx b/packages/docs/docs/distributed-rendering.mdx
index 6a553fa63f..e8e308e6a3 100644
--- a/packages/docs/docs/distributed-rendering.mdx
+++ b/packages/docs/docs/distributed-rendering.mdx
@@ -58,7 +58,7 @@ We're calling the machine which orchestrates the render the "main routine".
- Ensure you are not caught by HTTP body payload limits that for example Lambda has. Otherwise, you might fail to invoke a render if the input props / resolved props payload is too big.
- Pass the same [`inputProps`](/docs/renderer/render-media#inputprops) that you passed to [`selectComposition()`](/docs/renderer/select-composition#inputprops).
- Set the [`numberOfGifLoops`](/docs/renderer/render-media#numberofgifloops) always to `null` for the chunk.
-- Set the [`enforceAudioTrack`](/docs/renderer/render-media#enforceaudiotrack) option always to `true`.
+- Set the [`enforceAudioTrack`](/docs/renderer/render-media#enforceaudiotrack) option always to `true`. This ensures that chunks without audio include a silent audio track, because other chunks may contain audio. If the entire render is muted, `muted: true` takes precedence.
- Set the [`outputLocation`](/docs/renderer/render-media#outputlocation) to a
- Set the [`compositionStart`](/docs/renderer/render-media#compositionstart) to the first frame of overall range of frames that are being rendered.
- Example 1: If you are rendering a full composition, every [`renderMedia()`](/docs/renderer/render-media) invocation should have `0` as `compositionStart`.
diff --git a/packages/docs/docs/renderer/render-media.mdx b/packages/docs/docs/renderer/render-media.mdx
index 1e86a2c07b..830fe021c6 100644
--- a/packages/docs/docs/renderer/render-media.mdx
+++ b/packages/docs/docs/renderer/render-media.mdx
@@ -100,7 +100,7 @@ import {renderMedia} from '@remotion/renderer';
declare const options: Parameters<typeof renderMedia>[0];
// ---cut---
await renderMedia({
- ...options,
+ ...options,
frameRange: [
[0, 100],
[150, 200],
@@ -227,7 +227,7 @@ If set to true, no audio is being rendered.
_boolean_
-Render a silent audio track if there wouldn't be any otherwise.
+<Options id="enforce-audio-track" />
### `puppeteerInstance?`
diff --git a/packages/docs/docs/renderer/stitch-frames-to-video.mdx b/packages/docs/docs/renderer/stitch-frames-to-video.mdx
index d1392724ae..ab245d28ce 100644
--- a/packages/docs/docs/renderer/stitch-frames-to-video.mdx
+++ b/packages/docs/docs/renderer/stitch-frames-to-video.mdx
@@ -137,7 +137,7 @@ A token that allows the render to be cancelled. See: [`makeCancelSignal()`](/doc
### `enforceAudioTrack?`<AvailableFrom v="3.2.1" />
-Render a silent audio track if there wouldn't be any otherwise.
+<Options id="enforce-audio-track" />
### `binariesDirectory?`<AvailableFrom v="4.0.120" />
diff --git a/packages/renderer/src/options/enforce-audio.tsx b/packages/renderer/src/options/enforce-audio.tsx
index 4d16da09f7..079b458154 100644
--- a/packages/renderer/src/options/enforce-audio.tsx
+++ b/packages/renderer/src/options/enforce-audio.tsx
@@ -9,8 +9,32 @@ const cliFlag = 'enforce-audio-track' as const;
export const enforceAudioOption = {
name: 'Enforce Audio Track',
cliFlag,
- description: () => (
- <>Render a silent audio track if there would be none otherwise.</>
+ description: (mode) => (
+ <>
+ <p>
+ Defaults to <code>false</code>. If <code>true</code>, include a silent
+ audio track when the render contains no audio. If <code>false</code>,
+ omit the audio track when no audio is present.
+ </p>
+ <p>
+ {mode === 'cli' ? (
+ <>
+ Pass <code>--enforce-audio-track</code>
+ </>
+ ) : (
+ <>
+ Set this to <code>true</code>
+ </>
+ )}{' '}
+ for{' '}
+ <a href="/docs/distributed-rendering">
+ chunks that will later be concatenated
+ </a>
+ , because other chunks may contain audio.{' '}
+ <code>{mode === 'cli' ? '--muted' : 'muted: true'}</code> takes
+ precedence.
+ </p>
+ </>
),
ssrName: 'enforceAudioTrack',
docLink: 'https://www.remotion.dev/docs/config#setenforceaudiotrack-',