Giter Site home page Giter Site logo

get-tracks-data's Introduction

get-tracks-data

Build NPM Version

Get video / audio / subtitles tracks from MKV and MP4 files.

Installation

npm i get-tracks-data

Examples

File

import path from 'path';
import getTracksData from 'get-tracks-data';
// const getTracksData = require('get-tracks-data').default; // CommonJS import

const file = path.resolve(__dirname, 'video.mkv');

try {
    const tracks = await getTracksData(file);
    console.log(tracks);
} catch (e) {
    console.error(e);
}

Url

import getTracksData from 'get-tracks-data';
// const getTracksData = require('get-tracks-data').default; // CommonJS import

const url = 'https://mywebsite.com/video.mp4';

try {
    const tracks = await getTracksData(url);
    console.log(tracks);
} catch (e) {
    console.error(e);
}

Example of data returned:

[
  { id: 1, type: 'video', lang: null, label: 'UHD', codec: 'MPEGH/ISO/HEVC' },
  { id: 2, type: 'audio', lang: 'spa', label: 'EAC3 Atmos 768 Kbps 5.1', codec: 'EAC3' },
  { id: 3, type: 'text', lang: 'fre', label: 'FRENCH-SRT Sub', codec: 'TEXT/UTF8' }
]

Options

You can pass an options object:

const options = {
    maxBytesLimit: 1e+7, // Will destroy stream and reject the promise when this limit is reached on data read  
};

try {
    await getTracksData(stream, options);
} catch(e) {
    console.error(e);
}

get-tracks-data's People

Contributors

tymmesyde avatar

Watchers

 avatar

Forkers

jaruba

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.