RepositoryTypeScriptCNChina
goldvideo

goldvideo/demuxer

A tool for demux ts/mp4/flv by typescript. Support HEVC/AVC/AAC codec. https://goldvideo.github.io/demuxer/

202stars
36forks
6issues
2views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: aac

#1 Repository of the month

1
TINIX TRENDING·Topic: mp4

#1 Repository of the month

1
TINIX TRENDING·Topic: hevc

#1 Repository of the month

A tool for demux ts/mp4/flv.

This tool can be used on platforms such as HTML5 players or Node.js

npm version Downloads Build Status TypeScript

Demos

Data flow diagram

Feature

  • Support push streaming-data to demux

  • Tree-shakable (The version coded with full code does not need to worry about the reference size. When the business only refers to a certain format of decoding, the overall code supports tree-shaking)

  • Any-combination packaging (These formats can be packaged according to requirements, users do not need to package all the code)

How to start?

  1. install

    npm i demuxer
    
  2. Setup

    import { TSDemux, FLVDemux, MP4Demux, Events } from 'demuxer';
    
    const demux = new TSDemux();
    // const demux = new FLVDemux();
    // const demux = new MP4Demux();
    
    // The data is spit out in a streaming manner,
    // and the first data is emitted as soon as possible.
    demux.on(Events.DEMUX_DATA, (e) => {
      console.log(e);
    
      // if (e.stream_type === 15) {
      //     console.log(e)
      // }
    });
    
    demux.on(Events.DONE, (e) => {
      // consumed & flushed all piped buffer.
    });
    
    // buffer -> video bytes ArrayBuffer
    demux.push(buffer, {
      // Support push part of the data for parsing
      // When done is set to true, if the data is decoded and there is no remaining data, the data is considered to have been pushed and Events.DONE will be emitted.
      // When done is set to false, Events.DONE will not be emit, waiting for subsequent data push
      done: true
    });
    
  3. Debug

    var demuxer = new TSDemux({
        debug: true
    });
    
  4. Demuxer Options

    let options = {
        // Setting options.debug = true; will turn on debug logs on JS console.
        debug: true
    };
    
    var demuxer = new TSDemux(options);
    // var demuxer = new MP4Demux(options);
    // var demuxer = new FLVDemux(options);
    

About decoding MP4 raw data (h264/hevc/aac)

Developer should parse the data of the mp4 header, and then locate the pos of the data information in the mdat according to the information described in the mp4 header.

About how to integrate Demuxer with Worker

Because the third party is likely to be internally built by the worker tool, in order not to conflict and redundancy with the worker tool, the worker is implemented by the user.

Lang

中文文档

LICENSE

MIT

Similar Projects

Discover other similar projects and AI models.

RepositoryC++
axiomatic-systems/Bento4

Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools

2.5k
Nov 22, 2026
RepositoryJavaScript
numberwolf/h265web.js

https://h265web.com 🔥 作者:常炎隆(Author: ChangYanlong):HEVC/H.265 网页直播/点播播放器 支持硬解! 支持H.265的HttpFLV/HLS/MP4/TS/FLV/M3U8/Websocket/WebRTC/VR360播放。 🔥 A HEVC/H.265 Web Player, Support hard-decoding! for LIVE/VOD stream. Support H.265 Codec with HttpFLV/HLS/MP4/TS/FLV/M3U8/Websocket/WebRTC/VR360.

2.4k
Oct 28, 2026
RepositoryJavaScript
Ezviz-OpenBiz/EZUIKit-JavaScript-npm

轻应用npm版本,降低接入难度,适配自定义UI,适配主流框架

321
Nov 21, 2026
RepositoryC
ireader/media-server

RTSP/RTP/RTMP/FLV/HLS/MPEG-TS/MPEG-PS/MPEG-DASH/MP4/fMP4/MKV/WebM

3.5k
Oct 10, 2026
RepositoryHTML
krzemienski/awesome-video

A curated list of awesome streaming video tools, frameworks, libraries, and learning resources.

2.0k
Oct 25, 2026
RepositorySwift
sunlubo/SwiftFFmpeg

A Swift wrapper for the FFmpeg API

651
Nov 14, 2026
RepositoryJavaScript
webstream-labs/jmuxer

jMuxer - a simple javascript mp4 muxer that works in both browser and node environment.

648
Nov 5, 2026
RepositoryC
fzwoch/obs-vaapi

OBS Studio VAAPI support via GStreamer

148
Nov 13, 2026
RepositoryC
FFmpeg/FFmpeg

Mirror of https://git.ffmpeg.org/ffmpeg.git

68.4k
Nov 29, 2026