Skip to content

tpkn/video-length

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Video Length npm Package

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.6:

  • security fix

v2.0.0 (2019-08-27):

  • moved from FFprobe to MediaInfo
  • no more useless silent mode

About

Get video length using NodeJS and MediaInfo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published