New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

fmp4-concat

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fmp4-concat

A browser library for concatenating multiple FMP4 streams with timeline adjustment

latest
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

fmp4-concat

A browser library for concatenating multiple FMP4 (Fragmented MP4) streams with automatic timeline adjustment.

Features

  • 🎬 Concatenate multiple FMP4 streams seamlessly
  • ⏰ Automatic timeline adjustment using TFDT (Track Fragment Decode Time)
  • 🌐 Browser-optimized with ReadableStream support
  • 📦 Zero dependencies
  • 🔧 TypeScript support

Installation

npm install fmp4-concat

Usage

Basic Example

import { FMP4Concat } from 'fmp4-concat';

// Create a new FMP4Concat instance
const concat = new FMP4Concat();

// Prepare your FMP4 streams (ReadableStream<Uint8Array>[])
const streams = [stream1, stream2, stream3];

// Concatenate the streams
const concatenatedStream = concat.concat(streams);

// Use the concatenated stream
const reader = concatenatedStream.getReader();
while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  // Process the concatenated FMP4 data
  processData(value);
}

Advanced Usage with MP4Parser

import { FMP4Concat, MP4Parser } from 'fmp4-concat';

const parser = new MP4Parser();
const concat = new FMP4Concat();

// Parse MP4 boxes for debugging or analysis
const boxInfo = parser.parseBox(uint8ArrayData, 0);
console.log('Box type:', boxInfo.type);
console.log('Box size:', boxInfo.size);

// Then concatenate your streams
const result = concat.concat(streams);

API Reference

FMP4Concat

concat(streams: ReadableStream<Uint8Array>[]): ReadableStream<Uint8Array>

Concatenates multiple FMP4 streams with automatic timeline adjustment.

Parameters:

  • streams - Array of ReadableStream containing FMP4 data

Returns:

  • ReadableStream<Uint8Array> - Concatenated FMP4 stream

MP4Parser

parseBox(buffer: Uint8Array, offset: number): BoxInfo

Parses an MP4 box from a buffer.

Parameters:

  • buffer - Uint8Array containing MP4 data
  • offset - Starting position in the buffer

Returns:

  • BoxInfo - Information about the parsed box

Types

interface BoxInfo {
  type: string;
  size: number;
  // ... other box properties
}

interface MoofInfo {
  // Movie fragment information
}

interface TracKInfo {
  // Track information
}

License

MIT License - see the LICENSE file for details.

Author

Suemor

Keywords

fmp4

FAQs

Package last updated on 21 Aug 2025

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