get-video-info-v2
v1.0.0
Published
Get the info of a video file
Downloads
1
Maintainers
Readme
get-video-duration
Get the duration of video files/streams with ffprobe
.
Install
$ npm install --save get-video-duration
Usage
const { getVideoDurationInSeconds } = require('get-video-duration')
// From a local path...
getVideoDurationInSeconds('video.mov').then((duration) => {
console.log(duration)
})
// From a URL...
getVideoDurationInSeconds(
'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
).then((duration) => {
console.log(duration)
})
// From a readable stream...
const fs = require('fs')
const stream = fs.createReadStream('video.mov')
getVideoDurationInSeconds(stream).then((duration) => {
console.log(duration)
})
// If you need to customize the path to ffprobe...
getVideoDurationInSeconds('video.mov', '/path/to/ffprobe').then((duration) => {
console.log(duration)
})
License
MIT. Based on get-video-dimensions.