@remotion/media-parser 4.0.320 → 4.0.322

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.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getActualDecoderParameters = void 0;
4
4
  const aac_codecprivate_1 = require("../../aac-codecprivate");
5
- // Example video: 'https://remotion-assets.s3.eu-central-1.amazonaws.com/example-videos/riverside.mp4';
5
+ // Example video: 'https://pub-646d808d9cb240cea53bedc76dd3cd0c.r2.dev/riverside.mp4';
6
6
  // This video has `numberOfChannels = 2`, but the actual number of channels is `1` according to Codec Private.
7
7
  // Therefore, prioritizing Codec Private over `numberOfChannels`.
8
8
  const getActualDecoderParameters = ({ audioCodec, codecPrivate, numberOfChannels, sampleRate, }) => {
@@ -31,6 +31,7 @@ const calculateJumpMarks = (samplePositionTracks, endOfMdat) => {
31
31
  const jumpMarks = [];
32
32
  const allSamplesSortedByOffset = samplePositionTracks
33
33
  .flat(1)
34
+ .filter((s) => s.track.type === 'audio' || s.track.type === 'video')
34
35
  .sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
35
36
  let indexToVisit = 0;
36
37
  const visited = new Set();
@@ -134,7 +134,7 @@ const parseMdatSection = async (state) => {
134
134
  });
135
135
  }
