@remotion/media-parser 4.0.192 → 4.0.194

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.
Files changed (77) hide show
  1. package/boxes.json +1 -0
  2. package/dist/boxes/iso-base-media/esds/esds-descriptors.d.ts +21 -0
  3. package/dist/boxes/iso-base-media/esds/esds-descriptors.js +62 -0
  4. package/dist/boxes/iso-base-media/esds/esds.d.ts +15 -0
  5. package/dist/boxes/iso-base-media/esds/esds.js +27 -0
  6. package/dist/boxes/iso-base-media/esds-descriptors.d.ts +21 -0
  7. package/dist/boxes/iso-base-media/esds-descriptors.js +62 -0
  8. package/dist/boxes/iso-base-media/esds.d.ts +15 -0
  9. package/dist/boxes/iso-base-media/esds.js +27 -0
  10. package/dist/boxes/iso-base-media/mdat/mdat.d.ts +12 -0
  11. package/dist/boxes/iso-base-media/mdat/mdat.js +13 -0
  12. package/dist/boxes/iso-base-media/process-box.js +67 -0
  13. package/dist/boxes/iso-base-media/stsd/samples.d.ts +2 -0
  14. package/dist/boxes/iso-base-media/stsd/samples.js +27 -8
  15. package/dist/boxes/iso-base-media/stsd/stco.d.ts +14 -0
  16. package/dist/boxes/iso-base-media/stsd/stco.js +30 -0
  17. package/dist/boxes/iso-base-media/stsd/stsc.d.ts +19 -0
  18. package/dist/boxes/iso-base-media/stsd/stsc.js +34 -0
  19. package/dist/boxes/iso-base-media/stsd/stsz.d.ts +15 -0
  20. package/dist/boxes/iso-base-media/stsd/stsz.js +32 -0
  21. package/dist/boxes/webm/parse-webm-header.js +3 -3
  22. package/dist/boxes/webm/segments/track-entry.d.ts +20 -0
  23. package/dist/boxes/webm/segments/track-entry.js +37 -2
  24. package/dist/boxes/webm/segments.d.ts +2 -2
  25. package/dist/boxes/webm/segments.js +12 -0
  26. package/dist/buffer-iterator.d.ts +3 -1
  27. package/dist/buffer-iterator.js +41 -8
  28. package/dist/from-node.js +12 -4
  29. package/dist/from-web.js +12 -4
  30. package/dist/get-audio-codec.d.ts +4 -0
  31. package/dist/get-audio-codec.js +106 -0
  32. package/dist/get-dimensions.js +6 -2
  33. package/dist/get-fps.d.ts +1 -0
  34. package/dist/get-fps.js +34 -1
  35. package/dist/get-sample-positions.d.ts +12 -0
  36. package/dist/get-sample-positions.js +25 -0
  37. package/dist/get-samples.d.ts +0 -0
  38. package/dist/get-samples.js +1 -0
  39. package/dist/get-tracks.d.ts +10 -0
  40. package/dist/get-tracks.js +66 -0
  41. package/dist/get-video-codec.js +3 -0
  42. package/dist/has-all-info.d.ts +1 -1
  43. package/dist/has-all-info.js +4 -0
  44. package/dist/options.d.ts +7 -3
  45. package/dist/parse-media.js +37 -9
  46. package/dist/parse-result.d.ts +3 -1
  47. package/dist/parse-video.d.ts +1 -0
  48. package/dist/parse-video.js +1 -0
  49. package/dist/reader.d.ts +5 -1
  50. package/dist/traversal.d.ts +19 -0
  51. package/dist/traversal.js +88 -0
  52. package/package.json +2 -2
  53. package/src/boxes/iso-base-media/esds/esds-descriptors.ts +104 -0
  54. package/src/boxes/iso-base-media/esds/esds.ts +49 -0
  55. package/src/boxes/iso-base-media/process-box.ts +75 -0
  56. package/src/boxes/iso-base-media/stsd/samples.ts +35 -8
  57. package/src/boxes/webm/parse-webm-header.ts +3 -3
  58. package/src/boxes/webm/segments/track-entry.ts +66 -1
  59. package/src/boxes/webm/segments.ts +29 -1
  60. package/src/buffer-iterator.ts +54 -10
  61. package/src/from-node.ts +13 -6
  62. package/src/from-web.ts +14 -4
  63. package/src/get-audio-codec.ts +143 -0
  64. package/src/get-dimensions.ts +11 -4
  65. package/src/get-fps.ts +48 -0
  66. package/src/get-video-codec.ts +4 -0
  67. package/src/has-all-info.ts +14 -2
  68. package/src/options.ts +18 -3
  69. package/src/parse-media.ts +51 -10
  70. package/src/parse-result.ts +4 -1
  71. package/src/parse-video.ts +2 -0
  72. package/src/reader.ts +6 -2
  73. package/src/test/matroska.test.ts +6 -7
  74. package/src/test/parse-esds.test.ts +75 -0
  75. package/src/test/stream-local.test.ts +80 -3
  76. package/src/test/stsd.test.ts +52 -5
  77. package/tsconfig.tsbuildinfo +1 -1
