Skip to content

Ivshti/retrieve-keyframes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b1c4408 · Aug 5, 2021
Feb 13, 2016
Feb 13, 2016
Dec 28, 2016
Jan 14, 2017
Sep 14, 2017
Dec 26, 2016
Sep 14, 2017
Mar 1, 2021
Mar 1, 2021
Aug 5, 2021

Repository files navigation

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.