Skip to content

Function: extractAudio() ​

ts
function extractAudio(url, options?): Promise<ExtractAudioResult>;

Extract the audio track of a video into a separate audio file.

Parameters ​

ParameterTypeDescription
urlstringLocal path of the video.
optionsPartial<ExtractAudioOptions>Output format. Defaults to m4a (AAC).

Returns ​

Promise<ExtractAudioResult>

The path and duration of the audio file, written to the cache directory.

Example ​

ts
const { outputPath, duration } = await extractAudio(videoUri);

Released under the MIT License.