Get the duration of audio files with ffprobe
.
Currently this package only supports Linux, Windows 7+, and MacOS 10.9+. This package does not work in the browser, iOS or Android.
$ npm install --save get-audio-duration
const { getAudioDurationInSeconds } = require('get-audio-duration')
getAudioDurationInSeconds('audio.flac').then((duration) => {
console.log(duration)
})
// If you need to customize the path to ffprobe...
getAudioDurationInSeconds('audio.flac', '/path/to/ffprobe').then((duration) => {
console.log(duration)
})