Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

get-video-duration

caffco50.8kMIT4.1.0TypeScript support: included

Get the duration of a video file

video, duration, ffmpeg, ffprobe, typescript

readme

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

// 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.

changelog

4.1.0

Changed:

  • Allow overriding ffprobe path by passing a second, optional, parameter.

4.0.0

BREAKING:

  • Dropped support for Node 11 and 13.

Changed:

  • Dependencies upgraded.

3.1.0

New:

  • Add support for Apple Silicon (@Beekiper).

Changed:

  • Upgrade execa to v5.0.0.

Misc:

  • Refactor tests from Mocha to Jest.
  • Move CI to Github Actions.

3.0.2

Changed:

  • Upgrade @ffprobe-installer/ffprobe to v1.1.0.

3.0.1

Changed:

  • Dependencies upgraded to their latest semver-compatible versions.

3.0.0

BREAKING:

  • Replaced ffprobe-static by @ffprobe-installer/ffprobe

2.0.0

BREAKING:

  • Minimum supported Node version is 10.0.0.

Changed:

  • Upgrade execa to 4.0.0
  • Upgrade ffprobe-static to 3.0.0
  • Upgrade is-stream to 2.0.0

1.0.3

Changed:

  • Upgrade development dependencies

1.0.2

New:

  • Add getVideoDurationInSeconds named export to easy inter-op with CommonJS modules

1.0.1

Changed:

  • Don't export raw source code
  • Package ES6-compatible module

1.0.0

New:

  • Rewritten in TypeScript

0.4.0

New:

  • No need to install ffprobe globally in the system

Changed:

  • Upgraded dependencies to their latest version

0.3.0

Changed:

  • Upgraded Execa to 0.10.0

Older versions

No changelog available for older versions.