@remotion/media-parser 4.0.243 → 4.0.245

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 (89) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/boxes/iso-base-media/ftyp.js +2 -2
  3. package/dist/boxes/iso-base-media/mdat/mdat.js +17 -5
  4. package/dist/boxes/iso-base-media/meta/hdlr.js +1 -1
  5. package/dist/boxes/iso-base-media/meta/ilst.js +1 -1
  6. package/dist/boxes/iso-base-media/parse-icc-profile.js +12 -12
  7. package/dist/boxes/iso-base-media/process-box.js +1 -4
  8. package/dist/boxes/iso-base-media/stsd/colr.js +1 -1
  9. package/dist/boxes/iso-base-media/stsd/keys.js +1 -1
  10. package/dist/boxes/riff/expect-riff-box.js +1 -1
  11. package/dist/boxes/riff/is-movi.js +1 -1
  12. package/dist/boxes/riff/parse-box.js +2 -2
  13. package/dist/boxes/riff/parse-isft.js +1 -1
  14. package/dist/boxes/riff/parse-list-box.js +1 -1
  15. package/dist/boxes/riff/parse-movi.js +1 -1
  16. package/dist/boxes/riff/parse-strf.js +1 -1
  17. package/dist/boxes/riff/parse-strh.js +4 -2
  18. package/dist/boxes/transport-stream/adts-header.d.ts +1 -1
  19. package/dist/boxes/transport-stream/discard-rest-of-packet.d.ts +1 -1
  20. package/dist/boxes/webm/description.js +1 -1
  21. package/dist/boxes/webm/ebml.d.ts +1 -1
  22. package/dist/boxes/webm/make-header.d.ts +3 -3
  23. package/dist/boxes/webm/parse-ebml.js +1 -1
  24. package/dist/boxes/webm/segments/all-segments.d.ts +32 -0
  25. package/dist/boxes/webm/segments/all-segments.js +22 -2
  26. package/dist/buffer-iterator.d.ts +2 -2
  27. package/dist/buffer-iterator.js +8 -2
  28. package/dist/create/iso-base-media/codec-specific/avc1.d.ts +1 -1
  29. package/dist/create/iso-base-media/codec-specific/create-codec-specific-data.d.ts +1 -1
  30. package/dist/create/iso-base-media/codec-specific/mp4a.d.ts +1 -1
  31. package/dist/create/iso-base-media/create-colr.d.ts +1 -1
  32. package/dist/create/iso-base-media/create-ftyp.d.ts +2 -2
  33. package/dist/create/iso-base-media/create-ilst.d.ts +1 -1
  34. package/dist/create/iso-base-media/create-mdia.d.ts +1 -1
  35. package/dist/create/iso-base-media/create-moov.d.ts +1 -1
  36. package/dist/create/iso-base-media/create-mvhd.d.ts +1 -1
  37. package/dist/create/iso-base-media/create-trak.d.ts +1 -1
  38. package/dist/create/iso-base-media/create-udta.d.ts +1 -1
  39. package/dist/create/iso-base-media/create-url.d.ts +1 -1
  40. package/dist/create/iso-base-media/ilst/create-cmt.d.ts +1 -1
  41. package/dist/create/iso-base-media/ilst/create-too.d.ts +1 -1
  42. package/dist/create/iso-base-media/mdia/create-mdhd.d.ts +1 -1
  43. package/dist/create/iso-base-media/mp4-header.d.ts +1 -1
  44. package/dist/create/iso-base-media/primitives.d.ts +13 -13
  45. package/dist/create/iso-base-media/serialize-track.d.ts +1 -1
  46. package/dist/create/iso-base-media/trak/create-tkhd.d.ts +2 -2
  47. package/dist/create/iso-base-media/trak/mdia/create-minf.d.ts +1 -1
  48. package/dist/create/iso-base-media/trak/mdia/minf/create-dinf.d.ts +1 -1
  49. package/dist/create/iso-base-media/trak/mdia/minf/create-smhd.d.ts +1 -1
  50. package/dist/create/iso-base-media/trak/mdia/minf/create-stbl.d.ts +1 -1
  51. package/dist/create/iso-base-media/trak/mdia/minf/create-vmhd.d.ts +1 -1
  52. package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-ctts.d.ts +1 -1
  53. package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-stco.d.ts +1 -1
  54. package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-stsc.d.ts +1 -1
  55. package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-stss.d.ts +1 -1
  56. package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-stsz.d.ts +1 -1
  57. package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-stts.d.ts +1 -1
  58. package/dist/create/iso-base-media/trak/mdia/minf/stbl/stsd/create-avc1.d.ts +1 -1
  59. package/dist/create/iso-base-media/trak/mdia/minf/stbl/stsd/create-avcc.d.ts +1 -1
  60. package/dist/create/iso-base-media/trak/mdia/minf/stbl/stsd/create-pasp.d.ts +1 -1
  61. package/dist/create/iso-base-media/udta/create-meta.d.ts +1 -1
  62. package/dist/create/iso-base-media/udta/meta/create-hdlr.d.ts +1 -1
  63. package/dist/create/matroska/cluster-segment.d.ts +1 -1
  64. package/dist/emit-available-info.js +1 -11
  65. package/dist/esm/index.mjs +69 -53
  66. package/dist/esm/web-fs.mjs +9 -8
  67. package/dist/get-audio-codec.d.ts +1 -1
  68. package/dist/version.d.ts +1 -1
  69. package/dist/version.js +1 -1
  70. package/dist/writers/web-fs.js +9 -8
  71. package/package.json +3 -3
  72. package/dist/boxes/avc/codec-private.d.ts +0 -2
  73. package/dist/boxes/avc/codec-private.js +0 -28
  74. package/dist/errors/detect-file-type.d.ts +0 -1
  75. package/dist/errors/detect-file-type.js +0 -88
  76. package/dist/errors/file-types.d.ts +0 -1
  77. package/dist/errors/file-types.js +0 -88
  78. package/dist/file-types/get-jpeg-dimensions.d.ts +0 -4
  79. package/dist/file-types/get-jpeg-dimensions.js +0 -32
  80. package/dist/file-types.d.ts +0 -1
  81. package/dist/file-types.js +0 -88
  82. package/dist/parser-context.d.ts +0 -10
  83. package/dist/parser-context.js +0 -2
  84. package/dist/probing/detect-file-type.d.ts +0 -1
  85. package/dist/probing/detect-file-type.js +0 -88
  86. package/dist/probing/get-jpeg-dimensions.d.ts +0 -4
  87. package/dist/probing/get-jpeg-dimensions.js +0 -32
  88. package/dist/state/tracks-and-samples.d.ts +0 -0
  89. package/dist/state/tracks-and-samples.js +0 -1
