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

sh.ff-fingerprinter

v1.3.0

Published

FF-FingerPrinter is a tool to create fingerprints of media files using their streams and properties thereof.

Downloads

21

Readme

FF-FingerPrinter

FF-FingerPrinter is a Node.js-based tool that uses ffmpeg and ffprobe to probe and fingerprint media files (anything that your ffmpeg can read). It supports hashing a media file's chapters and streams (currently video-, audio- and subtitle-streams are supported).

Install from npm Current Version

This package can be installed using the following command: npm install sh.ff-fingerprinter.


This tool can be used as a library in your own project or as a standalone CLI-application. JSDoc-typedefs have been created to model the full output. The library exports the single class FFFingerPrinter and some default configurations. The class makes extensive use of async features.

The purpose is to uniquely identify media files and the streams they contain. This helps to identify duplicates and to avoid ID'ing files based on their names/paths or attributes or timestamps (which can easily be changed). Hashing of streams of a file can be done in parallel.

When hashing, the raw data of each stream is taken and put through a cryptographic hasher, such as sha256 (default). Also, properties of streams are hashed deterministically (sorted). Then, a hash for the whole file is computed and the file itself is analyzed using stat. A remux of a file (containing the same streams as the original) will be ID'ed differently, but the streams' hashes will be identical (look below for an example output).

Command Line Interface (CLI)

Here is how to run FF-FingerPrinter from CLI:

In CLI-mode, a configuration file is used. An example can be found in cli/config.default.js.

Example output

In CLI-mode, FF-Fingerprinter writes its result to stdout while logging what it's doing to stderr, so that you can pipe its JSON-based output to a file.

Some noteworthy details:

  • fingerprint: The hash of the entire file, taking into account all streams' and chapters' hashes. Replicates the value from hashInfo.hashAll.
  • hashWithProps: Is a hash over the streams' hash and its (deterministically) stringified properties. numBytes indicates how many bytes were read to create the hash.
  • The output of ffprobe is fully preserved and additional properties, such as hashInfo and fffVersions are added. Also, the settings (hashConf) used for hashing are preserved, so that the results are repeatable.

Testing

Note that for testing, you need to have ffmpeg and ffprobe installed.