├── .gitignore ├── .npmignore ├── MIT-license.txt ├── NODE.md ├── README.md ├── assets ├── ajax-loader.gif ├── chrome.png ├── firefox.png └── ie10.png ├── browser.js ├── index.html ├── lib ├── async.js └── require.js ├── mpegts_to_mp4 ├── adts.js ├── h264.js ├── index.js ├── mp4.js ├── mpegts.js └── pes.js ├── node.js ├── package.json ├── screenshot.png ├── shim ├── console.time.js └── console.worker.js ├── style.css └── worker.js /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /node_modules 3 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /lib 3 | /shim 4 | /browser.js 5 | /worker.js 6 | *.css 7 | *.png 8 | *.gif 9 | -------------------------------------------------------------------------------- /MIT-license.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright © 2013 Ingvar Stepanyan, http://rreverser.com 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the “Software”), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /NODE.md: -------------------------------------------------------------------------------- 1 | Usage in Node.js 2 | ================ 3 | 4 | Node.js version can be used for conversion of standalone `.ts` files to `.mp4`. 5 | 6 | Using as executable 7 | ------------------- 8 | 9 | ```bash 10 | npm i -g mpegts_to_mp4 11 | mpegts_to_mp4 src.ts dest.mp4 12 | ``` 13 | 14 | Using as module 15 | --------------- 16 | 17 | ```bash 18 | npm i --save mpegts_to_mp4 19 | ``` 20 | 21 | ```javascript 22 | var mpegts_to_mp4 = require('mpegts_to_mp4'); 23 | 24 | mpegts_to_mp4('src.ts', 'dest.mp4', function (err) { 25 | // ... handle success/error ... 26 | }); 27 | // or 28 | var promise = mpegts_to_mp4('src.ts', 'dest.mp4'); 29 | promise.then( 30 | function () { /* handle success */ }, 31 | function (err) { /* handle error */ } 32 | ); 33 | ``` 34 | 35 | Both source and destination can be either string paths or Readable/Writable streams. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | HTTP Live Streaming JavaScript player 2 | ===================================== 3 | [](https://gitter.im/RReverser/mpegts?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | 5 | What's this? 6 | ------------ 7 | This is [Apple HTTP Live Streaming](http://developer.apple.com/streaming/) JavaScript player created by 8 | performing realtime conversion of MPEG-TS video chunks to MPEG-4 in separate thread using 9 | Web Worker and playing them in order in main thread. 10 | 11 | How does it work? 12 | ----------------- 13 | Conversion is done using [jBinary](https://github.com/jDataView/jBinary) binary manipulation library with programmatically described data structures 14 | according to ISO 13818-1, ISO-14496-2, ISO-14496-12 and ITU-T H.222.0 specifications. 15 | 16 | Where does it work? 17 | ------------------- 18 | Works best in Chrome (stable branch), having more noticable lags when switching videos 19 | but still working in latest Firefox versions and IE10+. 20 | 21 | Where I can see that? 22 | --------------------- 23 | Check out [http://rreverser.github.io/mpegts/](http://rreverser.github.io/mpegts/) for live demo. 24 | 25 | Screenshot: 26 | [](http://rreverser.github.io/mpegts/) 27 | 28 | Disclaimer 29 | ---------- 30 | Please note that demo uses 3rd-party HLS demo source and service [http://www.corsproxy.com/](http://www.corsproxy.com/) for proxying it with 31 | needed Cross-Origin-Request headers for browsers to allow chunk downloading, so it may be unstable. 32 | 33 | Can I use it in Node.js? 34 | ------------------------ 35 | [Yes, you can.](NODE.md) 36 | 37 | What license is it issued under? 38 | -------------------------------- 39 | It's regular [MIT license](MIT-license.txt). -------------------------------------------------------------------------------- /assets/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RReverser/mpegts/013ff8a03395b2404d3021d4b84be437ce683f56/assets/ajax-loader.gif -------------------------------------------------------------------------------- /assets/chrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RReverser/mpegts/013ff8a03395b2404d3021d4b84be437ce683f56/assets/chrome.png -------------------------------------------------------------------------------- /assets/firefox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RReverser/mpegts/013ff8a03395b2404d3021d4b84be437ce683f56/assets/firefox.png -------------------------------------------------------------------------------- /assets/ie10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RReverser/mpegts/013ff8a03395b2404d3021d4b84be437ce683f56/assets/ie10.png -------------------------------------------------------------------------------- /browser.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | // requestAnimationFrame polyfill 5 | window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || setTimeout; 6 | 7 | // preconfiguration using 7 | 8 | 9 | 10 | 11 | 12 |
13 |Please note that demo uses 3rd-party HLS demo source and service http://www.corsproxy.com/ for proxying it with needed Cross-Origin-Request headers, so it may be unstable.
35 | 36 | 50 | 51 |