Skip to content
Projects

caffco/get-video-duration

View on GitHub

caffco/get-video-duration has 139 GitHub stars and 17 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-16 18:50 UTC. Last push 2026-11-13.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

Get the duration of a video file

Creative & Media

README.md

Original

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.

Supported platforms

Currently this package only supports Linux, Windows 7+, and MacOS 10.9+. This package does not work in the browser, iOS or Android.

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

FAQ

I get a segmentation fault when trying to download a URL

This is a limitation of the underlying ffprobe binary, which has glibc statically linked and that prevents DNS resolution. Install nscd package through your package manager to solve this issue.

License

MIT. Based on get-video-dimensions.