npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-frame-extractor

v1.0.0-alpha

Published

A simple tool to extract, resize and upload frames from the given video.

Downloads

14

Readme

Node Frame Extractor

This simeple command line utility extracts the specified frames (and their adjecent frames) from a video, resizes them and uploads them to a bucket in Amazon S3.

Usage

extract-frames --input [video] --data [data.json] --fps [framerate] --push-to-cloud

For a detailed list of available options and defaults, run the following:

extract-frames --help

Example

The following example dumps six adjecent frames (three on either sides) of all given frames using a framerate of 29.97 and push them to the cloud storage.

extract-frames --input video.mp4 --data frames.json --fps 29.97 --frame-count 3 --push-to-cloud

Amazon S3 Credentials

This utility uses Amazon AWS credentials information stored in the current users ~/.aws/credentials file. If you have more than one credentials configuration in the file, you can use the --aws-profile command line switch to specify which profile to use.

For example:

extract-frames --input myVideo.mp4 --data frames.json --aws-profile myprofilename --push-to-cloud

For more information on how to setup local credentials, refer to Amazon's AWS documentation.

Parameters

This command line utility supports the following parameters.

| Switch | Default | Description | | ------ | ------- | ----------- | | --input, -i | required | Input video filename. | | --data, -d | required if not -a | Scene data in Json format with a scene object having startFrame and endFrame keys. | | --fps, -r | 23.976 | Framerate of the input video. Must be accurate to extract scenes properly. | | --frame-count, -c | 5 | Number of frames to extract on either side of the scene. This is in addition to the frame marked in the scene boundry. | | --concurrency, -t | 8 | Number of concurrent sub-processes to use simultaneously. Should be used to tweak resource consumption. Use a value of 0 to run all sub-processes at once. | | --bucket, -b | ingrain.scenes.frames | S3 Bucket to which the extracted frames will be pushed to. | | --push-to-cloud, -p | false | Determines whether the extracted images be pushed to a cloud storage or not. | | --extract-all-frames, -a | false | Extract all frames of the video. Requires --fps and --total-frames. | | --total-frames, -f | null | Total number of frames to extract from the video. | | --video-id, -v | null | An identifier for the video being processed. It is used as an identifier in directory name. | | --aws-profile | default | Name of the AWS Credentials profile to use from the ~/.aws/credentials file. | | --aws-region | us-west-2 | Specify the AWS region to use. |

Installation

Prerequisites

You should have ffmpeg and graphicsmagik installed on your machine, and they should be exposed in the environment PATH.

Via NPM

The simplest way to install node-frame-extractor is via NPM. All you need to do is:

npm install -g node-frame-extractor

After that you can use the extract-frames command anywhere in your system.

Via Git Repository

If you rather install from source, you can clone the repository and set it up manually.

Step 1: Clone the repository.

git clone https://github.com/UzEE/node-frame-extractor.git

Step 2: Install the project dependencies.

cd ingrain-frame-ext
npm install 

Step 3: Manually prepare the CLI utility.

grunt prepare

Step 4: Link the local module to your global NPM cache.

npm link

You should now be able to use extract-frames command from anywhere in your system.

Input Data Format

Extract Specific Frames

This utility expects the input --data to have certain specific keys:

| field | value | | ----- | ----- | | videoId | The numeric ID of the video being processed. It is used as a part of the name of the AWS container. | | frames | An array of all the frames to process. |

For example:

{
	"videoId": 7,
	"frames": [14, 53, 234, 539, 872, 1143, 2763, 3234]
}

Note: You can also use the --video-id or -v switch to pass in the Video ID.

Extract All Frames

If you want to dump all frames of the video instead, you only need to pass the following parameters instead of the --data option:

| field | value | | ----- | ----- | | -v, --video-id | The numeric ID of the video being processed. It is used as a part of the name for the directory. A random number will be used if omitted. |

Uploaded Asset URIs

The uploaded assets can be accessed from the Amazon S3 bucket using the following URI format:

<bucket uri>/video.<video id>/frame.<frame number>.jpg

For example, the URI for frame 4104 of video Id 1 in the ingrain.scenes.frames bucket would resolve to:

https://s3-us-west-2.amazonaws.com/ingrain.scenes.frames/video.1/frame.4104.jpg

Video Frame