Total Pageviews

Monday 22 April 2024

mpegts.js

 npm

日本語 中文说明

HTML5 MPEG2-TS stream player is written in TypeScript & JavaScript.

mpegts.js is optimized for low-latency live stream playback, such as DVB/ISDB television or surveillance cameras.

This project is based on flv.js.

Overview

mpegts.js works by transmuxing MPEG2-TS stream into ISO BMFF (Fragmented MP4) segments, followed by feeding mp4 segments into an HTML5 <video> element through Media Source Extensions API.

News

  • v1.7.3

    Introduced Enhanced RTMP with HEVC support for FLV.

    Introduced Opus and ATSC AC-3 audio codec support for MPEG-TS.

    Introduced LOAS AAC support for MPEG-TS.

  • v1.7.0

    Introduced H.265/HEVC over MPEG-TS/FLV support.

Demo

http://xqq.github.io/mpegts.js/demo/

demo with aribb24.js

Features

  • Playback for MPEG2-TS stream with H.264/H.265 + AAC codec transported in http(s) or WebSocket
  • Playback for FLV stream with H.264/H.265 + AAC codec transported in http(s) or WebSocket
  • Extremely low latency of less than 1 second in the best case
  • Playback for .m2ts file like BDAV/BDMV with 192 bytes TS packet, or 204 bytes TS packet
  • Support handling dynamic codec parameters change (e.g. video resolution change)
  • Support Chrome, FireFox, Safari, Edge (Old or Chromium) or any Chromium-based browsers
  • Support chasing latency automatically for internal buffer of HTMLMediaElement
  • Low CPU overhead and low memory usage (JS heap takes about 10MiB for each instance)
  • Support extracting PES private data (stream_type=0x06) like ARIB B24 subtitles (with aribb24.js)
  • Support Timed ID3 Metadata (stream_type=0x15) callback (TIMED_ID3_METADATA_ARRIVED)

CORS

If you use standalone video server for MPEG2-TS stream, Access-Control-Allow-Origin header must be configured correctly on video server for cross-origin resource fetching.

See cors.md for more details.

Installation

npm install --save mpegts.js

Build

npm install                 # install dev-dependencies
npm install -g webpack-cli  # install build tool
npm run build               # packaged & minimized js will be emitted in dist folder

cnpm mirror is recommended if you are in Mainland China.

from https://github.com/xqq/mpegts.js

No comments:

Post a Comment