ensureFfmpeg()v3.3
已从 v4.0 移除
🌐 Removed from v4.0
此 API 在 v4.0 中已被删除,不再需要调用。本页面保留用于存档目的。
检查是否已安装 ffmpeg 二进制文件,如果未安装,则下载并将其放入你的 node_modules 文件夹。
🌐 Checks if the ffmpeg binary is installed and if it is not, downloads it and puts it into your node_modules folder.
ensure.mjsimport {ensureFfmpeg} from '@remotion/renderer'; await ensureFfmpeg();
你可能不需要调用此函数。如果尝试渲染且未找到二进制文件,Remotion 将会自动下载 ffmpeg。
🌐 You might not need to call this function. Remotion will automatically download ffmpeg if a render is attempted, and no binary was found.
如果你需要在第一次渲染开始前让 FFmpeg 准备好,这个功能很有用。
🌐 This function is useful if you need FFmpeg to be ready before the first render is started.
还调用 ensureFfprobe() 来获取 Remotion 所需的两个二进制文件。
🌐 Also call ensureFfprobe() to get both binaries that Remotion requires.
选项
🌐 Options
可选地,你可以传入一个对象并传入以下选项:
🌐 Optionally, you can pass an object and pass the following options:
remotionRoot
string
包含你的 node_modules 的目录。
🌐 The directory in which your node_modules is located.
返回值
🌐 Return value
一个返回具有以下属性的对象的承诺:
🌐 A promise which resolves an object with the following properties:
wasAlreadyInstalled:布尔值,表示二进制文件是否因该函数调用而被下载。result:一个字符串,可以是found-in-path、found-in-node-modules或installed。
例外
🌐 Exceptions
如果未找到任何二进制文件、下载失败或你的平台没有可用的二进制文件,此函数将抛出异常。
🌐 This function throws if no binary was found, the download fails or no binaries are available for your platform.
另请参阅
🌐 See also