@@ -10,18 +10,26 @@ test('Should stream ISO base media', async () => {
10
10
  durationInSeconds: true,
11
11
  fps: true,
12
12
  videoCodec: true,
13
+ audioCodec: true,
13
14
  },
14
15
  nodeReader,
15
16
  );
16
17
  expect(result.durationInSeconds).toBe(12.568333333333333);
17
18
  expect(result.fps).toBe(29.99602174777881);
18
19
  expect(result.videoCodec).toBe('h265');
20
+ expect(result.audioCodec).toBe('aac');
19
21
  });
20
22
 
21
23
  test('Should stream WebM with no duration', async () => {
22
24
  const result = await parseMedia(
23
25
  RenderInternals.exampleVideos.nofps,
24
- {fps: true, durationInSeconds: true, dimensions: true, videoCodec: true},
26
+ {
27
+ fps: true,
28
+ durationInSeconds: true,
29
+ dimensions: true,
30
+ videoCodec: true,
31
+ audioCodec: true,
32
+ },
25
33
  nodeReader,
26
34
  );
27
35
  expect(result.durationInSeconds).toBe(6.57);
@@ -29,8 +37,9 @@ test('Should stream WebM with no duration', async () => {
29
37
  width: 1470,
30
38
  height: 690,
31
39
  });
32
- expect(result.fps).toBeDefined();
40
+ expect(result.fps).toBe(null);
33
41
  expect(result.videoCodec).toBe('vp8');
42
+ expect(result.audioCodec).toBe(null);
34
43
  });
35
44
 
36
45
  test('Should stream AV1 with no duration', async () => {
@@ -41,6 +50,7 @@ test('Should stream AV1 with no duration', async () => {
41
50
  dimensions: true,
42
51
  fps: true,
43
52
  videoCodec: true,
53
+ audioCodec: true,
44
54
  },
45
55
  nodeReader,
46
56
  );
@@ -52,6 +62,7 @@ test('Should stream AV1 with no duration', async () => {
52
62
  height: 1080,
53
63
  });
54
64
  expect(parsed.videoCodec).toBe('av1');
65
+ expect(parsed.audioCodec).toBe(null);
55
66
  });
56
67
 
57
68
  test('Should stream corrupted video', async () => {
@@ -62,6 +73,7 @@ test('Should stream corrupted video', async () => {
62
73
  dimensions: true,
63
74
  fps: true,
64
75
  videoCodec: true,
76
+ audioCodec: true,
65
77
  },
66
78
  nodeReader,
67
79
  );
@@ -73,6 +85,7 @@ test('Should stream corrupted video', async () => {
73
85
  height: 1080,
74
86
  });
75
87
  expect(parsed.videoCodec).toBe('h264');
88
+ expect(parsed.audioCodec).toBe('aac');
76
89
  });
77
90
 
78
91
  test('Should stream screen recording video', async () => {
@@ -83,6 +96,7 @@ test('Should stream screen recording video', async () => {
83
96
  dimensions: true,
84
97
  fps: true,
85
98
  videoCodec: true,
99
+ audioCodec: true,
86
100
  },
87
101
  nodeReader,
88
102
  );
@@ -94,7 +108,9 @@ test('Should stream screen recording video', async () => {
94
108
  width: 2874,
95
109
  });
96
110
  expect(parsed.videoCodec).toBe('h264');
111
+ expect(parsed.audioCodec).toBe(null);
97
112
  });
