video-length
v2.0.6
Published
Get video length using NodeJS and MediaInfo
Downloads
283
Maintainers
Readme
Video Length
Get video length using NodeJS and MediaInfo
API
await VideoLength(input[, options])
input
Type: String
Full path to video
options.bin
Type: String
Default: MediaInfo
Full path to MediaInfo binary file
options.extended
Type: Boolean
Default: false
Return a bit more video specs
@output
Type: Number | Object
Depends on the extended
option. If extended = true
, returns an object with few more data:
{
"duration" : 307.967,
"width" : 1280,
"height" : 720,
"fps" : 29.97,
"bitrate" : 529097,
"size" : 20368040
}
Usage
const VideoLength = require('video-length');
let video = './videos/MONICA BELLUCCI in the Matrix Sequels (HD Movie Scenes).mp4';
VideoLength(video, { bin: './bin/MediaInfo.exe' })
.then(len => {
// => 307.967
})
.catch(err => {
console.log(err);
})
Changelog
v2.0.2:
- security fix
v2.0.0 (2019-08-27):
- moved from
FFprobe
toMediaInfo
- no more useless
silent
mode