MCPcopy Index your code
hub / github.com/caffco/get-video-duration

github.com/caffco/get-video-duration @v5.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v5.0.0 ↗ · + Follow
6 symbols 22 edges 5 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
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.

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.

Extension points exported contracts — how you extend this code

TemporalFileOptions (Interface)
(no doc)
test/index.integration.test.ts

Core symbols most depended-on inside this repo

getFFprobeWrappedExecution
called by 1
src/index.ts
getVideoDurationInSeconds
called by 0
src/index.ts

Shape

Function 5
Interface 1

Languages

TypeScript100%

Modules by API surface

test/index.integration.test.ts4 symbols
src/index.ts2 symbols

For agents

$ claude mcp add get-video-duration \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page