packages/docs/docs/renderer/get-silent-parts.mdx
Gets the silent parts of a video or audio in Node.js. Useful for cutting out silence from a video.
import {getSilentParts} from '@remotion/renderer';
const {silentParts, durationInSeconds} = await getSilentParts({
src: '/Users/john/Documents/bunny.mp4',
noiseThresholdInDecibels: -20,
minDurationInSeconds: 1,
});
console.log(silentParts); // [{startInSeconds: 0, endInSeconds: 1.5}]
:::info
Pass an absolute path to getSilentParts(). URLs are not supported.
:::
An object which takes the following properties:
sourcestring
A local video or audio file path.
noiseThresholdInDecibels?number
The threshold in decibels. If the audio is below this threshold, it is considered silent. The default is -20. Must be less than 30.
minDurationInSeconds?number
The minimum duration of a silent part in seconds. The default is 1.
logLevel?binariesDirectory?<AvailableFrom v="4.0.120" />The return value is an object with the following properties:
silentPartsAn array of objects with the following properties:
startInSeconds: The start time of the silent part in seconds.endInSeconds: The end time of the silent part in seconds.audiblePartsThe inverse of the silentParts array.
An array of objects with the following properties:
startInSeconds: The start time of the audible part in seconds.endInSeconds: The end time of the audible part in seconds.durationInSecondsThe time length of the media in seconds.