@remotion/media-parser 4.0.199 → 4.0.201
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/dist/av1-codec-string.d.ts +5 -0
- package/dist/av1-codec-string.js +18 -1
- package/dist/bitstream/av1.d.ts +2 -0
- package/dist/bitstream/av1.js +12 -0
- package/dist/boxes/iso-base-media/avcc-hvcc.d.ts +20 -0
- package/dist/boxes/iso-base-media/avcc-hvcc.js +73 -0
- package/dist/boxes/iso-base-media/avcc.d.ts +18 -0
- package/dist/boxes/iso-base-media/avcc.js +27 -0
- package/dist/boxes/iso-base-media/esds-descriptors.d.ts +21 -0
- package/dist/boxes/iso-base-media/esds-descriptors.js +62 -0
- package/dist/boxes/iso-base-media/esds.d.ts +15 -0
- package/dist/boxes/iso-base-media/esds.js +27 -0
- package/dist/boxes/iso-base-media/mdat/mdat.js +2 -2
- package/dist/boxes/iso-base-media/moov/moov.js +1 -0
- package/dist/boxes/iso-base-media/process-box.d.ts +4 -2
- package/dist/boxes/iso-base-media/process-box.js +56 -40
- package/dist/boxes/iso-base-media/stsd/mebx.d.ts +2 -1
- package/dist/boxes/iso-base-media/stsd/mebx.js +2 -1
- package/dist/boxes/iso-base-media/stsd/samples.js +3 -0
- package/dist/boxes/iso-base-media/stsd/stco.d.ts +3 -2
- package/dist/boxes/iso-base-media/stsd/stco.js +2 -2
- package/dist/boxes/iso-base-media/trak/trak.js +1 -0
- package/dist/boxes/webm/bitstream/av1.js +10 -1
- package/dist/boxes/webm/ebml.d.ts +2 -0
- package/dist/boxes/webm/ebml.js +72 -0
- package/dist/boxes/webm/make-header.d.ts +9 -0
- package/dist/boxes/webm/make-header.js +79 -0
- package/dist/boxes/webm/parse-ebml.d.ts +7 -0
- package/dist/boxes/webm/parse-ebml.js +66 -0
- package/dist/boxes/webm/parse-webm-header.js +8 -9
- package/dist/boxes/webm/segments/all-segments.d.ts +262 -0
- package/dist/boxes/webm/segments/all-segments.js +130 -1
- package/dist/boxes/webm/segments/block-simple-block-flags.d.ts +9 -0
- package/dist/boxes/webm/segments/block-simple-block-flags.js +38 -0
- package/dist/boxes/webm/segments/seek-position.js +1 -1
- package/dist/boxes/webm/segments/seek.d.ts +1 -1
- package/dist/boxes/webm/segments/seek.js +8 -2
- package/dist/boxes/webm/segments/timestamp-scale.js +1 -1
- package/dist/boxes/webm/segments/track-entry.d.ts +25 -9
- package/dist/boxes/webm/segments/track-entry.js +73 -33
- package/dist/boxes/webm/segments.d.ts +3 -3
- package/dist/boxes/webm/segments.js +64 -30
- package/dist/boxes/webm/traversal.d.ts +1 -0
- package/dist/boxes/webm/traversal.js +12 -1
- package/dist/buffer-iterator.d.ts +10 -6
- package/dist/buffer-iterator.js +92 -9
- package/dist/from-fetch.js +13 -3
- package/dist/from-input-type-file.d.ts +2 -0
- package/dist/from-input-type-file.js +37 -0
- package/dist/from-node.js +9 -2
- package/dist/from-web-file.js +6 -1
- package/dist/from-web.js +15 -6
- package/dist/get-codec.d.ts +4 -0
- package/dist/get-codec.js +22 -0
- package/dist/get-sample-positions.js +1 -1
- package/dist/has-all-info.js +1 -1
- package/dist/options.d.ts +3 -2
- package/dist/parse-media.js +13 -9
- package/dist/parse-video.js +16 -0
- package/dist/parser-state.d.ts +8 -9
- package/dist/parser-state.js +39 -19
- package/dist/reader.d.ts +1 -1
- package/dist/web-file.d.ts +2 -0
- package/dist/web-file.js +37 -0
- package/dist/webcodec-sample-types.d.ts +0 -1
- package/package.json +2 -2
- package/src/boxes/iso-base-media/mdat/mdat.ts +2 -2
- package/src/boxes/iso-base-media/moov/moov.ts +1 -0
- package/src/boxes/iso-base-media/process-box.ts +70 -40
- package/src/boxes/iso-base-media/stsd/mebx.ts +3 -0
- package/src/boxes/iso-base-media/stsd/samples.ts +3 -0
- package/src/boxes/iso-base-media/stsd/stco.ts +5 -3
- package/src/boxes/iso-base-media/trak/trak.ts +1 -0
- package/src/boxes/webm/ebml.ts +78 -0
- package/src/boxes/webm/make-header.ts +138 -0
- package/src/boxes/webm/parse-ebml.ts +93 -0
- package/src/boxes/webm/parse-webm-header.ts +8 -12
- package/src/boxes/webm/segments/all-segments.ts +226 -0
- package/src/boxes/webm/segments/block-simple-block-flags.ts +52 -0
- package/src/boxes/webm/segments/seek-position.ts +1 -1
- package/src/boxes/webm/segments/seek.ts +12 -2
- package/src/boxes/webm/segments/timestamp-scale.ts +1 -1
- package/src/boxes/webm/segments/track-entry.ts +125 -41
- package/src/boxes/webm/segments.ts +107 -40
- package/src/boxes/webm/traversal.ts +13 -0
- package/src/buffer-iterator.ts +110 -10
- package/src/from-fetch.ts +22 -3
- package/src/from-node.ts +18 -4
- package/src/from-web-file.ts +11 -1
- package/src/get-sample-positions.ts +1 -1
- package/src/has-all-info.ts +1 -1
- package/src/options.ts +3 -2
- package/src/parse-media.ts +14 -8
- package/src/parse-video.ts +17 -0
- package/src/parser-state.ts +52 -25
- package/src/reader.ts +1 -0
- package/src/test/create-matroska.test.ts +48 -0
- package/src/test/matroska.test.ts +144 -127
- package/src/test/parse-stco.test.ts +2 -0
- package/src/test/stream-local.test.ts +70 -14
- package/src/test/stream-remote.test.ts +23 -19
- package/src/test/stsd.test.ts +2 -0
- package/src/webcodec-sample-types.ts +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/boxes/iso-base-media/ftype.d.ts +0 -9
- package/dist/boxes/iso-base-media/ftype.js +0 -31
- package/dist/get-video-metadata.d.ts +0 -2
- package/dist/get-video-metadata.js +0 -44
- package/dist/read-and-increment-offset.d.ts +0 -28
- package/dist/read-and-increment-offset.js +0 -177
- package/dist/understand-vorbis.d.ts +0 -1
- package/dist/understand-vorbis.js +0 -12
- package/src/boxes/webm/segments/unknown.ts +0 -19
- /package/dist/{boxes/webm/bitstream/av1/frame.d.ts → get-samples.d.ts} +0 -0
- /package/dist/{boxes/webm/bitstream/av1/frame.js → get-samples.js} +0 -0
- /package/dist/{boxes/webm/bitstream/h264/get-h264-descriptor.d.ts → sample-aspect-ratio.d.ts} +0 -0
- /package/dist/{boxes/webm/bitstream/h264/get-h264-descriptor.js → sample-aspect-ratio.js} +0 -0
|
@@ -23,6 +23,47 @@ test('Should get duration of AV1 video', async () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
expect(parsed.boxes).toEqual([
|
|
26
|
+
{
|
|
27
|
+
hex: '0x1a45dfa3',
|
|
28
|
+
type: 'Header',
|
|
29
|
+
value: [
|
|
30
|
+
{
|
|
31
|
+
hex: '0x4286',
|
|
32
|
+
type: 'EBMLVersion',
|
|
33
|
+
value: 1,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
hex: '0x42f7',
|
|
37
|
+
type: 'EBMLReadVersion',
|
|
38
|
+
value: 1,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
hex: '0x42f2',
|
|
42
|
+
type: 'EBMLMaxIDLength',
|
|
43
|
+
value: 4,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
hex: '0x42f3',
|
|
47
|
+
type: 'EBMLMaxSizeLength',
|
|
48
|
+
value: 8,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
hex: '0x4282',
|
|
52
|
+
type: 'DocType',
|
|
53
|
+
value: 'webm',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
hex: '0x4287',
|
|
57
|
+
type: 'DocTypeVersion',
|
|
58
|
+
value: 2,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
hex: '0x4285',
|
|
62
|
+
type: 'DocTypeReadVersion',
|
|
63
|
+
value: 2,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
26
67
|
{
|
|
27
68
|
type: 'main-segment',
|
|
28
69
|
children: [
|
|
@@ -193,285 +234,261 @@ test('Should get duration of AV1 video', async () => {
|
|
|
193
234
|
timestamp: 0,
|
|
194
235
|
},
|
|
195
236
|
{
|
|
196
|
-
type: 'simple-block-segment',
|
|
237
|
+
type: 'simple-block-or-block-segment',
|
|
197
238
|
length: 279307,
|
|
198
239
|
trackNumber: 1,
|
|
199
|
-
|
|
200
|
-
headerFlags: 128,
|
|
240
|
+
timecodeInMicroseconds: 0,
|
|
201
241
|
keyframe: true,
|
|
202
|
-
lacing:
|
|
242
|
+
lacing: 0,
|
|
203
243
|
invisible: false,
|
|
204
|
-
|
|
244
|
+
videoSample: null,
|
|
205
245
|
},
|
|
206
246
|
{
|
|
207
|
-
type: 'simple-block-segment',
|
|
247
|
+
type: 'simple-block-or-block-segment',
|
|
208
248
|
length: 96,
|
|
209
249
|
trackNumber: 1,
|
|
210
|
-
|
|
211
|
-
headerFlags: 0,
|
|
250
|
+
timecodeInMicroseconds: 40000,
|
|
212
251
|
keyframe: false,
|
|
213
|
-
lacing:
|
|
252
|
+
lacing: 0,
|
|
214
253
|
invisible: false,
|
|
215
|
-
|
|
254
|
+
videoSample: null,
|
|
216
255
|
},
|
|
217
256
|
{
|
|
218
|
-
type: 'simple-block-segment',
|
|
257
|
+
type: 'simple-block-or-block-segment',
|
|
219
258
|
length: 556,
|
|
220
259
|
trackNumber: 1,
|
|
221
|
-
|
|
222
|
-
headerFlags: 0,
|
|
260
|
+
timecodeInMicroseconds: 80000,
|
|
223
261
|
keyframe: false,
|
|
224
|
-
lacing:
|
|
262
|
+
lacing: 0,
|
|
225
263
|
invisible: false,
|
|
226
|
-
|
|
264
|
+
videoSample: null,
|
|
227
265
|
},
|
|
228
266
|
{
|
|
229
|
-
type: 'simple-block-segment',
|
|
267
|
+
type: 'simple-block-or-block-segment',
|
|
230
268
|
length: 948,
|
|
231
269
|
trackNumber: 1,
|
|
232
|
-
|
|
233
|
-
headerFlags: 0,
|
|
270
|
+
timecodeInMicroseconds: 120000,
|
|
234
271
|
keyframe: false,
|
|
235
|
-
lacing:
|
|
272
|
+
lacing: 0,
|
|
236
273
|
invisible: false,
|
|
237
|
-
|
|
274
|
+
videoSample: null,
|
|
238
275
|
},
|
|
239
276
|
{
|
|
240
|
-
type: 'simple-block-segment',
|
|
277
|
+
type: 'simple-block-or-block-segment',
|
|
241
278
|
length: 577,
|
|
242
279
|
trackNumber: 1,
|
|
243
|
-
|
|
244
|
-
headerFlags: 0,
|
|
280
|
+
timecodeInMicroseconds: 160000,
|
|
245
281
|
keyframe: false,
|
|
246
|
-
lacing:
|
|
282
|
+
lacing: 0,
|
|
247
283
|
invisible: false,
|
|
248
|
-
|
|
284
|
+
videoSample: null,
|
|
249
285
|
},
|
|
250
286
|
{
|
|
251
|
-
type: 'simple-block-segment',
|
|
287
|
+
type: 'simple-block-or-block-segment',
|
|
252
288
|
length: 779,
|
|
253
289
|
trackNumber: 1,
|
|
254
|
-
|
|
255
|
-
headerFlags: 0,
|
|
290
|
+
timecodeInMicroseconds: 200000,
|
|
256
291
|
keyframe: false,
|
|
257
|
-
lacing:
|
|
292
|
+
lacing: 0,
|
|
258
293
|
invisible: false,
|
|
259
|
-
|
|
294
|
+
videoSample: null,
|
|
260
295
|
},
|
|
261
296
|
{
|
|
262
|
-
type: 'simple-block-segment',
|
|
297
|
+
type: 'simple-block-or-block-segment',
|
|
263
298
|
length: 793,
|
|
264
299
|
trackNumber: 1,
|
|
265
|
-
|
|
266
|
-
headerFlags: 0,
|
|
300
|
+
timecodeInMicroseconds: 240000,
|
|
267
301
|
keyframe: false,
|
|
268
|
-
lacing:
|
|
302
|
+
lacing: 0,
|
|
269
303
|
invisible: false,
|
|
270
|
-
|
|
304
|
+
videoSample: null,
|
|
271
305
|
},
|
|
272
306
|
{
|
|
273
|
-
type: 'simple-block-segment',
|
|
307
|
+
type: 'simple-block-or-block-segment',
|
|
274
308
|
length: 740,
|
|
275
309
|
trackNumber: 1,
|
|
276
|
-
|
|
277
|
-
headerFlags: 0,
|
|
310
|
+
timecodeInMicroseconds: 280000,
|
|
278
311
|
keyframe: false,
|
|
279
|
-
lacing:
|
|
312
|
+
lacing: 0,
|
|
280
313
|
invisible: false,
|
|
281
|
-
|
|
314
|
+
videoSample: null,
|
|
282
315
|
},
|
|
283
316
|
{
|
|
284
|
-
type: 'simple-block-segment',
|
|
317
|
+
type: 'simple-block-or-block-segment',
|
|
285
318
|
length: 1095,
|
|
286
319
|
trackNumber: 1,
|
|
287
|
-
|
|
288
|
-
headerFlags: 0,
|
|
320
|
+
timecodeInMicroseconds: 320000,
|
|
289
321
|
keyframe: false,
|
|
290
|
-
lacing:
|
|
322
|
+
lacing: 0,
|
|
291
323
|
invisible: false,
|
|
292
|
-
|
|
324
|
+
videoSample: null,
|
|
293
325
|
},
|
|
294
326
|
{
|
|
295
|
-
type: 'simple-block-segment',
|
|
327
|
+
type: 'simple-block-or-block-segment',
|
|
296
328
|
length: 1097,
|
|
297
329
|
trackNumber: 1,
|
|
298
|
-
|
|
299
|
-
headerFlags: 0,
|
|
330
|
+
timecodeInMicroseconds: 360000,
|
|
300
331
|
keyframe: false,
|
|
301
|
-
lacing:
|
|
332
|
+
lacing: 0,
|
|
302
333
|
invisible: false,
|
|
303
|
-
|
|
334
|
+
videoSample: null,
|
|
304
335
|
},
|
|
305
336
|
{
|
|
306
|
-
type: 'simple-block-segment',
|
|
337
|
+
type: 'simple-block-or-block-segment',
|
|
307
338
|
length: 1155,
|
|
308
339
|
trackNumber: 1,
|
|
309
|
-
|
|
310
|
-
headerFlags: 0,
|
|
340
|
+
timecodeInMicroseconds: 400000,
|
|
311
341
|
keyframe: false,
|
|
312
|
-
lacing:
|
|
342
|
+
lacing: 0,
|
|
313
343
|
invisible: false,
|
|
314
|
-
|
|
344
|
+
videoSample: null,
|
|
315
345
|
},
|
|
316
346
|
{
|
|
317
|
-
type: 'simple-block-segment',
|
|
347
|
+
type: 'simple-block-or-block-segment',
|
|
318
348
|
length: 1526,
|
|
319
349
|
trackNumber: 1,
|
|
320
|
-
|
|
321
|
-
headerFlags: 0,
|
|
350
|
+
timecodeInMicroseconds: 440000,
|
|
322
351
|
keyframe: false,
|
|
323
|
-
lacing:
|
|
352
|
+
lacing: 0,
|
|
324
353
|
invisible: false,
|
|
325
|
-
|
|
354
|
+
videoSample: null,
|
|
326
355
|
},
|
|
327
356
|
{
|
|
328
|
-
type: 'simple-block-segment',
|
|
357
|
+
type: 'simple-block-or-block-segment',
|
|
329
358
|
length: 1487,
|
|
330
359
|
trackNumber: 1,
|
|
331
|
-
|
|
332
|
-
headerFlags: 0,
|
|
360
|
+
timecodeInMicroseconds: 480000,
|
|
333
361
|
keyframe: false,
|
|
334
|
-
lacing:
|
|
362
|
+
lacing: 0,
|
|
335
363
|
invisible: false,
|
|
336
|
-
|
|
364
|
+
videoSample: null,
|
|
337
365
|
},
|
|
338
366
|
{
|
|
339
|
-
type: 'simple-block-segment',
|
|
367
|
+
type: 'simple-block-or-block-segment',
|
|
340
368
|
length: 2046,
|
|
341
369
|
trackNumber: 1,
|
|
342
|
-
|
|
343
|
-
headerFlags: 0,
|
|
370
|
+
timecodeInMicroseconds: 520000,
|
|
344
371
|
keyframe: false,
|
|
345
|
-
lacing:
|
|
372
|
+
lacing: 0,
|
|
346
373
|
invisible: false,
|
|
347
|
-
|
|
374
|
+
videoSample: null,
|
|
348
375
|
},
|
|
349
376
|
{
|
|
350
|
-
type: 'simple-block-segment',
|
|
377
|
+
type: 'simple-block-or-block-segment',
|
|
351
378
|
length: 1372,
|
|
352
379
|
trackNumber: 1,
|
|
353
|
-
|
|
354
|
-
headerFlags: 0,
|
|
380
|
+
timecodeInMicroseconds: 560000,
|
|
355
381
|
keyframe: false,
|
|
356
|
-
lacing:
|
|
382
|
+
lacing: 0,
|
|
357
383
|
invisible: false,
|
|
358
|
-
|
|
384
|
+
videoSample: null,
|
|
359
385
|
},
|
|
360
386
|
{
|
|
361
|
-
type: 'simple-block-segment',
|
|
387
|
+
type: 'simple-block-or-block-segment',
|
|
362
388
|
length: 1441,
|
|
363
389
|
trackNumber: 1,
|
|
364
|
-
|
|
365
|
-
headerFlags: 0,
|
|
390
|
+
timecodeInMicroseconds: 600000,
|
|
366
391
|
keyframe: false,
|
|
367
|
-
lacing:
|
|
392
|
+
lacing: 0,
|
|
368
393
|
invisible: false,
|
|
369
|
-
|
|
394
|
+
videoSample: null,
|
|
370
395
|
},
|
|
371
396
|
{
|
|
372
|
-
type: 'simple-block-segment',
|
|
397
|
+
type: 'simple-block-or-block-segment',
|
|
373
398
|
length: 2947,
|
|
374
399
|
trackNumber: 1,
|
|
375
|
-
|
|
376
|
-
headerFlags: 0,
|
|
400
|
+
timecodeInMicroseconds: 640000,
|
|
377
401
|
keyframe: false,
|
|
378
|
-
lacing:
|
|
402
|
+
lacing: 0,
|
|
379
403
|
invisible: false,
|
|
380
|
-
|
|
404
|
+
videoSample: null,
|
|
381
405
|
},
|
|
382
406
|
{
|
|
383
|
-
type: 'simple-block-segment',
|
|
407
|
+
type: 'simple-block-or-block-segment',
|
|
384
408
|
length: 2652,
|
|
385
409
|
trackNumber: 1,
|
|
386
|
-
|
|
387
|
-
headerFlags: 0,
|
|
410
|
+
timecodeInMicroseconds: 680000,
|
|
388
411
|
keyframe: false,
|
|
389
|
-
lacing:
|
|
412
|
+
lacing: 0,
|
|
390
413
|
invisible: false,
|
|
391
|
-
|
|
414
|
+
videoSample: null,
|
|
392
415
|
},
|
|
393
416
|
{
|
|
394
|
-
type: 'simple-block-segment',
|
|
417
|
+
type: 'simple-block-or-block-segment',
|
|
395
418
|
length: 4199,
|
|
396
419
|
trackNumber: 1,
|
|
397
|
-
|
|
398
|
-
headerFlags: 0,
|
|
420
|
+
timecodeInMicroseconds: 720000,
|
|
399
421
|
keyframe: false,
|
|
400
|
-
lacing:
|
|
422
|
+
lacing: 0,
|
|
401
423
|
invisible: false,
|
|
402
|
-
|
|
424
|
+
videoSample: null,
|
|
403
425
|
},
|
|
404
426
|
{
|
|
405
|
-
type: 'simple-block-segment',
|
|
427
|
+
type: 'simple-block-or-block-segment',
|
|
406
428
|
length: 3998,
|
|
407
429
|
trackNumber: 1,
|
|
408
|
-
|
|
409
|
-
headerFlags: 0,
|
|
430
|
+
timecodeInMicroseconds: 760000,
|
|
410
431
|
keyframe: false,
|
|
411
|
-
lacing:
|
|
432
|
+
lacing: 0,
|
|
412
433
|
invisible: false,
|
|
413
|
-
|
|
434
|
+
videoSample: null,
|
|
414
435
|
},
|
|
415
436
|
{
|
|
416
|
-
type: 'simple-block-segment',
|
|
437
|
+
type: 'simple-block-or-block-segment',
|
|
417
438
|
length: 6373,
|
|
418
439
|
trackNumber: 1,
|
|
419
|
-
|
|
420
|
-
headerFlags: 0,
|
|
440
|
+
timecodeInMicroseconds: 800000,
|
|
421
441
|
keyframe: false,
|
|
422
|
-
lacing:
|
|
442
|
+
lacing: 0,
|
|
423
443
|
invisible: false,
|
|
424
|
-
|
|
444
|
+
videoSample: null,
|
|
425
445
|
},
|
|
426
446
|
{
|
|
427
|
-
type: 'simple-block-segment',
|
|
447
|
+
type: 'simple-block-or-block-segment',
|
|
428
448
|
length: 5955,
|
|
429
449
|
trackNumber: 1,
|
|
430
|
-
|
|
431
|
-
headerFlags: 0,
|
|
450
|
+
timecodeInMicroseconds: 840000,
|
|
432
451
|
keyframe: false,
|
|
433
|
-
lacing:
|
|
452
|
+
lacing: 0,
|
|
434
453
|
invisible: false,
|
|
435
|
-
|
|
454
|
+
videoSample: null,
|
|
436
455
|
},
|
|
437
456
|
{
|
|
438
|
-
type: 'simple-block-segment',
|
|
457
|
+
type: 'simple-block-or-block-segment',
|
|
439
458
|
length: 7943,
|
|
440
459
|
trackNumber: 1,
|
|
441
|
-
|
|
442
|
-
headerFlags: 0,
|
|
460
|
+
timecodeInMicroseconds: 880000,
|
|
443
461
|
keyframe: false,
|
|
444
|
-
lacing:
|
|
462
|
+
lacing: 0,
|
|
445
463
|
invisible: false,
|
|
446
|
-
|
|
464
|
+
videoSample: null,
|
|
447
465
|
},
|
|
448
466
|
{
|
|
449
|
-
type: 'simple-block-segment',
|
|
467
|
+
type: 'simple-block-or-block-segment',
|
|
450
468
|
length: 8241,
|
|
451
469
|
trackNumber: 1,
|
|
452
|
-
|
|
453
|
-
headerFlags: 0,
|
|
470
|
+
timecodeInMicroseconds: 920000,
|
|
454
471
|
keyframe: false,
|
|
455
|
-
lacing:
|
|
472
|
+
lacing: 0,
|
|
456
473
|
invisible: false,
|
|
457
|
-
|
|
474
|
+
videoSample: null,
|
|
458
475
|
},
|
|
459
476
|
{
|
|
460
|
-
type: 'simple-block-segment',
|
|
477
|
+
type: 'simple-block-or-block-segment',
|
|
461
478
|
length: 9506,
|
|
462
479
|
trackNumber: 1,
|
|
463
|
-
|
|
464
|
-
headerFlags: 0,
|
|
480
|
+
timecodeInMicroseconds: 960000,
|
|
465
481
|
keyframe: false,
|
|
466
|
-
lacing:
|
|
482
|
+
lacing: 0,
|
|
467
483
|
invisible: false,
|
|
468
|
-
|
|
484
|
+
videoSample: null,
|
|
469
485
|
},
|
|
470
486
|
],
|
|
471
487
|
},
|
|
472
488
|
{
|
|
473
|
-
|
|
474
|
-
type: '
|
|
489
|
+
hex: '0x1c53bb6b',
|
|
490
|
+
type: 'Cues',
|
|
491
|
+
value: undefined,
|
|
475
492
|
},
|
|
476
493
|
],
|
|
477
494
|
},
|
|
@@ -18,6 +18,7 @@ test('Parse stco box', () => {
|
|
|
18
18
|
iterator,
|
|
19
19
|
size: buf.length - 8,
|
|
20
20
|
offset: 0,
|
|
21
|
+
mode64Bit: false,
|
|
21
22
|
});
|
|
22
23
|
expect(result).toEqual({
|
|
23
24
|
type: 'stco-box',
|
|
@@ -46,6 +47,7 @@ test('Parse stco box with empty chunk', () => {
|
|
|
46
47
|
iterator,
|
|
47
48
|
size: buf.length - 8,
|
|
48
49
|
offset: 0,
|
|
50
|
+
mode64Bit: false,
|
|
49
51
|
});
|
|
50
52
|
expect(result).toEqual({
|
|
51
53
|
type: 'stco-box',
|
|
@@ -18,7 +18,7 @@ test('Should stream ISO base media', async () => {
|
|
|
18
18
|
tracks: true,
|
|
19
19
|
dimensions: true,
|
|
20
20
|
rotation: true,
|
|
21
|
-
|
|
21
|
+
unrotatedDimensions: true,
|
|
22
22
|
},
|
|
23
23
|
reader: nodeReader,
|
|
24
24
|
onVideoTrack: (track) => {
|
|
@@ -46,7 +46,7 @@ test('Should stream ISO base media', async () => {
|
|
|
46
46
|
expect(result.videoTracks.length).toBe(1);
|
|
47
47
|
expect(result.videoTracks[0].codec).toBe('hvc1.2.4.L150.b0');
|
|
48
48
|
expect(result.rotation).toBe(-90);
|
|
49
|
-
expect(result.
|
|
49
|
+
expect(result.unrotatedDimensions).toEqual({
|
|
50
50
|
height: 2160,
|
|
51
51
|
width: 3840,
|
|
52
52
|
});
|
|
@@ -248,6 +248,7 @@ test('Should stream ProRes video', async () => {
|
|
|
248
248
|
|
|
249
249
|
test('Should stream variable fps video', async () => {
|
|
250
250
|
let audioTracks = 0;
|
|
251
|
+
let samples = 0;
|
|
251
252
|
const parsed = await parseMedia({
|
|
252
253
|
src: RenderInternals.exampleVideos.variablefps,
|
|
253
254
|
fields: {
|
|
@@ -257,7 +258,7 @@ test('Should stream variable fps video', async () => {
|
|
|
257
258
|
videoCodec: true,
|
|
258
259
|
audioCodec: true,
|
|
259
260
|
rotation: true,
|
|
260
|
-
|
|
261
|
+
unrotatedDimensions: true,
|
|
261
262
|
tracks: true,
|
|
262
263
|
boxes: true,
|
|
263
264
|
},
|
|
@@ -269,15 +270,16 @@ test('Should stream variable fps video', async () => {
|
|
|
269
270
|
expect(track.numberOfChannels).toBe(1);
|
|
270
271
|
expect(track.sampleRate).toBe(48000);
|
|
271
272
|
audioTracks++;
|
|
272
|
-
|
|
273
|
-
|
|
273
|
+
return () => {
|
|
274
|
+
samples++;
|
|
275
|
+
};
|
|
274
276
|
},
|
|
275
277
|
});
|
|
276
278
|
|
|
277
279
|
expect(parsed.dimensions.width).toBe(1280);
|
|
278
280
|
expect(parsed.dimensions.height).toBe(720);
|
|
279
|
-
expect(parsed.
|
|
280
|
-
expect(parsed.
|
|
281
|
+
expect(parsed.unrotatedDimensions.width).toBe(1280);
|
|
282
|
+
expect(parsed.unrotatedDimensions.height).toBe(720);
|
|
281
283
|
expect(parsed.durationInSeconds).toBe(22.901);
|
|
282
284
|
expect(parsed.videoCodec).toBe('vp8');
|
|
283
285
|
expect(parsed.audioCodec).toBe('opus');
|
|
@@ -314,6 +316,7 @@ test('Should stream variable fps video', async () => {
|
|
|
314
316
|
description: undefined,
|
|
315
317
|
});
|
|
316
318
|
expect(audioTracks).toBe(1);
|
|
319
|
+
expect(samples).toBe(381);
|
|
317
320
|
});
|
|
318
321
|
|
|
319
322
|
test('Should stream MKV video', async () => {
|
|
@@ -357,7 +360,7 @@ test('Should stream MKV video', async () => {
|
|
|
357
360
|
|
|
358
361
|
expect(videoSamples).toBe(10);
|
|
359
362
|
expect(audioSamples).toBe(16);
|
|
360
|
-
expect(parsed.internalStats
|
|
363
|
+
expect(parsed.internalStats).toEqual({});
|
|
361
364
|
});
|
|
362
365
|
|
|
363
366
|
test('Should stream MP3 in MP4 video', async () => {
|
|
@@ -410,7 +413,7 @@ test('Should get duration of HEVC video', async () => {
|
|
|
410
413
|
audioCodec: true,
|
|
411
414
|
rotation: true,
|
|
412
415
|
tracks: true,
|
|
413
|
-
|
|
416
|
+
unrotatedDimensions: true,
|
|
414
417
|
videoCodec: true,
|
|
415
418
|
},
|
|
416
419
|
onVideoTrack: () => {
|
|
@@ -434,7 +437,7 @@ test('Should get duration of HEVC video', async () => {
|
|
|
434
437
|
expect(parsed.audioTracks.length).toBe(1);
|
|
435
438
|
expect(parsed.audioTracks[0].codec).toBe('mp4a.40.02');
|
|
436
439
|
expect(parsed.audioTracks[0].description).toEqual(new Uint8Array([18, 16]));
|
|
437
|
-
expect(parsed.
|
|
440
|
+
expect(parsed.unrotatedDimensions).toEqual({
|
|
438
441
|
width: 1920,
|
|
439
442
|
height: 1080,
|
|
440
443
|
});
|
|
@@ -453,7 +456,7 @@ test('Custom DAR', async () => {
|
|
|
453
456
|
tracks: true,
|
|
454
457
|
dimensions: true,
|
|
455
458
|
rotation: true,
|
|
456
|
-
|
|
459
|
+
unrotatedDimensions: true,
|
|
457
460
|
},
|
|
458
461
|
reader: nodeReader,
|
|
459
462
|
});
|
|
@@ -477,7 +480,7 @@ test('Custom DAR', async () => {
|
|
|
477
480
|
expect(parsed.videoTracks[0].codedWidth).toBe(1280);
|
|
478
481
|
expect(parsed.videoTracks[0].codedHeight).toBe(720);
|
|
479
482
|
expect(parsed.rotation).toBe(0);
|
|
480
|
-
expect(parsed.
|
|
483
|
+
expect(parsed.unrotatedDimensions).toEqual({
|
|
481
484
|
height: 720,
|
|
482
485
|
width: 405,
|
|
483
486
|
});
|
|
@@ -660,7 +663,7 @@ test('MP3 in matroska', async () => {
|
|
|
660
663
|
expect(parsed.audioCodec).toEqual('mp3');
|
|
661
664
|
expect(parsed.videoTracks.length).toBe(1);
|
|
662
665
|
expect(parsed.audioTracks.length).toBe(1);
|
|
663
|
-
expect(audioSamples).toBe(
|
|
666
|
+
expect(audioSamples).toBe(140);
|
|
664
667
|
expect(videoSamples).toBe(100);
|
|
665
668
|
});
|
|
666
669
|
|
|
@@ -685,5 +688,58 @@ test('Should stream OPUS', async () => {
|
|
|
685
688
|
|
|
686
689
|
expect(parsed.audioCodec).toEqual('opus');
|
|
687
690
|
expect(parsed.audioTracks.length).toBe(1);
|
|
688
|
-
expect(audioSamples).toBe(
|
|
691
|
+
expect(audioSamples).toBe(167);
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
test('Should stream transparent video', async () => {
|
|
695
|
+
let videoTracks = 0;
|
|
696
|
+
let audioTracks = 0;
|
|
697
|
+
let videoSamples = 0;
|
|
698
|
+
let keyFrames = 0;
|
|
699
|
+
|
|
700
|
+
await parseMedia({
|
|
701
|
+
src: RenderInternals.exampleVideos.transparentwithdar,
|
|
702
|
+
reader: nodeReader,
|
|
703
|
+
onVideoTrack: (track) => {
|
|
704
|
+
expect(track.codedHeight).toBe(512);
|
|
705
|
+
expect(track.codedWidth).toBe(512);
|
|
706
|
+
videoTracks++;
|
|
707
|
+
return (sample) => {
|
|
708
|
+
// https://ffmpeg.org/pipermail/ffmpeg-devel/2015-June/173825.html
|
|
709
|
+
// For Blocks, keyframes is
|
|
710
|
+
// inferred by the absence of ReferenceBlock element (as done by matroskadec).
|
|
711
|
+
if (sample.type === 'key') {
|
|
712
|
+
keyFrames++;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
videoSamples++;
|
|
716
|
+
};
|
|
717
|
+
},
|
|
718
|
+
onAudioTrack: () => {
|
|
719
|
+
audioTracks++;
|
|
720
|
+
return null;
|
|
721
|
+
},
|
|
722
|
+
fields: {
|
|
723
|
+
tracks: true,
|
|
724
|
+
},
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
expect(videoTracks).toBe(1);
|
|
728
|
+
expect(audioTracks).toBe(0);
|
|
729
|
+
expect(videoSamples).toBe(39);
|
|
730
|
+
expect(keyFrames).toBe(1);
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
test('Acknowledge there are .avi file', () => {
|
|
734
|
+
const parsed = parseMedia({
|
|
735
|
+
src: RenderInternals.exampleVideos.avi,
|
|
736
|
+
fields: {
|
|
737
|
+
tracks: true,
|
|
738
|
+
boxes: true,
|
|
739
|
+
},
|
|
740
|
+
reader: nodeReader,
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
expect(parsed).rejects.toThrow('AVI');
|
|
744
|
+
expect(parsed).rejects.toThrow('not yet supported');
|
|
689
745
|
});
|
|
@@ -20,25 +20,29 @@ test('Should stream', async () => {
|
|
|
20
20
|
expect(result.videoCodec).toEqual('h264');
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
test(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
23
|
+
test(
|
|
24
|
+
'Should stream from Wikipedia',
|
|
25
|
+
async () => {
|
|
26
|
+
const result = await parseMedia({
|
|
27
|
+
src: 'https://upload.wikimedia.org/wikipedia/commons/transcoded/c/c0/Big_Buck_Bunny_4K.webm/Big_Buck_Bunny_4K.webm.720p.vp9.webm',
|
|
28
|
+
fields: {
|
|
29
|
+
durationInSeconds: true,
|
|
30
|
+
fps: true,
|
|
31
|
+
dimensions: true,
|
|
32
|
+
videoCodec: true,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
expect(result.durationInSeconds).toBe(634.571);
|
|
36
|
+
// TODO: Not yet implemented
|
|
37
|
+
expect(result.fps).toBe(null);
|
|
38
|
+
expect(result.dimensions).toEqual({
|
|
39
|
+
width: 1280,
|
|
40
|
+
height: 720,
|
|
41
|
+
});
|
|
42
|
+
expect(result.videoCodec).toEqual('vp9');
|
|
43
|
+
},
|
|
44
|
+
{timeout: 10000},
|
|
45
|
+
);
|
|
42
46
|
|
|
43
47
|
test('Should handle redirect', async () => {
|
|
44
48
|
const result = await parseMedia({
|
package/src/test/stsd.test.ts
CHANGED
|
@@ -49,6 +49,7 @@ test('Should be able to parse a STSD audio box correctly', async () => {
|
|
|
49
49
|
parserState: makeParserState({
|
|
50
50
|
hasAudioCallbacks: false,
|
|
51
51
|
hasVideoCallbacks: false,
|
|
52
|
+
signal: undefined,
|
|
52
53
|
}),
|
|
53
54
|
},
|
|
54
55
|
});
|
|
@@ -213,6 +214,7 @@ test('Should be able to parse a STSD video box correctly', async () => {
|
|
|
213
214
|
parserState: makeParserState({
|
|
214
215
|
hasAudioCallbacks: false,
|
|
215
216
|
hasVideoCallbacks: false,
|
|
217
|
+
signal: undefined,
|
|
216
218
|
}),
|
|
217
219
|
},
|
|
218
220
|
});
|