@remotion/media-parser 4.0.242 → 4.0.244
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/boxes/iso-base-media/ftyp.js +2 -2
- package/dist/boxes/iso-base-media/meta/hdlr.js +1 -1
- package/dist/boxes/iso-base-media/meta/ilst.js +1 -1
- package/dist/boxes/iso-base-media/parse-icc-profile.js +12 -12
- package/dist/boxes/iso-base-media/process-box.js +1 -1
- package/dist/boxes/iso-base-media/stsd/colr.js +1 -1
- package/dist/boxes/iso-base-media/stsd/keys.js +1 -1
- package/dist/boxes/riff/expect-riff-box.js +1 -1
- package/dist/boxes/riff/is-movi.js +1 -1
- package/dist/boxes/riff/parse-box.js +2 -2
- package/dist/boxes/riff/parse-isft.js +1 -1
- package/dist/boxes/riff/parse-list-box.js +1 -1
- package/dist/boxes/riff/parse-movi.js +1 -1
- package/dist/boxes/riff/parse-strf.js +1 -1
- package/dist/boxes/riff/parse-strh.js +4 -2
- package/dist/boxes/webm/description.js +1 -1
- package/dist/boxes/webm/ebml.d.ts +1 -1
- package/dist/boxes/webm/parse-ebml.js +1 -1
- package/dist/boxes/webm/segments/all-segments.d.ts +16 -0
- package/dist/boxes/webm/segments/all-segments.js +12 -2
- package/dist/buffer-iterator.d.ts +2 -2
- package/dist/buffer-iterator.js +8 -2
- package/dist/convert-audio-or-video-sample.js +3 -2
- package/dist/create/matroska/create-matroska-media.js +2 -0
- package/dist/create/progress-tracker.js +2 -2
- package/dist/esm/index.mjs +66 -46
- package/dist/file-types/detect-file-type.js +4 -2
- package/dist/get-audio-codec.d.ts +1 -1
- package/dist/state/sample-callbacks.js +13 -8
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -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 {
|
|
@@ -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') {
|
|
@@ -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);
|
|
@@ -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'
|
|
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
|
}
|
|
@@ -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
|
+
export declare const measureEBMLVarInt: (value: number) => 4 | 2 | 1 | 3 | 5 | 6;
|
|
2
2
|
export declare const getVariableInt: (value: number, minWidth: number | null) => Uint8Array;
|
|
@@ -348,6 +348,10 @@ 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
|
+
};
|
|
351
355
|
export declare const seekPosition: {
|
|
352
356
|
readonly name: "SeekPosition";
|
|
353
357
|
readonly type: "uint";
|
|
@@ -520,6 +524,10 @@ export declare const referenceBlock: {
|
|
|
520
524
|
readonly name: "ReferenceBlock";
|
|
521
525
|
readonly type: "uint";
|
|
522
526
|
};
|
|
527
|
+
export declare const blockDurationSegment: {
|
|
528
|
+
readonly name: "BlockDuration";
|
|
529
|
+
readonly type: "uint";
|
|
530
|
+
};
|
|
523
531
|
export declare const blockElement: {
|
|
524
532
|
readonly name: "Block";
|
|
525
533
|
readonly type: "uint8array";
|
|
@@ -759,6 +767,10 @@ export declare const ebmlMap: {
|
|
|
759
767
|
readonly name: "SeekID";
|
|
760
768
|
readonly type: "hex-string";
|
|
761
769
|
};
|
|
770
|
+
readonly "0x536e": {
|
|
771
|
+
readonly name: "Name";
|
|
772
|
+
readonly type: "string";
|
|
773
|
+
};
|
|
762
774
|
readonly "0x53ac": {
|
|
763
775
|
readonly name: "SeekPosition";
|
|
764
776
|
readonly type: "uint";
|
|
@@ -875,6 +887,10 @@ export declare const ebmlMap: {
|
|
|
875
887
|
readonly name: "CodecPrivate";
|
|
876
888
|
readonly type: "uint8array";
|
|
877
889
|
};
|
|
890
|
+
readonly "0x9b": {
|
|
891
|
+
readonly name: "BlockDuration";
|
|
892
|
+
readonly type: "uint";
|
|
893
|
+
};
|
|
878
894
|
readonly "0x75a1": {
|
|
879
895
|
readonly name: "BlockAdditions";
|
|
880
896
|
readonly type: "uint8array";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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.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._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 = void 0;
|
|
5
5
|
exports.matroskaElements = {
|
|
6
6
|
Header: '0x1a45dfa3',
|
|
7
7
|
EBMLMaxIDLength: '0x42f2',
|
|
@@ -331,6 +331,10 @@ exports.seekId = {
|
|
|
331
331
|
name: 'SeekID',
|
|
332
332
|
type: 'hex-string',
|
|
333
333
|
};
|
|
334
|
+
exports._name = {
|
|
335
|
+
name: 'Name',
|
|
336
|
+
type: 'string',
|
|
337
|
+
};
|
|
334
338
|
exports.seekPosition = {
|
|
335
339
|
name: 'SeekPosition',
|
|
336
340
|
type: 'uint',
|
|
@@ -503,6 +507,10 @@ exports.referenceBlock = {
|
|
|
503
507
|
name: 'ReferenceBlock',
|
|
504
508
|
type: 'uint',
|
|
505
509
|
};
|
|
510
|
+
exports.blockDurationSegment = {
|
|
511
|
+
name: 'BlockDuration',
|
|
512
|
+
type: 'uint',
|
|
513
|
+
};
|
|
506
514
|
exports.blockElement = {
|
|
507
515
|
name: 'Block',
|
|
508
516
|
type: 'uint8array',
|
|
@@ -643,6 +651,7 @@ exports.ebmlMap = {
|
|
|
643
651
|
[exports.matroskaElements.SeekHead]: exports.seekHead,
|
|
644
652
|
[exports.matroskaElements.Seek]: exports.seek,
|
|
645
653
|
[exports.matroskaElements.SeekID]: exports.seekId,
|
|
654
|
+
[exports.matroskaElements.Name]: exports._name,
|
|
646
655
|
[exports.matroskaElements.SeekPosition]: exports.seekPosition,
|
|
647
656
|
[exports.matroskaElements.Crc32]: {
|
|
648
657
|
name: 'Crc32',
|
|
@@ -684,6 +693,7 @@ exports.ebmlMap = {
|
|
|
684
693
|
[exports.matroskaElements.Language]: exports.language,
|
|
685
694
|
[exports.matroskaElements.DefaultDuration]: exports.defaultDuration,
|
|
686
695
|
[exports.matroskaElements.CodecPrivate]: exports.codecPrivate,
|
|
696
|
+
[exports.matroskaElements.BlockDuration]: exports.blockDurationSegment,
|
|
687
697
|
[exports.matroskaElements.BlockAdditions]: exports.blockAdditionsSegment,
|
|
688
698
|
[exports.matroskaElements.MaxBlockAdditionID]: exports.maxBlockAdditionIdSegment,
|
|
689
699
|
[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
|
|
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;
|
package/dist/buffer-iterator.js
CHANGED
|
@@ -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
|
-
|
|
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: () => {
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertAudioOrVideoSampleToWebCodecsTimestamps = void 0;
|
|
4
4
|
const convertAudioOrVideoSampleToWebCodecsTimestamps = (sample, timescale) => {
|
|
5
|
-
var _a;
|
|
6
5
|
const { cts, dts, timestamp } = sample;
|
|
7
6
|
return {
|
|
8
7
|
cts: (cts * 1000000) / timescale,
|
|
9
8
|
dts: (dts * 1000000) / timescale,
|
|
10
9
|
timestamp: (timestamp * 1000000) / timescale,
|
|
11
|
-
duration:
|
|
10
|
+
duration: sample.duration === undefined
|
|
11
|
+
? undefined
|
|
12
|
+
: (sample.duration * 1000000) / timescale,
|
|
12
13
|
data: sample.data,
|
|
13
14
|
trackId: sample.trackId,
|
|
14
15
|
type: sample.type,
|
|
@@ -83,6 +83,8 @@ const createMatroskaMedia = async ({ writer, onBytesProgress, onMillisecondsProg
|
|
|
83
83
|
// In Safari, samples can arrive out of order, e.g public/bigbuckbunny.mp4
|
|
84
84
|
// Therefore, only updating track number progress if it is a keyframe
|
|
85
85
|
// to allow for timestamps to be lower than the previous one
|
|
86
|
+
var _a, _b;
|
|
87
|
+
progressTracker.setPossibleLowestTimestamp(Math.min(chunk.timestamp, (_a = chunk.cts) !== null && _a !== void 0 ? _a : Infinity, (_b = chunk.dts) !== null && _b !== void 0 ? _b : Infinity));
|
|
86
88
|
const smallestProgress = progressTracker.getSmallestProgress();
|
|
87
89
|
if (!currentCluster.shouldMakeNewCluster({
|
|
88
90
|
newT: smallestProgress,
|
|
@@ -54,10 +54,10 @@ const makeProgressTracker = () => {
|
|
|
54
54
|
waitForProgress: () => {
|
|
55
55
|
const { promise, resolve } = (0, with_resolvers_1.withResolvers)();
|
|
56
56
|
const on = () => {
|
|
57
|
-
eventEmitter.removeEventListener('
|
|
57
|
+
eventEmitter.removeEventListener('progress', on);
|
|
58
58
|
resolve();
|
|
59
59
|
};
|
|
60
|
-
eventEmitter.addEventListener('
|
|
60
|
+
eventEmitter.addEventListener('progress', on);
|
|
61
61
|
return promise;
|
|
62
62
|
},
|
|
63
63
|
getStartingTimestamp,
|
package/dist/esm/index.mjs
CHANGED
|
@@ -663,6 +663,10 @@ var seekId = {
|
|
|
663
663
|
name: "SeekID",
|
|
664
664
|
type: "hex-string"
|
|
665
665
|
};
|
|
666
|
+
var _name = {
|
|
667
|
+
name: "Name",
|
|
668
|
+
type: "string"
|
|
669
|
+
};
|
|
666
670
|
var seekPosition = {
|
|
667
671
|
name: "SeekPosition",
|
|
668
672
|
type: "uint"
|
|
@@ -823,6 +827,10 @@ var referenceBlock = {
|
|
|
823
827
|
name: "ReferenceBlock",
|
|
824
828
|
type: "uint"
|
|
825
829
|
};
|
|
830
|
+
var blockDurationSegment = {
|
|
831
|
+
name: "BlockDuration",
|
|
832
|
+
type: "uint"
|
|
833
|
+
};
|
|
826
834
|
var codecName = {
|
|
827
835
|
name: "CodecName",
|
|
828
836
|
type: "string"
|
|
@@ -947,6 +955,7 @@ var ebmlMap = {
|
|
|
947
955
|
[matroskaElements.SeekHead]: seekHead,
|
|
948
956
|
[matroskaElements.Seek]: seek,
|
|
949
957
|
[matroskaElements.SeekID]: seekId,
|
|
958
|
+
[matroskaElements.Name]: _name,
|
|
950
959
|
[matroskaElements.SeekPosition]: seekPosition,
|
|
951
960
|
[matroskaElements.Crc32]: {
|
|
952
961
|
name: "Crc32",
|
|
@@ -988,6 +997,7 @@ var ebmlMap = {
|
|
|
988
997
|
[matroskaElements.Language]: language,
|
|
989
998
|
[matroskaElements.DefaultDuration]: defaultDuration,
|
|
990
999
|
[matroskaElements.CodecPrivate]: codecPrivate,
|
|
1000
|
+
[matroskaElements.BlockDuration]: blockDurationSegment,
|
|
991
1001
|
[matroskaElements.BlockAdditions]: blockAdditionsSegment,
|
|
992
1002
|
[matroskaElements.MaxBlockAdditionID]: maxBlockAdditionIdSegment,
|
|
993
1003
|
[matroskaElements.Audio]: audioSegment,
|
|
@@ -1367,7 +1377,7 @@ var createIsoBaseMediaFtyp = ({
|
|
|
1367
1377
|
};
|
|
1368
1378
|
|
|
1369
1379
|
// src/version.ts
|
|
1370
|
-
var VERSION = "4.0.
|
|
1380
|
+
var VERSION = "4.0.244";
|
|
1371
1381
|
|
|
1372
1382
|
// src/create/iso-base-media/create-ilst.ts
|
|
1373
1383
|
var createIlst = (items) => {
|
|
@@ -3230,6 +3240,7 @@ var createMatroskaMedia = async ({
|
|
|
3230
3240
|
chunk,
|
|
3231
3241
|
isVideo
|
|
3232
3242
|
}) => {
|
|
3243
|
+
progressTracker.setPossibleLowestTimestamp(Math.min(chunk.timestamp, chunk.cts ?? Infinity, chunk.dts ?? Infinity));
|
|
3233
3244
|
const smallestProgress = progressTracker.getSmallestProgress();
|
|
3234
3245
|
if (!currentCluster.shouldMakeNewCluster({
|
|
3235
3246
|
newT: smallestProgress,
|
|
@@ -3403,10 +3414,10 @@ var makeProgressTracker = () => {
|
|
|
3403
3414
|
waitForProgress: () => {
|
|
3404
3415
|
const { promise, resolve } = withResolvers();
|
|
3405
3416
|
const on = () => {
|
|
3406
|
-
eventEmitter.removeEventListener("
|
|
3417
|
+
eventEmitter.removeEventListener("progress", on);
|
|
3407
3418
|
resolve();
|
|
3408
3419
|
};
|
|
3409
|
-
eventEmitter.addEventListener("
|
|
3420
|
+
eventEmitter.addEventListener("progress", on);
|
|
3410
3421
|
return promise;
|
|
3411
3422
|
},
|
|
3412
3423
|
getStartingTimestamp,
|
|
@@ -4488,7 +4499,8 @@ var isRiffAvi2 = (data) => {
|
|
|
4488
4499
|
return false;
|
|
4489
4500
|
}
|
|
4490
4501
|
const fileType = data.subarray(8, 12);
|
|
4491
|
-
|
|
4502
|
+
const aviPattern = new Uint8Array([65, 86, 73, 32]);
|
|
4503
|
+
return matchesPattern(aviPattern)(fileType);
|
|
4492
4504
|
};
|
|
4493
4505
|
var isRiffWave = (data) => {
|
|
4494
4506
|
const riffPattern = new Uint8Array([82, 73, 70, 70]);
|
|
@@ -4496,7 +4508,8 @@ var isRiffWave = (data) => {
|
|
|
4496
4508
|
return false;
|
|
4497
4509
|
}
|
|
4498
4510
|
const fileType = data.subarray(8, 12);
|
|
4499
|
-
|
|
4511
|
+
const wavePattern = new Uint8Array([87, 65, 86, 69]);
|
|
4512
|
+
return matchesPattern(wavePattern)(fileType);
|
|
4500
4513
|
};
|
|
4501
4514
|
var isWebm = (data) => {
|
|
4502
4515
|
return matchesPattern(webmPattern)(data.subarray(0, 4));
|
|
@@ -5140,8 +5153,11 @@ var getArrayBufferIterator = (initialData, maxBytes) => {
|
|
|
5140
5153
|
const numbers = [...Array.from(new Uint8Array(bytes))];
|
|
5141
5154
|
return numbers.reduce((acc, byte, index) => acc + (byte << 8 * (numbers.length - index - 1)), 0);
|
|
5142
5155
|
},
|
|
5143
|
-
getByteString(length) {
|
|
5144
|
-
|
|
5156
|
+
getByteString(length, trimTrailingZeroes) {
|
|
5157
|
+
let bytes = getSlice(length);
|
|
5158
|
+
while (trimTrailingZeroes && bytes[bytes.length - 1] === 0) {
|
|
5159
|
+
bytes = bytes.slice(0, -1);
|
|
5160
|
+
}
|
|
5145
5161
|
return new TextDecoder().decode(bytes).trim();
|
|
5146
5162
|
},
|
|
5147
5163
|
getFloat64: () => {
|
|
@@ -5728,7 +5744,7 @@ var getAudioDescription = (track) => {
|
|
|
5728
5744
|
const vorbisBooks = privateData.slice(offset);
|
|
5729
5745
|
const bufferIterator = getArrayBufferIterator(vorbisInfo.slice(0), vorbisInfo.length);
|
|
5730
5746
|
bufferIterator.getUint8();
|
|
5731
|
-
const vorbis = bufferIterator.getByteString(6);
|
|
5747
|
+
const vorbis = bufferIterator.getByteString(6, false);
|
|
5732
5748
|
if (vorbis !== "vorbis") {
|
|
5733
5749
|
throw new Error("Error parsing vorbis codec private");
|
|
5734
5750
|
}
|
|
@@ -7192,12 +7208,12 @@ var parseFtyp = ({
|
|
|
7192
7208
|
size,
|
|
7193
7209
|
offset
|
|
7194
7210
|
}) => {
|
|
7195
|
-
const majorBrand = iterator.getByteString(4);
|
|
7211
|
+
const majorBrand = iterator.getByteString(4, false);
|
|
7196
7212
|
const minorVersion = iterator.getFourByteNumber();
|
|
7197
7213
|
const types = (size - iterator.counter.getOffset()) / 4;
|
|
7198
7214
|
const compatibleBrands = [];
|
|
7199
7215
|
for (let i = 0;i < types; i++) {
|
|
7200
|
-
compatibleBrands.push(iterator.getByteString(4).trim());
|
|
7216
|
+
compatibleBrands.push(iterator.getByteString(4, false).trim());
|
|
7201
7217
|
}
|
|
7202
7218
|
const offsetAtEnd = iterator.counter.getOffset();
|
|
7203
7219
|
return {
|
|
@@ -7217,7 +7233,7 @@ var convertAudioOrVideoSampleToWebCodecsTimestamps = (sample, timescale2) => {
|
|
|
7217
7233
|
cts: cts * 1e6 / timescale2,
|
|
7218
7234
|
dts: dts * 1e6 / timescale2,
|
|
7219
7235
|
timestamp: timestamp * 1e6 / timescale2,
|
|
7220
|
-
duration:
|
|
7236
|
+
duration: sample.duration === undefined ? undefined : sample.duration * 1e6 / timescale2,
|
|
7221
7237
|
data: sample.data,
|
|
7222
7238
|
trackId: sample.trackId,
|
|
7223
7239
|
type: sample.type,
|
|
@@ -7383,7 +7399,7 @@ var parseHdlr = ({
|
|
|
7383
7399
|
}
|
|
7384
7400
|
iterator.discard(3);
|
|
7385
7401
|
iterator.discard(4);
|
|
7386
|
-
const hdlrType = iterator.getByteString(4);
|
|
7402
|
+
const hdlrType = iterator.getByteString(4, false);
|
|
7387
7403
|
iterator.discard(4);
|
|
7388
7404
|
iterator.discard(4);
|
|
7389
7405
|
iterator.discard(4);
|
|
@@ -7401,7 +7417,7 @@ var parseHdlr = ({
|
|
|
7401
7417
|
// src/boxes/iso-base-media/meta/ilst.ts
|
|
7402
7418
|
var parseFromWellKnownType = (wellKnownType, iterator, size) => {
|
|
7403
7419
|
if (wellKnownType === 1) {
|
|
7404
|
-
const value = iterator.getByteString(size);
|
|
7420
|
+
const value = iterator.getByteString(size, false);
|
|
7405
7421
|
return { type: "text", value };
|
|
7406
7422
|
}
|
|
7407
7423
|
if (wellKnownType === 21) {
|
|
@@ -7612,33 +7628,33 @@ var parseIccProfile = (data) => {
|
|
|
7612
7628
|
if (size !== data.length) {
|
|
7613
7629
|
throw new Error("Invalid ICC profile size");
|
|
7614
7630
|
}
|
|
7615
|
-
const preferredCMMType = iterator.getByteString(4);
|
|
7616
|
-
const profileVersion = iterator.getByteString(4);
|
|
7617
|
-
const profileDeviceClass = iterator.getByteString(4);
|
|
7618
|
-
const colorSpace = iterator.getByteString(4);
|
|
7619
|
-
const pcs = iterator.getByteString(4);
|
|
7631
|
+
const preferredCMMType = iterator.getByteString(4, false);
|
|
7632
|
+
const profileVersion = iterator.getByteString(4, false);
|
|
7633
|
+
const profileDeviceClass = iterator.getByteString(4, false);
|
|
7634
|
+
const colorSpace = iterator.getByteString(4, false);
|
|
7635
|
+
const pcs = iterator.getByteString(4, false);
|
|
7620
7636
|
const dateTime = iterator.getSlice(12);
|
|
7621
|
-
const signature = iterator.getByteString(4);
|
|
7637
|
+
const signature = iterator.getByteString(4, false);
|
|
7622
7638
|
if (signature !== "acsp") {
|
|
7623
7639
|
throw new Error("Invalid ICC profile signature");
|
|
7624
7640
|
}
|
|
7625
|
-
const primaryPlatform = iterator.getByteString(4);
|
|
7641
|
+
const primaryPlatform = iterator.getByteString(4, false);
|
|
7626
7642
|
const profileFlags = iterator.getUint32();
|
|
7627
|
-
const deviceManufacturer = iterator.getByteString(4);
|
|
7628
|
-
const deviceModel = iterator.getByteString(4);
|
|
7643
|
+
const deviceManufacturer = iterator.getByteString(4, false);
|
|
7644
|
+
const deviceModel = iterator.getByteString(4, false);
|
|
7629
7645
|
const deviceAttributes = iterator.getUint64();
|
|
7630
7646
|
const renderingIntent = iterator.getUint32();
|
|
7631
7647
|
const pcsIlluminant1 = iterator.getUint32();
|
|
7632
7648
|
const pcsIlluminant2 = iterator.getUint32();
|
|
7633
7649
|
const pcsIlluminant3 = iterator.getUint32();
|
|
7634
|
-
const profileCreator = iterator.getByteString(4);
|
|
7635
|
-
const profileId = iterator.getByteString(16);
|
|
7650
|
+
const profileCreator = iterator.getByteString(4, false);
|
|
7651
|
+
const profileId = iterator.getByteString(16, false);
|
|
7636
7652
|
iterator.discard(28);
|
|
7637
7653
|
const tagCount = iterator.getUint32();
|
|
7638
7654
|
const entries = [];
|
|
7639
7655
|
for (let i = 0;i < tagCount; i++) {
|
|
7640
7656
|
const entry = {
|
|
7641
|
-
tag: iterator.getByteString(4),
|
|
7657
|
+
tag: iterator.getByteString(4, false),
|
|
7642
7658
|
offset: iterator.getUint32(),
|
|
7643
7659
|
size: iterator.getUint32()
|
|
7644
7660
|
};
|
|
@@ -7715,7 +7731,7 @@ var parseColorParameterBox = ({
|
|
|
7715
7731
|
iterator,
|
|
7716
7732
|
size
|
|
7717
7733
|
}) => {
|
|
7718
|
-
const byteString = iterator.getByteString(4);
|
|
7734
|
+
const byteString = iterator.getByteString(4, false);
|
|
7719
7735
|
if (byteString === "nclx") {
|
|
7720
7736
|
const primaries2 = iterator.getUint16();
|
|
7721
7737
|
const transfer = iterator.getUint16();
|
|
@@ -7821,7 +7837,7 @@ var parseKeys = ({
|
|
|
7821
7837
|
for (let i = 0;i < entryCount; i++) {
|
|
7822
7838
|
const keySize = iterator.getUint32();
|
|
7823
7839
|
const namespace = iterator.getAtom();
|
|
7824
|
-
const value = iterator.getByteString(keySize - 8);
|
|
7840
|
+
const value = iterator.getByteString(keySize - 8, false);
|
|
7825
7841
|
const entry = {
|
|
7826
7842
|
keySize,
|
|
7827
7843
|
namespace,
|
|
@@ -8749,7 +8765,7 @@ var processBox = async ({
|
|
|
8749
8765
|
skipTo: null
|
|
8750
8766
|
};
|
|
8751
8767
|
}
|
|
8752
|
-
const boxType = iterator.getByteString(4);
|
|
8768
|
+
const boxType = iterator.getByteString(4, false);
|
|
8753
8769
|
const boxSize = boxSizeRaw === 1 ? iterator.getEightByteNumber() : boxSizeRaw;
|
|
8754
8770
|
if (bytesRemaining < boxSize) {
|
|
8755
8771
|
if (boxType === "mdat") {
|
|
@@ -9328,7 +9344,7 @@ var isMoviAtom = (iterator, ckId) => {
|
|
|
9328
9344
|
if (ckId !== "LIST") {
|
|
9329
9345
|
return false;
|
|
9330
9346
|
}
|
|
9331
|
-
const listType = iterator.getByteString(4);
|
|
9347
|
+
const listType = iterator.getByteString(4, false);
|
|
9332
9348
|
iterator.counter.decrement(4);
|
|
9333
9349
|
return listType === "movi";
|
|
9334
9350
|
};
|
|
@@ -9660,7 +9676,7 @@ var parseMovi = async ({
|
|
|
9660
9676
|
}
|
|
9661
9677
|
};
|
|
9662
9678
|
}
|
|
9663
|
-
const ckId = iterator.getByteString(4);
|
|
9679
|
+
const ckId = iterator.getByteString(4, false);
|
|
9664
9680
|
const ckSize = iterator.getUint32Le();
|
|
9665
9681
|
if (maySkipVideoData({
|
|
9666
9682
|
state
|
|
@@ -9784,7 +9800,7 @@ var parseIsft = ({
|
|
|
9784
9800
|
size
|
|
9785
9801
|
}) => {
|
|
9786
9802
|
const { expectNoMoreBytes } = iterator.startBox(size);
|
|
9787
|
-
const software = iterator.getByteString(size - 1);
|
|
9803
|
+
const software = iterator.getByteString(size - 1, false);
|
|
9788
9804
|
const last = iterator.getUint8();
|
|
9789
9805
|
if (last !== 0) {
|
|
9790
9806
|
throw new Error(`Expected 0 byte, got ${last}`);
|
|
@@ -9803,7 +9819,7 @@ var parseListBox = async ({
|
|
|
9803
9819
|
state
|
|
9804
9820
|
}) => {
|
|
9805
9821
|
const counter = iterator.counter.getOffset();
|
|
9806
|
-
const listType = iterator.getByteString(4);
|
|
9822
|
+
const listType = iterator.getByteString(4, false);
|
|
9807
9823
|
if (listType === "movi") {
|
|
9808
9824
|
throw new Error("should not be handled here");
|
|
9809
9825
|
}
|
|
@@ -9862,7 +9878,7 @@ var parseStrfVideo = ({
|
|
|
9862
9878
|
const height = iterator.getInt32Le();
|
|
9863
9879
|
const planes = iterator.getUint16Le();
|
|
9864
9880
|
const bitCount = iterator.getUint16Le();
|
|
9865
|
-
const compression = iterator.getByteString(4);
|
|
9881
|
+
const compression = iterator.getByteString(4, false);
|
|
9866
9882
|
const sizeImage = iterator.getUint32Le();
|
|
9867
9883
|
const xPelsPerMeter = iterator.getInt32Le();
|
|
9868
9884
|
const yPelsPerMeter = iterator.getInt32Le();
|
|
@@ -9908,11 +9924,11 @@ var parseStrh = ({
|
|
|
9908
9924
|
size
|
|
9909
9925
|
}) => {
|
|
9910
9926
|
const box = iterator.startBox(size);
|
|
9911
|
-
const fccType = iterator.getByteString(4);
|
|
9927
|
+
const fccType = iterator.getByteString(4, false);
|
|
9912
9928
|
if (fccType !== "vids" && fccType !== "auds") {
|
|
9913
9929
|
throw new Error("Expected AVI handler to be vids / auds");
|
|
9914
9930
|
}
|
|
9915
|
-
const handler = fccType === "vids" ? iterator.getByteString(4) : iterator.getUint32Le();
|
|
9931
|
+
const handler = fccType === "vids" ? iterator.getByteString(4, false) : iterator.getUint32Le();
|
|
9916
9932
|
if (typeof handler === "string" && handler !== "H264") {
|
|
9917
9933
|
throw new Error(`Only H264 is supported as a stream type in .avi, got ${handler}`);
|
|
9918
9934
|
}
|
|
@@ -9998,7 +10014,7 @@ var expectRiffBox = async ({
|
|
|
9998
10014
|
}
|
|
9999
10015
|
};
|
|
10000
10016
|
}
|
|
10001
|
-
const ckId = iterator.getByteString(4);
|
|
10017
|
+
const ckId = iterator.getByteString(4, false);
|
|
10002
10018
|
const ckSize = iterator.getUint32Le();
|
|
10003
10019
|
if (isMoviAtom(iterator, ckId)) {
|
|
10004
10020
|
iterator.discard(4);
|
|
@@ -10156,7 +10172,7 @@ var parseRiff = ({
|
|
|
10156
10172
|
state,
|
|
10157
10173
|
fields
|
|
10158
10174
|
}) => {
|
|
10159
|
-
const riff = iterator.getByteString(4);
|
|
10175
|
+
const riff = iterator.getByteString(4, false);
|
|
10160
10176
|
if (riff !== "RIFF") {
|
|
10161
10177
|
throw new Error("Not a RIFF file");
|
|
10162
10178
|
}
|
|
@@ -10165,7 +10181,7 @@ var parseRiff = ({
|
|
|
10165
10181
|
throw new Error("Structure is not a RIFF structure");
|
|
10166
10182
|
}
|
|
10167
10183
|
const size = iterator.getUint32Le();
|
|
10168
|
-
const fileType = iterator.getByteString(4);
|
|
10184
|
+
const fileType = iterator.getByteString(4, false);
|
|
10169
10185
|
if (fileType !== "WAVE" && fileType !== "AVI") {
|
|
10170
10186
|
throw new Error(`File type ${fileType} not supported`);
|
|
10171
10187
|
}
|
|
@@ -11087,7 +11103,7 @@ var parseEbml = async (iterator, state) => {
|
|
|
11087
11103
|
};
|
|
11088
11104
|
}
|
|
11089
11105
|
if (hasInMap.type === "string") {
|
|
11090
|
-
const value = iterator.getByteString(size);
|
|
11106
|
+
const value = iterator.getByteString(size, true);
|
|
11091
11107
|
return {
|
|
11092
11108
|
type: hasInMap.name,
|
|
11093
11109
|
value,
|
|
@@ -11907,10 +11923,12 @@ var sampleCallback = ({
|
|
|
11907
11923
|
if (typeof samplesForTrack[trackId] === "undefined") {
|
|
11908
11924
|
samplesForTrack[trackId] = 0;
|
|
11909
11925
|
}
|
|
11910
|
-
samplesForTrack[trackId]++;
|
|
11911
11926
|
const callback = audioSampleCallbacks[trackId];
|
|
11912
|
-
if (
|
|
11913
|
-
|
|
11927
|
+
if (audioSample.data.length > 0) {
|
|
11928
|
+
samplesForTrack[trackId]++;
|
|
11929
|
+
if (callback) {
|
|
11930
|
+
await callback(audioSample);
|
|
11931
|
+
}
|
|
11914
11932
|
}
|
|
11915
11933
|
},
|
|
11916
11934
|
getSamplesForTrack: (trackId) => {
|
|
@@ -11923,10 +11941,12 @@ var sampleCallback = ({
|
|
|
11923
11941
|
if (typeof samplesForTrack[trackId] === "undefined") {
|
|
11924
11942
|
samplesForTrack[trackId] = 0;
|
|
11925
11943
|
}
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11944
|
+
if (videoSample.data.length > 0) {
|
|
11945
|
+
samplesForTrack[trackId]++;
|
|
11946
|
+
const callback = videoSampleCallbacks[trackId];
|
|
11947
|
+
if (callback) {
|
|
11948
|
+
await callback(videoSample);
|
|
11949
|
+
}
|
|
11930
11950
|
}
|
|
11931
11951
|
if (needsToIterateOverSamples({
|
|
11932
11952
|
fields,
|
|
@@ -14,7 +14,8 @@ const isRiffAvi = (data) => {
|
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
16
|
const fileType = data.subarray(8, 12);
|
|
17
|
-
|
|
17
|
+
const aviPattern = new Uint8Array([0x41, 0x56, 0x49, 0x20]);
|
|
18
|
+
return (0, exports.matchesPattern)(aviPattern)(fileType);
|
|
18
19
|
};
|
|
19
20
|
exports.isRiffAvi = isRiffAvi;
|
|
20
21
|
const isRiffWave = (data) => {
|
|
@@ -23,7 +24,8 @@ const isRiffWave = (data) => {
|
|
|
23
24
|
return false;
|
|
24
25
|
}
|
|
25
26
|
const fileType = data.subarray(8, 12);
|
|
26
|
-
|
|
27
|
+
const wavePattern = new Uint8Array([0x57, 0x41, 0x56, 0x45]);
|
|
28
|
+
return (0, exports.matchesPattern)(wavePattern)(fileType);
|
|
27
29
|
};
|
|
28
30
|
exports.isRiffWave = isRiffWave;
|
|
29
31
|
const isWebm = (data) => {
|
|
@@ -11,7 +11,7 @@ type AudioCodecInfo = {
|
|
|
11
11
|
secondarySpecificator: number | null;
|
|
12
12
|
description: Uint8Array | undefined;
|
|
13
13
|
};
|
|
14
|
-
export declare const getCodecPrivateFromTrak: (trakBox: TrakBox) => Uint8Array
|
|
14
|
+
export declare const getCodecPrivateFromTrak: (trakBox: TrakBox) => Uint8Array | null;
|
|
15
15
|
export declare const getNumberOfChannelsFromTrak: (trak: TrakBox) => number | null;
|
|
16
16
|
export declare const getSampleRate: (trak: TrakBox) => number | null;
|
|
17
17
|
export declare const getAudioCodecFromTrak: (trak: TrakBox) => AudioCodecInfo | null;
|
|
@@ -36,10 +36,13 @@ const sampleCallback = ({ signal, hasAudioTrackHandlers, hasVideoTrackHandlers,
|
|
|
36
36
|
if (typeof samplesForTrack[trackId] === 'undefined') {
|
|
37
37
|
samplesForTrack[trackId] = 0;
|
|
38
38
|
}
|
|
39
|
-
samplesForTrack[trackId]++;
|
|
40
39
|
const callback = audioSampleCallbacks[trackId];
|
|
41
|
-
if (
|
|
42
|
-
|
|
40
|
+
if (audioSample.data.length > 0) {
|
|
41
|
+
samplesForTrack[trackId]++;
|
|
42
|
+
// If we emit samples with data length 0, Chrome will fail
|
|
43
|
+
if (callback) {
|
|
44
|
+
await callback(audioSample);
|
|
45
|
+
}
|
|
43
46
|
}
|
|
44
47
|
},
|
|
45
48
|
getSamplesForTrack: (trackId) => {
|
|
@@ -53,11 +56,13 @@ const sampleCallback = ({ signal, hasAudioTrackHandlers, hasVideoTrackHandlers,
|
|
|
53
56
|
if (typeof samplesForTrack[trackId] === 'undefined') {
|
|
54
57
|
samplesForTrack[trackId] = 0;
|
|
55
58
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
if (videoSample.data.length > 0) {
|
|
60
|
+
samplesForTrack[trackId]++;
|
|
61
|
+
const callback = videoSampleCallbacks[trackId];
|
|
62
|
+
// If we emit samples with data 0, Chrome will fail
|
|
63
|
+
if (callback) {
|
|
64
|
+
await callback(videoSample);
|
|
65
|
+
}
|
|
61
66
|
}
|
|
62
67
|
if ((0, need_samples_for_fields_1.needsToIterateOverSamples)({
|
|
63
68
|
fields,
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.244";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
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.
|
|
6
|
+
"version": "4.0.244",
|
|
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.14.0",
|
|
12
|
-
"@remotion/example-videos": "4.0.
|
|
13
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
12
|
+
"@remotion/example-videos": "4.0.244",
|
|
13
|
+
"@remotion/eslint-config-internal": "4.0.244"
|
|
14
14
|
},
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|