
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
get-video-duration
Advanced tools
Get the duration of video files/streams with ffprobe.
Currently this package only supports Linux, Windows 7+, and MacOS 10.9+. This package does not work in the browser, iOS or Android.
$ npm install --save get-video-duration
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)
})
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.
MIT. Based on get-video-dimensions.
FAQs
Get the duration of a video file
The npm package get-video-duration receives a total of 12,385 weekly downloads. As such, get-video-duration popularity was classified as popular.
We found that get-video-duration demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.