Giter Club home page Giter Club logo

gpmf-extract's Introduction

GPMF extract

Finds the metadata track in GoPro (Hero5 and later) video files (or any other camera that implements GPMF) and extracts it for later analysis and processing.

Accepts a File and returns a Promise that resolves to an object with a rawData (Buffer in NodeJS, UInt8Array in Browser) and timing data (timing), useful for interpreting the data.

Once extracted, you can process the data with gopro-telemetry.

Install:

$ npm i gpmf-extract

Use:

const gpmfExtract = require('gpmf-extract');
gpmfExtract(file).then(res => {
  console.log('Length of data received:', res.rawData.length);
  console.log('Framerate of data received:', 1 / res.timing.frameDuration);
  // Do what you want with the data
});

You can specify some options in an object as a second argument:

  • browserMode: Default: false. Change behaviour to use in browser. This is optional for debugging reasons
  • useWorker: Default: true. In browser mode, use a web worker to avoid locking the browser. This is optional as it seems to crash on some recent browsers
  • progress: Pass a function to read the processed percentage updates
  • cancellationToken: An optional object, containing a cancelled property, that allows for cancelling the extraction process. Currently only supported in browser mode. If cancelled, the extraction process will fail with the error message "Canceled by user".
const gpmfExtract = require('gpmf-extract');
const progress = percent => console.log(`${percent}% processed`);
const cancellationToken = { cancelled: false };
gpmfExtract(file, { browserMode: true, progress, cancellationToken }).then(
  res => {
    if (!res) return; //cancelled
    // Do what you want with the data
  }
);
// Some other processes
cancellationToken.cancelled = true;

About

This code was created for the GoPro Telemetry Extractor.

Here's a gallery with cool uses of the GoPro telemetry.

This project is possible thanks to the gpmf-parser documentation, open sourced by GoPro.

More creative coding

If you liked this you might like some of my app prototyping.

Contribution

Please make your changes to the dev branch, so that automated tests can be run before merging to master. Also, if possible, provide tests for new functionality.

To-DO

  • Fix #46 Memory allocation with large files on certain browsers when using the web worker option
  • Increase browser compatibility
  • Extract highlights

Acknowledgements/credits

gpmf-extract's People

Contributors

akxe avatar dependabot[bot] avatar hugopoi avatar juanirache avatar jwagner avatar motoyasu-yamada avatar sarfata avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.