🚀 DAY 4 OF LAUNCH WEEK:Introducing Socket Scanning for OpenVSX Extensions.Learn more →
Socket
Book a DemoInstallSign in
Socket

@gumlet/video-manifest-parser

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gumlet/video-manifest-parser

A TypeScript package for manipulating MPD and M3U8 manifests

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
2
Created
Source

Test Status

Manifest Editor

A TypeScript library for manipulating MPD (MPEG-DASH) and M3U8 (HLS) manifest files.

Features

  • Parse and modify MPD (MPEG-DASH) manifests
  • Parse and modify M3U8 (HLS) playlists
  • Support for multiple media types (video, audio, subtitles)
  • Automatic ID generation for new elements
  • Type-safe API with TypeScript interfaces

Installation

npm install @gumlet/video-manifest-parser

Usage

MPD Editor

import { MPDEditor } from '@gumlet/video-manifest-parser';

// Parse MPD manifest
const editor = new MPDEditor(mpdString);

// Add new adaptation set
const newAdaptationSet = {
  '@contentType': 'video',
  '@width': '1920',
  '@height': '1080',
  Representation: {
    '@bandwidth': '5000000',
    '@codecs': 'avc1.640028',
    '@mimeType': 'video/mp4'
  }
};

editor.addAdaptationSet(newAdaptationSet);

// Get modified MPD string
const updatedMpd = editor.toString();

M3U8 Editor

import { M3U8Editor } from '@gumlet/video-manifest-parser';

// Parse M3U8 playlist
const editor = new M3U8Editor(m3u8String);

// Add new media stream
const newStream: StreamInfo = {
  bandwidth: 5000000,
  codecs: 'avc1.640028',
  resolution: { width: 1920, height: 1080 },
  frameRate: '30.000'
};

editor.addStream(newStream);

// Get modified M3U8 string
const updatedM3U8 = editor.toString();

API Reference

MPDEditor

interface AdaptationSet {
  '@id': string;
  '@contentType': 'video' | 'audio' | 'text';
  '@lang'?: string;
  Representation: {
    '@id': string;
    '@bandwidth': string;
    '@codecs': string;
    '@mimeType': string;
    '@audioSamplingRate'?: string;
    '@width'?: string;
    '@height'?: string;
  };
}

interface MPD {
  Period: {
    AdaptationSet: AdaptationSet[];
  };
}

M3U8Editor

interface StreamInfo {
  bandwidth: number;
  codecs: string;
  resolution?: { width: number; height: number };
  frameRate?: string;
  videoRange?: string;
  audio?: string;
  subtitles?: string;
  closedCaptions?: string;
}

interface Media {
  type: 'AUDIO' | 'SUBTITLES' | 'CLOSED_CAPTIONS';
  group_id: string;
  language: string;
  name: string;
  uri: string;
  default?: boolean;
  autoselect?: boolean;
  channels?: number;
}

Dependencies

  • fast-xml-parser: For parsing and building MPD XML
  • m3u8-parser: For parsing M3U8 playlists
  • typescript: For type definitions and compilation

Keywords

mpd

FAQs

Package last updated on 18 Jun 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