package/LICENSE.md CHANGED
@@ -11,7 +11,7 @@ Depending on the type of your legal entity, you are granted permission to use Re
11
11
 
12
12
  ## Free license
13
13
 
14
- Copyright © 2024 [Remotion](https://www.remotion.dev)
14
+ Copyright © 2025 [Remotion](https://www.remotion.dev)
15
15
 
16
16
  ### Eligibility
17
17
 
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseFtyp = void 0;
4
4
  const parseFtyp = ({ iterator, size, offset, }) => {
5
- const majorBrand = iterator.getByteString(4);
5
+ const majorBrand = iterator.getByteString(4, false);
6
6
  const minorVersion = iterator.getFourByteNumber();
7
7
  const types = (size - iterator.counter.getOffset()) / 4;
8
8
  const compatibleBrands = [];
9
9
  for (let i = 0; i < types; i++) {
10
- compatibleBrands.push(iterator.getByteString(4).trim());
10
+ compatibleBrands.push(iterator.getByteString(4, false).trim());
11
11
  }
12
12
  const offsetAtEnd = iterator.counter.getOffset();
13
13
  return {
@@ -77,7 +77,7 @@ const parseMdat = async ({ data, size, fileOffset, existingBoxes, state, signal,
77
77
  break;
78
78
  }
79
79
  const bytes = data.getSlice(samplesWithIndex.samplePosition.size);
80
- const { cts, dts, duration } = samplesWithIndex.samplePosition;
80
+ const { cts, dts, duration, isKeyframe, offset } = samplesWithIndex.samplePosition;
81
81
  if (samplesWithIndex.track.type === 'audio') {
82
82
  await state.callbacks.onAudioSample(samplesWithIndex.track.trackId, (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
83
83
  data: bytes,
@@ -86,12 +86,24 @@ const parseMdat = async ({ data, size, fileOffset, existingBoxes, state, signal,
86
86
  cts,
87
87
  dts,
88
88
  trackId: samplesWithIndex.track.trackId,
89
- type: samplesWithIndex.samplePosition.isKeyframe ? 'key' : 'delta',
90
- offset: samplesWithIndex.samplePosition.offset,
89
+ type: isKeyframe ? 'key' : 'delta',
90
+ offset,
91
91
  timescale: samplesWithIndex.track.timescale,
92
92
  }, samplesWithIndex.track.timescale));
93
93
  }
94
94
  if (samplesWithIndex.track.type === 'video') {
95
+ // https://remotion-assets.s3.eu-central-1.amazonaws.com/example-videos/sei_checkpoint.mp4
96
+ // Position in file 0x0001aba615
97
+ // https://github.com/remotion-dev/remotion/issues/4680
98
+ // In Chrome, we may not treat recovery points as keyframes
99
+ // otherwise "a keyframe is required after flushing"
100
+ const nalUnitType = bytes[4] & 0b00011111;
101
+ let isRecoveryPoint = false;
102
+ // SEI (Supplemental enhancement information)
103
+ if (nalUnitType === 6) {
104
+ const seiType = bytes[5];
105
+ isRecoveryPoint = seiType === 6;
106
+ }
95
107
  await state.callbacks.onVideoSample(samplesWithIndex.track.trackId, (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
96
108
  data: bytes,
97
109
  timestamp: cts,
@@ -99,8 +111,8 @@ const parseMdat = async ({ data, size, fileOffset, existingBoxes, state, signal,
99
111
  cts,
100
112
  dts,
101
113
  trackId: samplesWithIndex.track.trackId,
102
- type: samplesWithIndex.samplePosition.isKeyframe ? 'key' : 'delta',
103
- offset: samplesWithIndex.samplePosition.offset,
114
+ type: isKeyframe && !isRecoveryPoint ? 'key' : 'delta',
115
+ offset,
104
116
  timescale: samplesWithIndex.track.timescale,
105
117
  }, samplesWithIndex.track.timescale));
106
118
  }
@@ -12,7 +12,7 @@ const parseHdlr = ({ iterator, size, offset, }) => {
12
12
  // predefined
13
13
  iterator.discard(4);
14
14
  // type
15
- const hdlrType = iterator.getByteString(4);
15
+ const hdlrType = iterator.getByteString(4, false);
16
16
  // component manufactor
17
17
  iterator.discard(4);
18
18
  // component flags
@@ -4,7 +4,7 @@ exports.parseIlstBox = void 0;
4
4
  // https://developer.apple.com/documentation/quicktime-file-format/well-known_types
5
5
  const parseFromWellKnownType = (wellKnownType, iterator, size) => {
6
6
  if (wellKnownType === 1) {
7
- const value = iterator.getByteString(size);
7
+ const value = iterator.getByteString(size, false);
8
8
  return { type: 'text', value };
9
9
  }
10
10
  if (wellKnownType === 21) {
@@ -8,34 +8,34 @@ const parseIccProfile = (data) => {
8
8
  if (size !== data.length) {
9
9
  throw new Error('Invalid ICC profile size');
10
10
  }
11
- const preferredCMMType = iterator.getByteString(4);
12
- const profileVersion = iterator.getByteString(4);
13
- const profileDeviceClass = iterator.getByteString(4);
14
- const colorSpace = iterator.getByteString(4);
15
- const pcs = iterator.getByteString(4);
11
+ const preferredCMMType = iterator.getByteString(4, false);
12
+ const profileVersion = iterator.getByteString(4, false);
13
+ const profileDeviceClass = iterator.getByteString(4, false);
14
+ const colorSpace = iterator.getByteString(4, false);
15
+ const pcs = iterator.getByteString(4, false);
16
16
  const dateTime = iterator.getSlice(12);
17
- const signature = iterator.getByteString(4);
17
+ const signature = iterator.getByteString(4, false);
18
18
  if (signature !== 'acsp') {
19
19
  throw new Error('Invalid ICC profile signature');
20
20
  }
21
- const primaryPlatform = iterator.getByteString(4);
21
+ const primaryPlatform = iterator.getByteString(4, false);
22
22
  const profileFlags = iterator.getUint32();
23
- const deviceManufacturer = iterator.getByteString(4);
24
- const deviceModel = iterator.getByteString(4);
23
+ const deviceManufacturer = iterator.getByteString(4, false);
24
+ const deviceModel = iterator.getByteString(4, false);
25
25
  const deviceAttributes = iterator.getUint64();
26
26
  const renderingIntent = iterator.getUint32();
27
27
  const pcsIlluminant1 = iterator.getUint32();
28
28
  const pcsIlluminant2 = iterator.getUint32();
29
29
  const pcsIlluminant3 = iterator.getUint32();
30
- const profileCreator = iterator.getByteString(4);
31
- const profileId = iterator.getByteString(16);
30
+ const profileCreator = iterator.getByteString(4, false);
31
+ const profileId = iterator.getByteString(16, false);
32
32
  // reserved
33
33
  iterator.discard(28);
34
34
  const tagCount = iterator.getUint32();
35
35
  const entries = [];
36
36
  for (let i = 0; i < tagCount; i++) {
37
37
  const entry = {
38
- tag: iterator.getByteString(4),
38
+ tag: iterator.getByteString(4, false),
39
39
  offset: iterator.getUint32(),
40
40
  size: iterator.getUint32(),
41
41
  };
@@ -122,7 +122,7 @@ const processBox = async ({ iterator, allowIncompleteBoxes, parsedBoxes, state,
122
122
  skipTo: null,
123
123
  };
124
124
  }
125
- const boxType = iterator.getByteString(4);
125
+ const boxType = iterator.getByteString(4, false);
126
126
  const boxSize = boxSizeRaw === 1 ? iterator.getEightByteNumber() : boxSizeRaw;
127
127
  if (bytesRemaining < boxSize) {
128
128
  if (boxType === 'mdat') {
@@ -612,9 +612,6 @@ const parseIsoBaseMediaBoxes = async ({ iterator, maxBytes, allowIncompleteBoxes
612
612
  initialBoxes = initialBoxes.filter((b) => b.type !== 'mdat-box');
613
613
  initialBoxes.push(result.box);
614
614
  iterator.allowDiscard();
615
- if (result.box.status !== 'samples-processed') {
616
- throw new Error('unexpected');
617
- }
618
615
  break;
619
616
  }
620
617
  else {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseColorParameterBox = void 0;
4
4
  const parse_icc_profile_1 = require("../parse-icc-profile");
5
5
  const parseColorParameterBox = ({ iterator, size, }) => {
6
- const byteString = iterator.getByteString(4);
6
+ const byteString = iterator.getByteString(4, false);
7
7
  if (byteString === 'nclx') {
8
8
  const primaries = iterator.getUint16();
9
9
  const transfer = iterator.getUint16();
@@ -13,7 +13,7 @@ const parseKeys = ({ iterator, offset, size, }) => {
13
13
  // key_size
14
14
  const keySize = iterator.getUint32();
15
15
  const namespace = iterator.getAtom();
16
- const value = iterator.getByteString(keySize - 8);
16
+ const value = iterator.getByteString(keySize - 8, false);
17
17
  // data
18
18
  const entry = {
19
19
  keySize,
@@ -14,7 +14,7 @@ const expectRiffBox = async ({ iterator, state, structure, }) => {
14
14
  },
15
15
  };
16
16
  }
17
- const ckId = iterator.getByteString(4);
17
+ const ckId = iterator.getByteString(4, false);
18
18
  const ckSize = iterator.getUint32Le();
19
19
  if ((0, is_movi_1.isMoviAtom)(iterator, ckId)) {
20
20
  iterator.discard(4);
@@ -5,7 +5,7 @@ const isMoviAtom = (iterator, ckId) => {
5
5
  if (ckId !== 'LIST') {
6
6
  return false;
7
7
  }
8
- const listType = iterator.getByteString(4);
8
+ const listType = iterator.getByteString(4, false);
9
9
  iterator.counter.decrement(4);
10
10
  return listType === 'movi';
11
11
  };
@@ -121,7 +121,7 @@ const parseRiffBody = async ({ iterator, structure, maxOffset, state, }) => {
121
121
  };
122
122
  exports.parseRiffBody = parseRiffBody;
123
123
  const parseRiff = ({ iterator, state, fields, }) => {
124
- const riff = iterator.getByteString(4);
124
+ const riff = iterator.getByteString(4, false);
125
125
  if (riff !== 'RIFF') {
126
126
  throw new Error('Not a RIFF file');
127
127
  }
@@ -130,7 +130,7 @@ const parseRiff = ({ iterator, state, fields, }) => {
130
130
  throw new Error('Structure is not a RIFF structure');
131
131
  }
132
132
  const size = iterator.getUint32Le();
133
- const fileType = iterator.getByteString(4);
133
+ const fileType = iterator.getByteString(4, false);
134
134
  if (fileType !== 'WAVE' && fileType !== 'AVI') {
135
135
  throw new Error(`File type ${fileType} not supported`);
136
136
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseIsft = void 0;
4
4
  const parseIsft = ({ iterator, size, }) => {
5
5
  const { expectNoMoreBytes } = iterator.startBox(size);
6
- const software = iterator.getByteString(size - 1);
6
+ const software = iterator.getByteString(size - 1, false);
7
7
  const last = iterator.getUint8();
8
8
  if (last !== 0) {
9
9
  throw new Error(`Expected 0 byte, got ${last}`);
@@ -4,7 +4,7 @@ exports.parseListBox = void 0;
4
4
  const parse_box_1 = require("./parse-box");
5
5
  const parseListBox = async ({ iterator, size, state, }) => {
6
6
  const counter = iterator.counter.getOffset();
7
- const listType = iterator.getByteString(4);
7
+ const listType = iterator.getByteString(4, false);
8
8
  if (listType === 'movi') {
9
9
  throw new Error('should not be handled here');
10
10
  }
@@ -91,7 +91,7 @@ const parseMovi = async ({ iterator, maxOffset, state, structure, }) => {
91
91
  },
92
92
  };
93
93
  }
94
- const ckId = iterator.getByteString(4);
94
+ const ckId = iterator.getByteString(4, false);
95
95
  const ckSize = iterator.getUint32Le();
96
96
  if ((0, may_skip_video_data_1.maySkipVideoData)({
97
97
  state,
@@ -29,7 +29,7 @@ const parseStrfVideo = ({ iterator, size, }) => {
29
29
  const height = iterator.getInt32Le();
30
30
  const planes = iterator.getUint16Le();
31
31
  const bitCount = iterator.getUint16Le();
32
- const compression = iterator.getByteString(4);
32
+ const compression = iterator.getByteString(4, false);
33
33
  const sizeImage = iterator.getUint32Le();
34
34
  const xPelsPerMeter = iterator.getInt32Le();
35
35
  const yPelsPerMeter = iterator.getInt32Le();
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseStrh = void 0;
4
4
  const parseStrh = ({ iterator, size, }) => {
5
5
  const box = iterator.startBox(size);
6
- const fccType = iterator.getByteString(4);
6
+ const fccType = iterator.getByteString(4, false);
7
7
  if (fccType !== 'vids' && fccType !== 'auds') {
8
8
  throw new Error('Expected AVI handler to be vids / auds');
9
9
  }
10
- const handler = fccType === 'vids' ? iterator.getByteString(4) : iterator.getUint32Le();
10
+ const handler = fccType === 'vids'
11
+ ? iterator.getByteString(4, false)
12
+ : iterator.getUint32Le();
11
13
  if (typeof handler === 'string' && handler !== 'H264') {
12
14
  throw new Error(`Only H264 is supported as a stream type in .avi, got ${handler}`);
13
15
  }
@@ -1,6 +1,6 @@
1
1
  export declare const readAdtsHeader: (buffer: Uint8Array) => {
2
2
  frameLength: number;
3
- codecPrivate: Uint8Array<ArrayBuffer>;
3
+ codecPrivate: Uint8Array;
4
4
  channelConfiguration: number;
5
5
  sampleRate: number;
6
6
  audioObjectType: number;
@@ -1,3 +1,3 @@
1
1
  import type { BufferIterator } from '../../buffer-iterator';
2
2
  export declare const discardRestOfPacket: (iterator: BufferIterator) => void;
3
- export declare const getRestOfPacket: (iterator: BufferIterator) => Uint8Array<ArrayBuffer>;
3
+ export declare const getRestOfPacket: (iterator: BufferIterator) => Uint8Array;
@@ -48,7 +48,7 @@ const getAudioDescription = (track) => {
48
48
  // type
49
49
  bufferIterator.getUint8();
50
50
  // vorbis
51
- const vorbis = bufferIterator.getByteString(6);
51
+ const vorbis = bufferIterator.getByteString(6, false);
52
52
  if (vorbis !== 'vorbis') {
53
53
  throw new Error('Error parsing vorbis codec private');
54
54
  }
@@ -1,2 +1,2 @@
1
- export declare const measureEBMLVarInt: (value: number) => 1 | 2 | 3 | 4 | 5 | 6;
1
+ export declare const measureEBMLVarInt: (value: number) => 2 | 1 | 6 | 5 | 3 | 4;
2
2
  export declare const getVariableInt: (value: number, minWidth: number | null) => Uint8Array;
@@ -1,8 +1,8 @@
1
1
  import type { BytesAndOffset, PossibleEbmlOrUint8Array } from './segments/all-segments';
2
2
  import { matroskaElements } from './segments/all-segments';
3
- export declare const webmPattern: Uint8Array<ArrayBuffer>;
4
- export declare const matroskaToHex: (matrId: (typeof matroskaElements)[keyof typeof matroskaElements]) => Uint8Array<ArrayBufferLike>;
3
+ export declare const webmPattern: Uint8Array;
4
+ export declare const matroskaToHex: (matrId: (typeof matroskaElements)[keyof typeof matroskaElements]) => Uint8Array;
5
5
  export declare const makeMatroskaBytes: (fields: PossibleEbmlOrUint8Array) => BytesAndOffset;
6
6
  export declare const padMatroskaBytes: (fields: PossibleEbmlOrUint8Array, totalLength: number) => BytesAndOffset[];
7
- export declare const combineUint8Arrays: (arrays: Uint8Array[]) => Uint8Array<ArrayBufferLike>;
7
+ export declare const combineUint8Arrays: (arrays: Uint8Array[]) => Uint8Array;
8
8
  export declare function serializeUint16(value: number): Uint8Array;
@@ -35,7 +35,7 @@ const parseEbml = async (iterator, state) => {
35
35
  };
36
36
  }
37
37
  if (hasInMap.type === 'string') {
38
- const value = iterator.getByteString(size);
38
+ const value = iterator.getByteString(size, true);
39
39
  return {
40
40
  type: hasInMap.name,
41
41
  value,
@@ -348,6 +348,18 @@ export declare const seekId: {
348
348
  readonly name: "SeekID";
349
349
  readonly type: "hex-string";
350
350
  };
351
+ export declare const _name: {
352
+ readonly name: "Name";
353
+ readonly type: "string";
354
+ };
355
+ export declare const minCache: {
356
+ readonly name: "MinCache";
357
+ readonly type: "uint";
358
+ };
359
+ export declare const maxCache: {
360
+ readonly name: "MaxCache";
361
+ readonly type: "uint";
362
+ };
351
363
  export declare const seekPosition: {
352
364
  readonly name: "SeekPosition";
353
365
  readonly type: "uint";
@@ -520,6 +532,10 @@ export declare const referenceBlock: {
520
532
  readonly name: "ReferenceBlock";
521
533
  readonly type: "uint";
522
534
  };
535
+ export declare const blockDurationSegment: {
536
+ readonly name: "BlockDuration";
537
+ readonly type: "uint";
538
+ };
523
539
  export declare const blockElement: {
524
540
  readonly name: "Block";
525
541
  readonly type: "uint8array";
@@ -759,6 +775,18 @@ export declare const ebmlMap: {
759
775
  readonly name: "SeekID";
760
776
  readonly type: "hex-string";
761
777
  };
778
+ readonly "0x536e": {
779
+ readonly name: "Name";
780
+ readonly type: "string";
781
+ };
782
+ readonly "0x6de7": {
783
+ readonly name: "MinCache";
784
+ readonly type: "uint";
785
+ };
786
+ readonly "0x6df8": {
787
+ readonly name: "MaxCache";
788
+ readonly type: "uint";
789
+ };
762
790
  readonly "0x53ac": {
763
791
  readonly name: "SeekPosition";
764
792
  readonly type: "uint";
@@ -875,6 +903,10 @@ export declare const ebmlMap: {
875
903
  readonly name: "CodecPrivate";
876
904
  readonly type: "uint8array";
877
905
  };
906
+ readonly "0x9b": {
907
+ readonly name: "BlockDuration";
908
+ readonly type: "uint";
909
+ };
878
910
  readonly "0x75a1": {
879
911
  readonly name: "BlockAdditions";
880
912
  readonly type: "uint8array";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.language = exports.ChromaSitingVert = exports.ChromaSitingHorz = exports.range = exports.primaries = exports.matrixCoefficients = exports.transferCharacteristics = exports.color = exports.trackUID = exports.trackNumber = exports.tags = exports.tagSegment = exports.flagLacing = exports.displayHeight = exports.displayWidth = exports.bitDepth = exports.interlaced = exports.alphaMode = exports.channels = exports.samplingFrequency = exports.tagTrackUidType = exports.titleType = exports.infoType = exports.writingApp = exports.timestampScale = exports.duration = exports.muxingApp = exports.heightType = exports.widthType = exports.trackType = exports.codecID = exports.voidHeader = exports.seekHead = exports.seek = exports.seekPosition = exports.seekId = exports.matroskaHeader = exports.docTypeReadVersion = exports.docTypeVersion = exports.docType = exports.ebmlMaxSizeLength = exports.ebmlMaxIdLength = exports.ebmlReadVersion = exports.ebmlVersion = exports.getIdForName = exports.getSegmentName = exports.knownIdsWithThreeLength = exports.knownIdsWithTwoLength = exports.knownIdsWithOneLength = exports.matroskaElements = void 0;
4
- exports.incrementOffsetAndChildren = exports.ebmlMap = exports.tagStringType = exports.tagNameType = exports.simpleTagType = exports.targetsType = exports.cluster = exports.segment = exports.blockGroup = exports.simpleBlock = exports.block = exports.timestampEntry = exports.tracks = exports.trackEntry = exports.trackTimestampScale = exports.codecName = exports.blockElement = exports.referenceBlock = exports.flagDefault = exports.videoSegment = exports.audioSegment = exports.maxBlockAdditionIdSegment = exports.blockAdditionsSegment = exports.codecPrivate = exports.defaultDuration = void 0;
3
+ exports.range = exports.primaries = exports.matrixCoefficients = exports.transferCharacteristics = exports.color = exports.trackUID = exports.trackNumber = exports.tags = exports.tagSegment = exports.flagLacing = exports.displayHeight = exports.displayWidth = exports.bitDepth = exports.interlaced = exports.alphaMode = exports.channels = exports.samplingFrequency = exports.tagTrackUidType = exports.titleType = exports.infoType = exports.writingApp = exports.timestampScale = exports.duration = exports.muxingApp = exports.heightType = exports.widthType = exports.trackType = exports.codecID = exports.voidHeader = exports.seekHead = exports.seek = exports.seekPosition = exports.maxCache = exports.minCache = exports._name = exports.seekId = exports.matroskaHeader = exports.docTypeReadVersion = exports.docTypeVersion = exports.docType = exports.ebmlMaxSizeLength = exports.ebmlMaxIdLength = exports.ebmlReadVersion = exports.ebmlVersion = exports.getIdForName = exports.getSegmentName = exports.knownIdsWithThreeLength = exports.knownIdsWithTwoLength = exports.knownIdsWithOneLength = exports.matroskaElements = void 0;
4
+ exports.incrementOffsetAndChildren = exports.ebmlMap = exports.tagStringType = exports.tagNameType = exports.simpleTagType = exports.targetsType = exports.cluster = exports.segment = exports.blockGroup = exports.simpleBlock = exports.block = exports.timestampEntry = exports.tracks = exports.trackEntry = exports.trackTimestampScale = exports.codecName = exports.blockElement = exports.blockDurationSegment = exports.referenceBlock = exports.flagDefault = exports.videoSegment = exports.audioSegment = exports.maxBlockAdditionIdSegment = exports.blockAdditionsSegment = exports.codecPrivate = exports.defaultDuration = exports.language = exports.ChromaSitingVert = exports.ChromaSitingHorz = void 0;
5
5
  exports.matroskaElements = {
6
6
  Header: '0x1a45dfa3',
7
7
  EBMLMaxIDLength: '0x42f2',
@@ -331,6 +331,18 @@ exports.seekId = {
331
331
  name: 'SeekID',
332
332
  type: 'hex-string',
333
333
  };
334
+ exports._name = {
335
+ name: 'Name',
336
+ type: 'string',
337
+ };
338
+ exports.minCache = {
339
+ name: 'MinCache',
340
+ type: 'uint',
341
+ };
342
+ exports.maxCache = {
343
+ name: 'MaxCache',
344
+ type: 'uint',
345
+ };
334
346
  exports.seekPosition = {
335
347
  name: 'SeekPosition',
336
348
  type: 'uint',
@@ -503,6 +515,10 @@ exports.referenceBlock = {
503
515
  name: 'ReferenceBlock',
504
516
  type: 'uint',
505
517
  };
518
+ exports.blockDurationSegment = {
519
+ name: 'BlockDuration',
520
+ type: 'uint',
521
+ };
506
522
  exports.blockElement = {
507
523
  name: 'Block',
508
524
  type: 'uint8array',
@@ -643,6 +659,9 @@ exports.ebmlMap = {
643
659
  [exports.matroskaElements.SeekHead]: exports.seekHead,
644
660
  [exports.matroskaElements.Seek]: exports.seek,
645
661
  [exports.matroskaElements.SeekID]: exports.seekId,
662
+ [exports.matroskaElements.Name]: exports._name,
663
+ [exports.matroskaElements.MinCache]: exports.minCache,
664
+ [exports.matroskaElements.MaxCache]: exports.maxCache,
646
665
  [exports.matroskaElements.SeekPosition]: exports.seekPosition,
647
666
  [exports.matroskaElements.Crc32]: {
648
667
  name: 'Crc32',
@@ -684,6 +703,7 @@ exports.ebmlMap = {
684
703
  [exports.matroskaElements.Language]: exports.language,
685
704
  [exports.matroskaElements.DefaultDuration]: exports.defaultDuration,
686
705
  [exports.matroskaElements.CodecPrivate]: exports.codecPrivate,
706
+ [exports.matroskaElements.BlockDuration]: exports.blockDurationSegment,
687
707
  [exports.matroskaElements.BlockAdditions]: exports.blockAdditionsSegment,
688
708
  [exports.matroskaElements.MaxBlockAdditionID]: exports.maxBlockAdditionIdSegment,
689
709
  [exports.matroskaElements.Audio]: exports.audioSegment,
@@ -25,7 +25,7 @@ export declare const getArrayBufferIterator: (initialData: Uint8Array, maxBytes:
25
25
  discard: (length: number) => void;
26
26
  getEightByteNumber: (littleEndian?: boolean) => number;
27
27
  getFourByteNumber: () => number;
28
- getSlice: (amount: number) => Uint8Array<ArrayBuffer>;
28
+ getSlice: (amount: number) => Uint8Array;
29
29
  getAtom: () => string;
30
30
  detectFileType: () => import("./file-types/detect-file-type").FileType;
31
31
  getPaddedFourByteNumber: () => number;
@@ -47,7 +47,7 @@ export declare const getArrayBufferIterator: (initialData: Uint8Array, maxBytes:
47
47
  getFixedPointSigned230Number: () => number;
48
48
  getPascalString: () => number[];
49
49
  getUint(length: number): number;
50
- getByteString(length: number): string;
50
+ getByteString(length: number, trimTrailingZeroes: boolean): string;
51
51
  getFloat64: () => number;
52
52
  readUntilNullTerminator: () => string;
53
53
  getFloat32: () => number;
@@ -491,8 +491,14 @@ const getArrayBufferIterator = (initialData, maxBytes) => {
491
491
  const numbers = [...Array.from(new Uint8Array(bytes))];
492
492
  return numbers.reduce((acc, byte, index) => acc + (byte << (8 * (numbers.length - index - 1))), 0);
493
493
  },
494
- getByteString(length) {
495
- const bytes = getSlice(length);
494
+ getByteString(length, trimTrailingZeroes) {
495
+ let bytes = getSlice(length);
496
+ // This file has trailing zeroes throughout
497
+ // https://github.com/remotion-dev/remotion/issues/4668#issuecomment-2561904068
498
+ // eslint-disable-next-line no-unmodified-loop-condition
499
+ while (trimTrailingZeroes && bytes[bytes.length - 1] === 0) {
500
+ bytes = bytes.slice(0, -1);
501
+ }
496
502
  return new TextDecoder().decode(bytes).trim();
497
503
  },
498
504
  getFloat64: () => {
@@ -1,2 +1,2 @@
1
1
  import type { Avc1Data } from './create-codec-specific-data';
2
- export declare const createAvc1Data: ({ avccBox, pasp, width, height, horizontalResolution, verticalResolution, compressorName, depth, }: Avc1Data) => Uint8Array<ArrayBufferLike>;
2
+ export declare const createAvc1Data: ({ avccBox, pasp, width, height, horizontalResolution, verticalResolution, compressorName, depth, }: Avc1Data) => Uint8Array;
@@ -19,4 +19,4 @@ export type Mp4aData = {
19
19
  codecPrivate: Uint8Array | null;
20
20
  };
21
21
  export type CodecSpecificData = Avc1Data | Mp4aData;
22
- export declare const createCodecSpecificData: (track: MakeTrackAudio | MakeTrackVideo) => Uint8Array<ArrayBufferLike>;
22
+ export declare const createCodecSpecificData: (track: MakeTrackAudio | MakeTrackVideo) => Uint8Array;
@@ -1,2 +1,2 @@
1
1
  import type { Mp4aData } from './create-codec-specific-data';
2
- export declare const createMp4a: ({ sampleRate, channelCount, avgBitrate, maxBitrate, codecPrivate, }: Mp4aData) => Uint8Array<ArrayBufferLike>;
2
+ export declare const createMp4a: ({ sampleRate, channelCount, avgBitrate, maxBitrate, codecPrivate, }: Mp4aData) => Uint8Array;
@@ -3,4 +3,4 @@ export declare const createColr: ({ fullRange, matrixIndex, primaries, transferF
3
3
  matrixIndex: number;
4
4
  primaries: number;
5
5
  transferFunction: number;
6
- }) => Uint8Array<ArrayBufferLike>;
6
+ }) => Uint8Array;
@@ -2,9 +2,9 @@ export declare const createFtyp: ({ majorBrand, minorBrand, compatibleBrands, }:
2
2
  majorBrand: string;
3
3
  minorBrand: number;
4
4
  compatibleBrands: string[];
5
- }) => Uint8Array<ArrayBufferLike>;
5
+ }) => Uint8Array;
6
6
  export declare const createIsoBaseMediaFtyp: ({ majorBrand, minorBrand, compatibleBrands, }: {
7
7
  majorBrand: string;
8
8
  minorBrand: number;
9
9
  compatibleBrands: string[];
10
- }) => Uint8Array<ArrayBufferLike>;
10
+ }) => Uint8Array;
@@ -1 +1 @@
1
- export declare const createIlst: (items: Uint8Array[]) => Uint8Array<ArrayBufferLike>;
1
+ export declare const createIlst: (items: Uint8Array[]) => Uint8Array;
@@ -2,4 +2,4 @@ export declare const createMdia: ({ mdhd, hdlr, minf, }: {
2
2
  mdhd: Uint8Array;
3
3
  hdlr: Uint8Array;
4
4
  minf: Uint8Array;
5
- }) => Uint8Array<ArrayBufferLike>;
5
+ }) => Uint8Array;
@@ -2,4 +2,4 @@ export declare const createMoov: ({ mvhd, traks, udta, }: {
2
2
  mvhd: Uint8Array;
3
3
  traks: Uint8Array[];
4
4
  udta: Uint8Array;
5
- }) => Uint8Array<ArrayBufferLike>;
5
+ }) => Uint8Array;
@@ -7,4 +7,4 @@ export declare const createMvhd: ({ timescale, durationInUnits, rate, volume, ne
7
7
  matrix: number[];
8
8
  creationTime: number | null;
9
9
  modificationTime: number | null;
10
- }) => Uint8Array<ArrayBufferLike>;
10
+ }) => Uint8Array;
@@ -1,4 +1,4 @@
1
1
  export declare const createTrak: ({ tkhd, mdia, }: {
2
2
  tkhd: Uint8Array;
3
3
  mdia: Uint8Array;
4
- }) => Uint8Array<ArrayBufferLike>;
4
+ }) => Uint8Array;
@@ -1 +1 @@
1
- export declare const createUdta: (children: Uint8Array) => Uint8Array<ArrayBufferLike>;
1
+ export declare const createUdta: (children: Uint8Array) => Uint8Array;
@@ -1 +1 @@
1
- export declare const createUrlAtom: () => Uint8Array<ArrayBufferLike>;
1
+ export declare const createUrlAtom: () => Uint8Array;
@@ -1 +1 @@
1
- export declare const createCmt: (comment: string) => Uint8Array<ArrayBufferLike>;
1
+ export declare const createCmt: (comment: string) => Uint8Array;
@@ -1 +1 @@
1
- export declare const createToo: (value: string) => Uint8Array<ArrayBufferLike>;
1
+ export declare const createToo: (value: string) => Uint8Array;
@@ -3,4 +3,4 @@ export declare const createMdhd: ({ creationTime, modificationTime, timescale, d
3
3
  modificationTime: number | null;
4
4
  timescale: number;
5
5
  duration: number;
6
- }) => Uint8Array<ArrayBufferLike>;
6
+ }) => Uint8Array;
@@ -3,4 +3,4 @@ export declare const createPaddedMoovAtom: ({ durationInUnits, trackInfo, timesc
3
3
  durationInUnits: number;
4
4
  trackInfo: IsoBaseMediaTrackData[];
5
5
  timescale: number;
6
- }) => Uint8Array<ArrayBufferLike>;
6
+ }) => Uint8Array;
@@ -1,15 +1,15 @@
1
1
  import type { ThreeDMatrix } from '../../boxes/iso-base-media/mvhd';
2
- export declare const stringsToUint8Array: (str: string) => Uint8Array<ArrayBufferLike>;
3
- export declare const numberTo32BitUIntOrInt: (num: number) => Uint8Array<ArrayBuffer>;
4
- export declare const numberTo32BitUIntOrIntLeading128: (num: number) => Uint8Array<ArrayBuffer>;
5
- export declare const numberTo16BitUIntOrInt: (num: number) => Uint8Array<ArrayBuffer>;
6
- export declare const setFixedPointSignedOrUnsigned1616Number: (num: number) => Uint8Array<ArrayBuffer>;
7
- export declare const setFixedPointSigned230Number: (num: number) => Uint8Array<ArrayBuffer>;
8
- export declare const addSize: (arr: Uint8Array) => Uint8Array<ArrayBufferLike>;
9
- export declare const addLeading128Size: (arr: Uint8Array) => Uint8Array<ArrayBufferLike>;
10
- export declare const floatTo16Point1632Bit: (number: number) => Uint8Array<ArrayBuffer>;
11
- export declare const floatTo16Point16_16Bit: (number: number) => Uint8Array<ArrayBuffer>;
12
- export declare const serializeMatrix: (matrix: number[]) => Uint8Array<ArrayBufferLike>;
13
- export declare const stringToPascalString: (str: string) => Uint8Array<ArrayBuffer>;
14
- export declare const padIsoBaseMediaBytes: (data: Uint8Array, totalLength: number) => Uint8Array<ArrayBufferLike>;
2
+ export declare const stringsToUint8Array: (str: string) => Uint8Array;
3
+ export declare const numberTo32BitUIntOrInt: (num: number) => Uint8Array;
4
+ export declare const numberTo32BitUIntOrIntLeading128: (num: number) => Uint8Array;
5
+ export declare const numberTo16BitUIntOrInt: (num: number) => Uint8Array;
6
+ export declare const setFixedPointSignedOrUnsigned1616Number: (num: number) => Uint8Array;
7
+ export declare const setFixedPointSigned230Number: (num: number) => Uint8Array;
8
+ export declare const addSize: (arr: Uint8Array) => Uint8Array;
9
+ export declare const addLeading128Size: (arr: Uint8Array) => Uint8Array;
10
+ export declare const floatTo16Point1632Bit: (number: number) => Uint8Array;
11
+ export declare const floatTo16Point16_16Bit: (number: number) => Uint8Array;
12
+ export declare const serializeMatrix: (matrix: number[]) => Uint8Array;
13
+ export declare const stringToPascalString: (str: string) => Uint8Array;
14
+ export declare const padIsoBaseMediaBytes: (data: Uint8Array, totalLength: number) => Uint8Array;
15
15
  export declare const IDENTITY_MATRIX: ThreeDMatrix;