136
136
  if (samplesWithIndex.track.type === 'video') {
137
- // https://remotion-assets.s3.eu-central-1.amazonaws.com/example-videos/sei_checkpoint.mp4
137
+ // https://pub-646d808d9cb240cea53bedc76dd3cd0c.r2.dev/sei_checkpoint.mp4
138
138
  // Position in file 0x0001aba615
139
139
  // https://github.com/remotion-dev/remotion/issues/4680
140
140
  // In Chrome, we may not treat recovery points as keyframes
@@ -16,9 +16,9 @@ const parseWav = (state) => {
16
16
  if (insideMediaSection === 'in-section') {
17
17
  return (0, parse_media_section_1.parseMediaSection)({ state });
18
18
  }
19
- const type = iterator.getByteString(4, false);
19
+ const type = iterator.getByteString(4, false).toLowerCase();
20
20
  log_1.Log.trace(state.logLevel, `Processing box type ${type}`);
21
- if (type === 'RIFF') {
21
+ if (type === 'riff') {
22
22
  return (0, parse_header_1.parseHeader)({ state });
23
23
  }
24
24
  if (type === 'fmt') {
@@ -27,13 +27,13 @@ const parseWav = (state) => {
27
27
  if (type === 'data') {
28
28
  return (0, parse_data_1.parseData)({ state });
29
29
  }
30
- if (type === 'LIST') {
30
+ if (type === 'list') {
31
31
  return (0, parse_list_1.parseList)({ state });
32
32
  }
33
- if (type === 'id3' || type === 'ID3') {
33
+ if (type === 'id3') {
34
34
  return (0, parse_id3_1.parseId3)({ state });
35
35
  }
36
- if (type === 'JUNK' || type === 'FLLR') {
36
+ if (type === 'junk' || type === 'fllr') {
37
37
  return (0, parse_junk_1.parseJunk)({ state });
38
38
  }
39
39
  if (type === 'fact') {
@@ -11648,7 +11648,7 @@ var calculateJumpMarks = (samplePositionTracks, endOfMdat) => {
11648
11648
  progresses[track[0].track.trackId] = 0;
11649
11649
  }
11650
11650
  const jumpMarks = [];
11651
- const allSamplesSortedByOffset = samplePositionTracks.flat(1).sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11651
+ const allSamplesSortedByOffset = samplePositionTracks.flat(1).filter((s) => s.track.type === "audio" || s.track.type === "video").sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11652
11652
  let indexToVisit = 0;
11653
11653
  const visited = new Set;
11654
11654
  let rollOverToProcess = false;
@@ -15439,9 +15439,9 @@ var parseWav = (state) => {
15439
15439
  if (insideMediaSection === "in-section") {
15440
15440
  return parseMediaSection2({ state });
15441
15441
  }
15442
- const type = iterator.getByteString(4, false);
15442
+ const type = iterator.getByteString(4, false).toLowerCase();
15443
15443
  Log.trace(state.logLevel, `Processing box type ${type}`);
15444
- if (type === "RIFF") {
15444
+ if (type === "riff") {
15445
15445
  return parseHeader({ state });
15446
15446
  }
15447
15447
  if (type === "fmt") {
@@ -15450,13 +15450,13 @@ var parseWav = (state) => {
15450
15450
  if (type === "data") {
15451
15451
  return parseData({ state });
15452
15452
  }
15453
- if (type === "LIST") {
15453
+ if (type === "list") {
15454
15454
  return parseList({ state });
15455
15455
  }
15456
- if (type === "id3" || type === "ID3") {
15456
+ if (type === "id3") {
15457
15457
  return parseId32({ state });
15458
15458
  }
15459
- if (type === "JUNK" || type === "FLLR") {
15459
+ if (type === "junk" || type === "fllr") {
15460
15460
  return parseJunk({ state });
15461
15461
  }
15462
15462
  if (type === "fact") {
@@ -18105,7 +18105,7 @@ var downloadAndParseMedia = async (options) => {
18105
18105
  return returnValue;
18106
18106
  };
18107
18107
  // src/version.ts
18108
- var VERSION = "4.0.320";
18108
+ var VERSION = "4.0.322";
18109
18109
 
18110
18110
  // src/index.ts
18111
18111
  var MediaParserInternals = {
@@ -11733,7 +11733,7 @@ var calculateJumpMarks = (samplePositionTracks, endOfMdat) => {
11733
11733
  progresses[track[0].track.trackId] = 0;
11734
11734
  }
11735
11735
  const jumpMarks = [];
11736
- const allSamplesSortedByOffset = samplePositionTracks.flat(1).sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11736
+ const allSamplesSortedByOffset = samplePositionTracks.flat(1).filter((s) => s.track.type === "audio" || s.track.type === "video").sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11737
11737
  let indexToVisit = 0;
11738
11738
  const visited = new Set;
11739
11739
  let rollOverToProcess = false;
@@ -15170,9 +15170,9 @@ var parseWav = (state) => {
15170
15170
  if (insideMediaSection === "in-section") {
15171
15171
  return parseMediaSection2({ state });
15172
15172
  }
15173
- const type = iterator.getByteString(4, false);
15173
+ const type = iterator.getByteString(4, false).toLowerCase();
15174
15174
  Log.trace(state.logLevel, `Processing box type ${type}`);
15175
- if (type === "RIFF") {
15175
+ if (type === "riff") {
15176
15176
  return parseHeader({ state });
15177
15177
  }
15178
15178
  if (type === "fmt") {
@@ -15181,13 +15181,13 @@ var parseWav = (state) => {
15181
15181
  if (type === "data") {
15182
15182
  return parseData({ state });
15183
15183
  }
15184
- if (type === "LIST") {
15184
+ if (type === "list") {
15185
15185
  return parseList({ state });
15186
15186
  }
15187
- if (type === "id3" || type === "ID3") {
15187
+ if (type === "id3") {
15188
15188
  return parseId32({ state });
15189
15189
  }
15190
- if (type === "JUNK" || type === "FLLR") {
15190
+ if (type === "junk" || type === "fllr") {
15191
15191
  return parseJunk({ state });
15192
15192
  }
15193
15193
  if (type === "fact") {
@@ -11630,7 +11630,7 @@ var calculateJumpMarks = (samplePositionTracks, endOfMdat) => {
11630
11630
  progresses[track[0].track.trackId] = 0;
11631
11631
  }
11632
11632
  const jumpMarks = [];
11633
- const allSamplesSortedByOffset = samplePositionTracks.flat(1).sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11633
+ const allSamplesSortedByOffset = samplePositionTracks.flat(1).filter((s) => s.track.type === "audio" || s.track.type === "video").sort((a, b) => a.samplePosition.offset - b.samplePosition.offset);
11634
11634
  let indexToVisit = 0;
11635
11635
  const visited = new Set;
11636
11636
  let rollOverToProcess = false;
@@ -15039,9 +15039,9 @@ var parseWav = (state) => {
15039
15039
  if (insideMediaSection === "in-section") {
15040
15040
  return parseMediaSection2({ state });
15041
15041
  }
15042
- const type = iterator.getByteString(4, false);
15042
+ const type = iterator.getByteString(4, false).toLowerCase();
15043
15043
  Log.trace(state.logLevel, `Processing box type ${type}`);
15044
- if (type === "RIFF") {
15044
+ if (type === "riff") {
15045
15045
  return parseHeader({ state });
15046
15046
  }
15047
15047
  if (type === "fmt") {
@@ -15050,13 +15050,13 @@ var parseWav = (state) => {
15050
15050
  if (type === "data") {
15051
15051
  return parseData({ state });
15052
15052
  }
15053
- if (type === "LIST") {
15053
+ if (type === "list") {
15054
15054
  return parseList({ state });
15055
15055
  }
15056
- if (type === "id3" || type === "ID3") {
15056
+ if (type === "id3") {
15057
15057
  return parseId32({ state });
15058
15058
  }
15059
- if (type === "JUNK" || type === "FLLR") {
15059
+ if (type === "junk" || type === "fllr") {
15060
15060
  return parseJunk({ state });
15061
15061
  }
15062
15062
  if (type === "fact") {
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.320";
1
+ export declare const VERSION = "4.0.322";
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.0.320';
5
+ exports.VERSION = '4.0.322';
package/package.json CHANGED
@@ -3,15 +3,15 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/media-parser"
4
4
  },
5
5
  "name": "@remotion/media-parser",
6
- "version": "4.0.320",
6
+ "version": "4.0.322",
7
7
  "main": "dist/index.js",
8
8
  "sideEffects": false,
9
9
  "devDependencies": {
10
10
  "@types/wicg-file-system-access": "2023.10.5",
11
11
  "eslint": "9.19.0",
12
12
  "@types/bun": "1.2.8",
13
- "@remotion/example-videos": "4.0.320",
14
- "@remotion/eslint-config-internal": "4.0.320"
13
+ "@remotion/example-videos": "4.0.322",
14
+ "@remotion/eslint-config-internal": "4.0.322"
15
15
  },
16
16
  "publishConfig": {
17
17
  "access": "public"
@@ -1,30 +0,0 @@
1
- import type { BufferIterator } from '../../iterator/buffer-iterator';
2
- import type { BaseBox } from './base-type';
3
- export type ThreeDMatrix = [
4
- number,
5
- number,
6
- number,
7
- number,
8
- number,
9
- number,
10
- number,
11
- number,
12
- number
13
- ];
14
- export interface MvhdBox extends BaseBox {
15
- durationInUnits: number;
16
- durationInSeconds: number;
17
- creationTime: number | null;
18
- modificationTime: number | null;
19
- timeScale: number;
20
- rate: number;
21
- volume: number;
22
- matrix: ThreeDMatrix;
23
- nextTrackId: number;
24
- type: 'mvhd-box';
25
- }
26
- export declare const parseMvhd: ({ iterator, offset, size, }: {
27
- iterator: BufferIterator;
28
- offset: number;
29
- size: number;
30
- }) => MvhdBox;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseMvhd = void 0;
4
- const buffer_iterator_1 = require("../../iterator/buffer-iterator");
5
- const to_date_1 = require("./to-date");
6
- const parseMvhd = ({ iterator, offset, size, }) => {
7
- const version = iterator.getUint8();
8
- // Flags, we discard them
9
- iterator.discard(3);
10
- const creationTime = version === 1 ? iterator.getUint64() : iterator.getUint32();
11
- const modificationTime = version === 1 ? iterator.getUint64() : iterator.getUint32();
12
- const timeScale = iterator.getUint32();
13
- const durationInUnits = version === 1 ? iterator.getUint64() : iterator.getUint32();
14
- const durationInSeconds = Number(durationInUnits) / timeScale;
15
- const rateArray = iterator.getSlice(4);
16
- const rateView = (0, buffer_iterator_1.getArrayBufferIterator)(rateArray, rateArray.length);
17
- const rate = rateView.getInt8() * 10 +
18
- rateView.getInt8() +
19
- rateView.getInt8() * 0.1 +
20
- rateView.getInt8() * 0.01;
21
- const volumeArray = iterator.getSlice(2);
22
- const volumeView = (0, buffer_iterator_1.getArrayBufferIterator)(volumeArray, volumeArray.length);
23
- const volume = volumeView.getInt8() + volumeView.getInt8() * 0.1;
24
- // reserved 16bit
25
- iterator.discard(2);
26
- // reserved 32bit x2
27
- iterator.discard(4);
28
- iterator.discard(4);
29
- // matrix
30
- const matrix = [
31
- iterator.getFixedPointSigned1616Number(),
32
- iterator.getFixedPointSigned1616Number(),
33
- iterator.getFixedPointSigned230Number(),
34
- iterator.getFixedPointSigned1616Number(),
35
- iterator.getFixedPointSigned1616Number(),
36
- iterator.getFixedPointSigned230Number(),
37
- iterator.getFixedPointSigned1616Number(),
38
- iterator.getFixedPointSigned1616Number(),
39
- iterator.getFixedPointSigned230Number(),
40
- ];
41
- // pre-defined
42
- iterator.discard(4 * 6);
43
- // next track id
44
- const nextTrackId = iterator.getUint32();
45
- volumeView.destroy();
46
- const bytesRemaining = size - (iterator.counter.getOffset() - offset);
47
- if (bytesRemaining !== 0) {
48
- throw new Error('expected 0 bytes ' + bytesRemaining);
49
- }
50
- return {
51
- creationTime: (0, to_date_1.toUnixTimestamp)(Number(creationTime)),
52
- modificationTime: (0, to_date_1.toUnixTimestamp)(Number(modificationTime)),
53
- timeScale,
54
- durationInUnits: Number(durationInUnits),
55
- durationInSeconds,
56
- rate,
57
- volume,
58
- matrix: matrix,
59
- nextTrackId,
60
- type: 'mvhd-box',
61
- boxSize: size,
62
- offset,
63
- };
64
- };
65
- exports.parseMvhd = parseMvhd;