Skip to content

Get the duration of a video file

License

Notifications You must be signed in to change notification settings

DropSol/get-video-duration

Repository files navigation

get-video-duration

NPM version Build Status Maintainability Test Coverage 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.

About

Get the duration of a video file

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 95.5%
  • JavaScript 4.5%