Skip to main content

导出音频

如果你从 Remotion 导出你的视频,音频会自动包含在内。
此外,本页面显示了你可以仅导出音频,或省略音频,以及导出过程是如何工作的。

🌐 If you export your video from Remotion, the audio is automatically included.
Additionally, this page shows you can export the audio only, or omit the audio, and how the export process works.

仅音频

🌐 Audio Only

支持导出为 mp3aacwav

🌐 Exporting as mp3, aac and wav is supported:

命令行

🌐 Command Line

要通过命令行仅渲染音频,请在通过命令行导出时指定一个扩展名:

🌐 To render only the audio via CLI, specify an extension when exporting via CLI:

npx remotion render src/index.ts my-comp out/audio.mp3

或者使用 --codec 标志来自动选择一个合适的输出文件名:

🌐 or use the --codec flag to automatically choose a good output file name:

npx remotion render src/index.ts my-comp --codec=mp3

renderMedia()

要通过服务器端渲染 API 仅渲染音频,请使用 renderMedia() 并将 codec 设置为音频编码器。

🌐 To render only the audio via the server-side rendering APIs, use renderMedia() and set the codec to an audio codec.

render.js
await renderMedia({ composition, serveUrl: bundleLocation, codec: 'mp3', outputLocation, inputProps, });

renderMediaOnLambda()

要通过 Lambda 仅渲染音频,请使用 renderMediaOnLambda() 并将 codec 设置为音频编解码器,将 imageFormat 设置为 none

🌐 To render only the audio via Lambda, use renderMediaOnLambda() and set the codec to an audio codec and imageFormat to none.


const {bucketName, renderId} = await renderMediaOnLambda({
  region: 'us-east-1',
  functionName: 'remotion-render-bds9aab',
  composition: 'MyVideo',
  serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
  inputProps: {},
  codec: 'mp3',
  imageFormat: 'none',
});

renderMediaOnVercel()

要通过 Vercel 仅渲染音频,请使用 renderMediaOnVercel() 并将 codec 设置为音频编解码器,将 imageFormat 设置为 none

🌐 To render only the audio via Vercel, use renderMediaOnVercel() and set the codec to an audio codec and imageFormat to none.


const {sandboxFilePath} = await renderMediaOnVercel({
  sandbox,
  compositionId: 'MyVideo',
  inputProps: {},
  codec: 'mp3',
  imageFormat: 'none',
});

Lambda 命令行接口

🌐 Lambda CLI

要通过 Lambda CLI 渲染,请使用 npx remotion lambda render 命令并传递 --codec 标志:

🌐 To render via the Lambda CLI, use the npx remotion lambda render command and pass the --codec flag:

npx remotion lambda render --codec=mp3 https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw my-comp

不包括音频

🌐 Excluding audio

命令行

🌐 Command Line

传递 --muted 来不导出音频。

🌐 Pass --muted to not export audio.

npx remotion render --muted

renderMedia()

muted: true 传递给 renderMedia() 以静音渲染。

🌐 Pass muted: true to renderMedia() to mute a render.

render.js
await renderMedia({ composition, serveUrl: bundleLocation, codec: 'h264', muted: true, outputLocation, inputProps, });

renderMediaOnLambda()

muted: true 传递给 renderMediaOnLambda() 以静音渲染。

🌐 Pass muted: true to renderMediaOnLambda() to mute the render.


const {bucketName, renderId} = await renderMediaOnLambda({
  region: 'us-east-1',
  functionName: 'remotion-render-bds9aab',
  composition: 'MyVideo',
  serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
  inputProps: {},
  codec: 'h264',
  muted: true,
});

renderMediaOnVercel()

muted: true 传递给 renderMediaOnVercel() 以静音渲染。

🌐 Pass muted: true to renderMediaOnVercel() to mute the render.


const {sandboxFilePath} = await renderMediaOnVercel({
  sandbox,
  compositionId: 'MyVideo',
  inputProps: {},
  codec: 'h264',
  muted: true,
});

Lambda 命令行接口

🌐 Lambda CLI

在使用 Lambda 命令行时,将 --muted 传递给 npx remotion lambda render 以静音渲染。

🌐 Pass --muted to npx remotion lambda render to mute a render when using the Lambda Command Line.

npx remotion lambda render --muted https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw my-comp