113
+
98
114
  test('Should stream ProRes video', async () => {
99
115
  const parsed = await parseMedia(
100
116
  RenderInternals.exampleVideos.prores,
@@ -103,7 +119,7 @@ test('Should stream ProRes video', async () => {
103
119
  dimensions: true,
104
120
  durationInSeconds: true,
105
121
  videoCodec: true,
106
- boxes: true,
122
+ audioCodec: true,
107
123
  },
108
124
  nodeReader,
109
125
  );
@@ -113,4 +129,65 @@ test('Should stream ProRes video', async () => {
113
129
  expect(parsed.dimensions.height).toBe(1080);
114
130
  expect(parsed.durationInSeconds).toBe(0.034);
115
131
  expect(parsed.videoCodec).toBe('prores');
132
+ expect(parsed.audioCodec).toBe('aiff');
133
+ });
134
+
135
+ test('Should stream variable fps video', async () => {
136
+ const parsed = await parseMedia(
137
+ RenderInternals.exampleVideos.variablefps,
138
+ {
139
+ fps: true,
140
+ dimensions: true,
141
+ durationInSeconds: true,
142
+ videoCodec: true,
143
+ audioCodec: true,
144
+ },
145
+ nodeReader,
146
+ );
147
+
148
+ expect(parsed.dimensions.width).toBe(1280);
149
+ expect(parsed.dimensions.height).toBe(720);
150
+ expect(parsed.durationInSeconds).toBe(22.901);
151
+ expect(parsed.videoCodec).toBe('vp8');
152
+ expect(parsed.audioCodec).toBe('opus');
153
+ });
154
+
155
+ test('Should stream MKV video', async () => {
156
+ const parsed = await parseMedia(
157
+ RenderInternals.exampleVideos.matroskaPcm16,
158
+ {
159
+ fps: true,
160
+ dimensions: true,
161
+ durationInSeconds: true,
162
+ videoCodec: true,
163
+ audioCodec: true,
164
+ },
165
+ nodeReader,
166
+ );
167
+
168
+ expect(parsed.dimensions.width).toBe(1080);
169
+ expect(parsed.dimensions.height).toBe(1080);
170
+ expect(parsed.durationInSeconds).toBe(0.333);
171
+ expect(parsed.videoCodec).toBe('h264');
172
+ expect(parsed.audioCodec).toBe('pcm');
173
+ });
174
+
175
+ test('Should stream MP3 in MP4 video', async () => {
176
+ const parsed = await parseMedia(
177
+ RenderInternals.exampleVideos.mp4withmp3,
178
+ {
179
+ fps: true,
180
+ dimensions: true,
181
+ durationInSeconds: true,
182
+ videoCodec: true,
183
+ audioCodec: true,
184
+ },
185
+ nodeReader,
186
+ );
187
+
188
+ expect(parsed.dimensions.width).toBe(1080);
189
+ expect(parsed.dimensions.height).toBe(1080);
190
+ expect(parsed.durationInSeconds).toBe(0.337);
191
+ expect(parsed.videoCodec).toBe('h264');
192
+ expect(parsed.audioCodec).toBe('mp3');
116
193
  });
@@ -60,13 +60,60 @@ test('Should be able to parse a STSD audio box correctly', () => {
60
60
  numberOfChannels: 2,
61
61
  type: 'audio',
62
62
  sampleSize: 16,
63
- compressionId: 65534,
63
+ compressionId: -2,
64
64
  packetSize: 0,
65
- samplesPerPacket: 0,
66
- bitsPerSample: 1,
67
- bytesPerFrame: 0,
68
- bytesPerPacket: 1024,
65
+ samplesPerPacket: 1024,
66
+ bitsPerSample: 2,
67
+ bytesPerFrame: 2,
68
+ bytesPerPacket: 1,
69
69
  sampleRate: 44100,
70
+ children: [
71
+ {
72
+ boxSize: 91,
73
+ boxType: 'wave',
74
+ children: [
75
+ {
76
+ boxSize: 12,
77
+ boxType: 'frma',
78
+ children: [],
79
+ offset: 76,
80
+ type: 'regular-box',
81
+ },
82
+ {
83
+ boxSize: 12,
84
+ boxType: 'mp4a',
85
+ children: [],
86
+ offset: 88,
87
+ type: 'regular-box',
88
+ },
89
+ {
90
+ descriptors: [
91
+ {
92
+ objectTypeIndication: 'aac',
93
+ type: 'decoder-config-descriptor',
94
+ },
95
+ {
96
+ type: 'sl-config-descriptor',
97
+ },
98
+ ],
99
+ esId: 0,
100
+ sizeOfInstance: 34,
101
+ tag: 3,
102
+ type: 'esds-box',
103
+ version: 0,
104
+ },
105
+ {
106
+ boxSize: 8,
107
+ boxType: '\u0000\u0000\u0000\u0000',
108
+ children: [],
109
+ offset: 151,
110
+ type: 'regular-box',
111
+ },
112
+ ],
113
+ offset: 68,
114
+ type: 'regular-box',
115
+ },
116
+ ],
70
117
  },
71
118
  ],
72
119
  });