jmuxer 2.0.7 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -33
- package/dist/jmuxer.min.js +3416 -1
- package/package.json +11 -6
- package/src/controller/remux.js +63 -46
- package/src/jmuxer.js +39 -144
- package/src/parsers/aac.js +11 -38
- package/src/parsers/h264.js +101 -96
- package/src/parsers/h265.js +303 -0
- package/src/remuxer/aac.js +63 -7
- package/src/remuxer/base.js +2 -1
- package/src/remuxer/h264.js +163 -7
- package/src/remuxer/h265.js +288 -0
- package/src/util/debug.js +3 -3
- package/src/util/event.js +2 -2
- package/src/util/mp4-generator.js +124 -9
- package/loader-thumb.jpg +0 -0
- package/packet-format.png +0 -0
- package/src/util/nalu.js +0 -72
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[](https://travis-ci.org/samirkumardas/jmuxer)
|
|
2
|
-

|
|
3
3
|

|
|
4
4
|
|
|
5
5
|
jMuxer
|
|
@@ -28,6 +28,8 @@ Available options are:
|
|
|
28
28
|
|
|
29
29
|
*mode* - Available values are: both, video and audio. Default is both
|
|
30
30
|
|
|
31
|
+
*videoCodec* - Either H264 or H265 (browser must support H265 to work). Default is H264
|
|
32
|
+
|
|
31
33
|
*flushingTime* - Buffer flushing time in milliseconds. Default value is 500 milliseconds. Set `flushingTime` to 0 if you want to flash buffer immediately or find any lag.
|
|
32
34
|
|
|
33
35
|
*maxDelay* - Maximum delay time in milliseconds. Default value is 500 milliseconds.
|
|
@@ -44,12 +46,20 @@ Available options are:
|
|
|
44
46
|
|
|
45
47
|
*onError* - function. Will be fired if jMuxer encounters any buffer related errors.
|
|
46
48
|
|
|
49
|
+
*onUnsupportedCodec* - function. Will be fired when trying to play a codec that is not supported by the browser.
|
|
50
|
+
|
|
47
51
|
*onMissingVideoFrames* - function. Will be fired if jMuxer encounters any missing video frames.
|
|
48
52
|
|
|
49
53
|
*onMissingAudioFrames* - function. Will be fired if jMuxer encounters any missing audio frames.
|
|
50
54
|
|
|
55
|
+
*onKeyframePosition* - function. Will be fired when a keyframe is detected thus the provided time is seekable.
|
|
56
|
+
|
|
51
57
|
*debug* - true/false. Will print debug log in browser console. Default is false.
|
|
52
58
|
|
|
59
|
+
*onLoggerLog* - function. When debug enabled, will be called to log basic information. Defaults to console.log
|
|
60
|
+
|
|
61
|
+
*onLoggerErr* - function. When debug enabled, will be called to log errors information. Defaults to console.error
|
|
62
|
+
|
|
53
63
|
**Complete example:**
|
|
54
64
|
|
|
55
65
|
```html
|
|
@@ -78,7 +88,7 @@ Available options are:
|
|
|
78
88
|
|
|
79
89
|
Media dataObject may have following properties:
|
|
80
90
|
|
|
81
|
-
*video* - h264 buffer
|
|
91
|
+
*video* - h264/h265 buffer
|
|
82
92
|
|
|
83
93
|
*audio* - AAC buffer
|
|
84
94
|
|
|
@@ -178,39 +188,20 @@ jmuxer.feed({
|
|
|
178
188
|
|
|
179
189
|
Demo Server and player example
|
|
180
190
|
-----------
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
2. Extracting h264 for all chunks: `for f in *.mp4; do ffmpeg -i "$f" -vcodec copy -an -bsf:v h264_mp4toannexb "${f:0:3}.h264"; done`
|
|
192
|
-
3. Extracting audio for all chunks: `for f in *.mp4; do ffmpeg -i "$f" -acodec copy -vn "${f:0:3}.aac"; done`
|
|
193
|
-
4. Extracting duration for all chunks: `for f in *.mp4; do ffprobe "$f" -show_format 2>&1 | sed -n 's/duration=//p'; done`
|
|
194
|
-
|
|
195
|
-
(see https://github.com/samirkumardas/jmuxer/issues/20#issuecomment-470855007)
|
|
196
|
-
|
|
197
|
-
**How to run example?**
|
|
198
|
-
|
|
199
|
-
Demo files are available in example directory. For running the example, first run the node server by following command:
|
|
200
|
-
|
|
201
|
-
*cd example*
|
|
202
|
-
|
|
203
|
-
*node server.js*
|
|
204
|
-
|
|
205
|
-
then, visit *example/index.html* page using any webserver.
|
|
206
|
-
|
|
207
|
-
Player Example for raw h264 only
|
|
208
|
-
-----------
|
|
209
|
-
Assuming you are still in `example` directory. Now run followngs:
|
|
191
|
+
Two demos are given:
|
|
192
|
+
1. Raw chunks from server, client does the muxing
|
|
193
|
+
2. Muxed by server, fMP4 streamed from server
|
|
194
|
+
|
|
195
|
+
To try them both, in the root directory run
|
|
196
|
+
```bash
|
|
197
|
+
npm i
|
|
198
|
+
npm run dev
|
|
199
|
+
```
|
|
200
|
+
then navigate to `http://localhost:8080/
|
|
210
201
|
|
|
211
|
-
|
|
202
|
+
You can read further details on how they work in `example/server.mjs`.
|
|
212
203
|
|
|
213
|
-
|
|
204
|
+
To generate the segments for the last demo, you can use the bash script in the chunks folder.
|
|
214
205
|
|
|
215
206
|
How to build?
|
|
216
207
|
---------
|