getSilentParts()v4.0.18
note
此函数仅适用于 Node.js 应用程序。无法在浏览器中运行。
获取视频或音频在 Node.js 中的静音部分。用于从视频中剪切静音部分。
示例
silent-parts.mjsts
import {getSilentParts } from "@remotion/renderer";const {silentParts ,durationInSeconds } = awaitgetSilentParts ({src : "/Users/john/Documents/bunny.mp4",noiseThresholdInDecibels : -20,minDurationInSeconds : 1,});console .log (silentParts ); // [{startInSeconds: 0, endInSeconds: 1.5}]
silent-parts.mjsts
import {getSilentParts } from "@remotion/renderer";const {silentParts ,durationInSeconds } = awaitgetSilentParts ({src : "/Users/john/Documents/bunny.mp4",noiseThresholdInDecibels : -20,minDurationInSeconds : 1,});console .log (silentParts ); // [{startInSeconds: 0, endInSeconds: 1.5}]
info
将绝对路径传递给 getSilentParts()
。不支持 URL。
参数
一个对象,包含以下属性:
source
string
本地视频或音频文件路径。
noiseThresholdInDecibels
number, optional
分贝阈值。如果音频低于此阈值,则被视为静音。默认值为 -20
。必须小于 30
。
minDurationInSeconds
number, optional
静音部分的最小持续时间(以秒为单位)。默认值为 1
。
logLevel?
One of verbose
, info
, warn
, error
.Determines how much is being logged to the console.
verbose
will also log console.log
's from the browser.Default
info
.
binariesDirectory?
v4.0.120
The directory where the platform-specific binaries and libraries that Remotion needs are located. Those include an ffmpeg
and ffprobe
binary, a Rust binary for various tasks, and various shared libraries. If the value is set to null
, which is the default, then the path of a platform-specific package located at node_modules/@remotion/compositor-*
is selected.This option is useful in environments where Remotion is not officially supported to run like bundled serverless functions or Electron.
返回值
返回值是一个对象,包含以下属性:
silentParts
一个对象数组,包含以下属性:
startInSeconds
:静音部分的开始时间(以秒为单位)。endInSeconds
:静音部分的结束时间(以秒为单位)。
audibleParts
silentParts
数组的相反。
一个对象数组,包含以下属性:
startInSeconds
:可听部分的开始时间(以秒为单位)。endInSeconds
:可听部分的结束时间(以秒为单位)。
durationInSeconds
媒体的时长(以秒为单位)。
参见
Please paste the Markdown content you would like me to translate into Chinese.