New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mpegts-stream

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mpegts-stream

Multiplex AAC audio samples and H264/AVC video samples into an MPEG2TS stream ready for transport.

  • 0.0.1-alpha3
  • alpha
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-44.44%
Maintainers
0
Weekly downloads
 
Created
Source

mpegts-stream

Multiplex raw AAC audio samples and/or raw H264/AVC video samples into an MPEG2TS transport stream.

Example

//@ts-check
import { createReadStream, createWriteStream } from "fs";
import { MpegTsMuxer } from "./src/muxer.js";
import { Transform } from "stream";
import { TfAudioPacket, TfVideoPacket } from "./src/transforms.js";

const AUDIO_TYPE = 0x0F;
const VIDEO_TYPE = 0x1B;
const AUDIO_PID = 257;
const VIDEO_PID = 256;
const PMT_PID = 100;

const streamPidMap = {
    [AUDIO_TYPE]: AUDIO_PID,
    [VIDEO_TYPE]: VIDEO_PID
};

// transform used for preparing packets of AAC audio samples with ADTS headers into the object type that MpegTsMuxer expects. 
const apTf = new TfAudioPacket();
const muxer = new MpegTsMuxer(streamPidMap, PMT_PID, VIDEO_PID, 0);

const ws = createWriteStream('./out/test.ts');
const aacRs = createReadStream('./in/vid.aac');

// construct our pipeline...
aacRs
    // transform chunks of binary audio data into expected packets for the muxer.
    .pipe(apTf, { end: false })
    // multiplex the data into TS
    .pipe(muxer)
    // write the resulting data to the file.
    .pipe(ws);

Keywords

FAQs

Package last updated on 02 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc