Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

mpegts-demuxer

tvkitchen27LGPL-3.00.1.0TypeScript support: included

Demuxes an MPEG Transport Stream into elementary packets.

mpeg, mpeg-ts, video, demuxer, tv, transform, tvkitchen

readme

TV Kitchen Utility: MPEG-TS Demuxer

This package demuxes packets from an MPEG transport stream.

It is a modified fork of the excellent TSDemuxer package created by Logan Kearsley. The overall project was started as a JavaScript / TypeScript implementation of Anton Burdinuk's C++ MPEG-TS demuxer.

How to Use

The MpegTsDemuxer is a NodeJS Transform stream which means it supports the Read and Write stream APIs. It consumes raw mpegts data as a stream and emits Packet objects as they are parsed.

import { MpegTsDemuxer } from 'mpegts-demuxer'
import { createReadStream } from 'fs'

const fileStream = fs.createReadStream('myFile.ts')
const mpegTsDemuxer = new MpegTsDemuxer()
fileStream.pipe(mpegTsDemuxer)
mpegTsDemuxer.on('data', (packet) => {
    console.log(packet)
})

References

If you want to understand the technical specifications related to demuxing MPEG-TS streams can check out the spec directly.

About the TV Kitchen

TV Kitchen is a project of Bad Idea Factory. Learn more at the TV Kitchen project site.

Participating

TV Kitchen is an open source project, and we welcome contributions of any kind.

Thank you for considering, and before diving in please follow these steps:

changelog

Changelog for mpegts-demuxer

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased

0.1.0 - 2021-05-13

Added

Changed

  • The package is now much more compliant with our linting rules.
  • Large PTS and DTS values no longer result in int overflows.
  • MpegTsDemuxer now adheres to the Transform Stream API.