All Projects → caffco → Get Video Duration

caffco / Get Video Duration

Licence: mit
Get the duration of a video file

Programming Languages

typescript
32286 projects

Labels

get-video-duration

NPM version Build status Test coverage Dependency Status License NPM bundle size (minified) Downloads

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)
})

License

MIT. Based on get-video-dimensions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].