0.8.2 • Published 1 year ago

get-tracks-data v0.8.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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);
}
0.8.1

1 year ago

0.8.0

1 year ago

0.8.2

1 year ago

0.7.0

1 year ago

0.6.0

1 year ago

0.5.0

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago