id3-ts-lib

1.2.0 • Public • Published

ID3-TS-LIB

The fat-free ID3-only MPEG2TS segment generator library!

Installation

As a library (into your fancy project):

$> npm install @brightcove/id3-ts-lib

Usage:

const fs = require('fs');

// The whole library exposes just a single function:
const generateID3Segment = require('id3-ts-lib');

// If a PID is falsey, then that track will not be included in the generated PMT
const options = {
  pmtPid: 0x100,
  id3Pid: 0x103,
  videoPid: null,
  audioPid: null,
  id3PTS: 282743,
  data: 'This is just some example payload...',
};

// The function returns a promise that resolves to a buffer
generateID3Segment(options).then((segment) => {
  fs.writeSync('test.ts', segment);
});

As a very rudimentary executable:

$> npm install -g @brightcove/id3-ts-lib

$> id3-ts 'This is just some example payload...' > test.ts

Performance

The entire segment construction process is performed using a single Buffer allocation. All operations are done in place including the ID3-creation which is "chunked" so that the ID3 can be created in-place "around" the TS packet headers. As a result, this code can generate an entire segment for a 4kb payload in about 9.6µs!

Readme

Keywords

none

Package Sidebar

Install

npm i id3-ts-lib

Weekly Downloads

6

Version

1.2.0

License

none

Unpacked Size

65.2 kB

Total Files

21

Last publish

Collaborators

  • brightcove-admin
  • bc-alive
  • lasanchezc
  • brightcove-user
  • myerramalla
  • wswanbeck
  • syseng
  • bcmauleon
  • paco_oblea_bc
  • barroyo
  • bmartinez
  • ackbabe
  • omartinez
  • mgonzalez_bc
  • pdohertybcov
  • muthukumar.bc
  • bvilvanathan
  • agarciabcov
  • palvarezbc
  • ericramos
  • carlosabajo
  • luis.garcia.brightcove
  • stuartmh
  • mshiwal
  • tnwanna
  • sbarrettbc
  • kreynolds
  • bc-srimron-soutter
  • bgs-devops
  • carredondo
  • dsalnikov
  • dawnpacko
  • xgarcia_npm
  • miklospocsaji_bc
  • imorones
  • melinda.darvasi
  • daniel_campos
  • adambertalanbc
  • gabor.kiacz.brightcove
  • rwinger
  • sravan.pbr
  • apenigalapati
  • ijunaidf
  • lmaultsby
  • bcc-bfranklin
  • arevelo
  • sachin-brightcove
  • bc-jcuevas
  • pfbcove
  • luantafarelsilva
  • henriquebc
  • ld-bsp
  • sapa-bsp
  • imbcmdth
  • gkatsev