Skip to content

Latest commit

 

History

History
38 lines (22 loc) · 1.1 KB

README.md

File metadata and controls

38 lines (22 loc) · 1.1 KB

retrieve-keyframes

get time position of all keyframes in mp4/mkv/webm

Usage

var retrieve = require("retrieve-keyframes").get

retrieve(url, container, cb)

url - URL (http) to video file

container - "matroska" (mkv or webm) or "mp4"

cb - callback(err, frames)

frames is an array of objects: { index: Number, timestamp: Number }; the index is the numeric index of the frame, applicable when we use mp4; the timestamp is the pts value of the frame

Examples

./cli.js http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4
./cli.js http://jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv
./cli.js http://ia902508.us.archive.org/17/items/CartoonClassics/Krazy_Kat_-_Keeping_Up_With_Krazy.mp4

NOTE: You can also use the cli with WebM files.

Comparison with ffprobe

A script is included - keyframes.sh - to compare results to ffprobe. All the results match so far, with the exception that ffmpeg likes to pick either dts or pts and consider that value as both pts and dts.