Skip to content

🎥 Make videos programmatically with React

multiple samples can have the same index?

Jonny Burgerdf4598086ba6
diff --git a/packages/media-parser/src/boxes/iso-base-media/get-sample-positions-from-track.ts b/packages/media-parser/src/boxes/iso-base-media/get-sample-positions-from-track.ts
new file mode 100644
index 0000000000..93b6a396ff
--- /dev/null
+++ b/packages/media-parser/src/boxes/iso-base-media/get-sample-positions-from-track.ts
@@ -0,0 +1,69 @@
+import {getTimescaleAndDuration} from '../../get-fps';
+import type {SamplePosition} from '../../get-sample-positions';
+import {getSamplePositions} from '../../get-sample-positions';
+import type {IsoBaseMediaBox} from '../../parse-result';
+import {getSamplesFromMoof} from '../../samples-from-moof';
+import {
+ getCttsBox,
+ getStcoBox,
+ getStscBox,
+ getStssBox,
+ getStszBox,
+ getSttsBox,
+ getTkhdBox,
+} from '../../traversal';
+import type {TrakBox} from './trak/trak';
+
+export const getSamplePositionsFromTrack = (
+ trakBox: TrakBox,
+ moofBox: IsoBaseMediaBox | null,
+): SamplePosition[] => {
+ const stszBox = getStszBox(trakBox);
+ const stcoBox = getStcoBox(trakBox);
+ const stscBox = getStscBox(trakBox);
+ const stssBox = getStssBox(trakBox);
+ const sttsBox = getSttsBox(trakBox);
+ const tkhdBox = getTkhdBox(trakBox);
+ const cttsBox = getCttsBox(trakBox);
+
+ const timescaleAndDuration = getTimescaleAndDuration(trakBox);
+
+ if (!tkhdBox) {
+ throw new Error('Expected tkhd box in trak box');
+ }
+
+ if (!stszBox) {
+ throw new Error('Expected stsz box in trak box');
+ }
+
+ if (!stcoBox) {
+ throw new Error('Expected stco box in trak box');
+ }
+
+ if (!stscBox) {
+ throw new Error('Expected stsc box in trak box');
+ }
+
+ if (!sttsBox) {
+ throw new Error('Expected stts box in trak box');
+ }
+
+ if (!timescaleAndDuration) {
+ throw new Error('Expected timescale and duration in trak box');
+ }
+
+ let samplePositions = getSamplePositions({
+ stcoBox,
+ stscBox,
+ stszBox,
+ stssBox,
+ sttsBox,
+ cttsBox,
+ });
+
+ if (samplePositions.length === 0 && moofBox) {
+ samplePositions = getSamplesFromMoof({moofBox, trackId: tkhdBox.trackId});
+ }
+
+ return samplePositions;
+};
diff --git a/packages/media-parser/src/boxes/iso-base-media/make-track.ts b/packages/media-parser/src/boxes/iso-base-media/make-track.ts
index 8b794b2e20..7614dd3643 100644
--- a/packages/media-parser/src/boxes/iso-base-media/make-track.ts
+++ b/packages/media-parser/src/boxes/iso-base-media/make-track.ts
@@ -15,34 +15,15 @@ import {
getSampleAspectRatio,
getVideoSample,
} from '../../get-sample-aspect-ratio';
-import {getSamplePositions} from '../../get-sample-positions';
import type {AudioTrack, OtherTrack, VideoTrack} from '../../get-tracks';
import {getVideoCodecString} from '../../get-video-codec';
-import type {AnySegment} from '../../parse-result';
-import {getSamplesFromMoof} from '../../samples-from-moof';
-import {
- getCttsBox,
- getStcoBox,
- getStscBox,
- getStssBox,
- getStszBox,
- getSttsBox,
- getTkhdBox,
- getVideoDescriptors,
-} from '../../traversal';
+import {getTkhdBox, getVideoDescriptors} from '../../traversal';
import type {TrakBox} from './trak/trak';
export const makeBaseMediaTrack = (
trakBox: TrakBox,
- moofBox: AnySegment | null,
): VideoTrack | AudioTrack | OtherTrack | null => {
- const stszBox = getStszBox(trakBox);
- const stcoBox = getStcoBox(trakBox);
- const stscBox = getStscBox(trakBox);
- const stssBox = getStssBox(trakBox);
- const sttsBox = getSttsBox(trakBox);
const tkhdBox = getTkhdBox(trakBox);
- const cttsBox = getCttsBox(trakBox);
const videoDescriptors = getVideoDescriptors(trakBox);
const timescaleAndDuration = getTimescaleAndDuration(trakBox);
@@ -51,39 +32,10 @@ export const makeBaseMediaTrack = (
throw new Error('Expected tkhd box in trak box');
}
- if (!stszBox) {
- throw new Error('Expected stsz box in trak box');
- }
-
- if (!stcoBox) {
- throw new Error('Expected stco box in trak box');
- }
-
- if (!stscBox) {
- throw new Error('Expected stsc box in trak box');
- }
-
- if (!sttsBox) {
- throw new Error('Expected stts box in trak box');
- }
-
if (!timescaleAndDuration) {
throw new Error('Expected timescale and duration in trak box');
}
- let samplePositions = getSamplePositions({
- stcoBox,
- stscBox,
- stszBox,
- stssBox,
- sttsBox,
- cttsBox,
- });
-
- if (samplePositions.length === 0 && moofBox) {
- samplePositions = getSamplesFromMoof({moofBox, trackId: tkhdBox.trackId});
- }
-
if (trakBoxContainsAudio(trakBox)) {
const numberOfChannels = getNumberOfChannelsFromTrak(trakBox);
if (numberOfChannels === null) {
@@ -99,22 +51,22 @@ export const makeBaseMediaTrack = (
return {
type: 'audio',
- samplePositions,
trackId: tkhdBox.trackId,
timescale: timescaleAndDuration.timescale,
codec: codecString,
numberOfChannels,
sampleRate,
description,
+ trakBox,
};
}
if (!trakBoxContainsVideo(trakBox)) {
return {
type: 'other',
- samplePositions,
trackId: tkhdBox.trackId,
timescale: timescaleAndDuration.timescale,
+ trakBox,
};
}
@@ -145,7 +97,6 @@ export const makeBaseMediaTrack = (
const track: VideoTrack = {
type: 'video',
- samplePositions,
trackId: tkhdBox.trackId,
description: videoDescriptors ?? undefined,
timescale: timescaleAndDuration.timescale,
@@ -159,6 +110,7 @@ export const makeBaseMediaTrack = (
displayAspectWidth,
displayAspectHeight,
rotation,
+ trakBox,
};
return track;
};
diff --git a/packages/media-parser/src/boxes/iso-base-media/mdat/mdat.ts b/packages/media-parser/src/boxes/iso-base-media/mdat/mdat.ts
index d53239e74d..e7f7c3a491 100644
--- a/packages/media-parser/src/boxes/iso-base-media/mdat/mdat.ts
+++ b/packages/media-parser/src/boxes/iso-base-media/mdat/mdat.ts
@@ -3,6 +3,9 @@ import type {BufferIterator} from '../../../buffer-iterator';
import {getTracks, hasTracks} from '../../../get-tracks';
import type {AnySegment} from '../../../parse-result';
import type {ParserContext} from '../../../parser-context';
+import {getMoofBox} from '../../../traversal';
+import {getSamplePositionsFromTrack} from '../get-sample-positions-from-track';
+import type {TrakBox} from '../trak/trak';
export interface MdatBox {
type: 'mdat-box';
@@ -44,13 +47,17 @@ export const parseMdat = async ({
const flatSamples = allTracks
.map((track) => {
- if (!track.samplePositions) {
+ const samplePositions = getSamplePositionsFromTrack(
+ track.trakBox as TrakBox,
+ getMoofBox(existingBoxes),
+ );
+ if (!samplePositions) {
throw new Error('No sample positions');
}
- return track.samplePositions.map((samplePosition) => {
+ return samplePositions.map((samplePosition) => {
return {
- track,
+ track: {...track},
samplePosition,
};
});
@@ -59,10 +66,10 @@ export const parseMdat = async ({
// eslint-disable-next-line no-constant-condition
while (true) {
- const sampleWithIndex = flatSamples.find((sample) => {
+ const samplesWithIndex = flatSamples.find((sample) => {
return sample.samplePosition.offset === data.counter.getOffset();
});
- if (!sampleWithIndex) {
+ if (!samplesWithIndex) {
// There are various reasons why in mdat we find weird stuff:
// - iphonevideo.hevc has a fake hoov atom which is not mapped
// - corrupted.mp4 has a corrupt table
@@ -77,44 +84,43 @@ export const parseMdat = async ({
} else {
const bytesRemaining = size + fileOffset - data.counter.getOffset();
data.discard(bytesRemaining);
- console.log('no next sample', data.counter.getOffset());
break;
}
}
- if (data.bytesRemaining() < sampleWithIndex.samplePosition.size) {
+ if (data.bytesRemaining() < samplesWithIndex.samplePosition.size) {
break;
}
- const bytes = data.getSlice(sampleWithIndex.samplePosition.size);
+ const bytes = data.getSlice(samplesWithIndex.samplePosition.size);
- if (sampleWithIndex.track.type === 'audio') {
- await options.parserState.onAudioSample(sampleWithIndex.track.trackId, {
+ if (samplesWithIndex.track.type === 'audio') {
+ await options.parserState.onAudioSample(samplesWithIndex.track.trackId, {
data: bytes,
- timestamp: sampleWithIndex.samplePosition.offset,
- trackId: sampleWithIndex.track.trackId,
- type: sampleWithIndex.samplePosition.isKeyframe ? 'key' : 'delta',
+ timestamp: samplesWithIndex.samplePosition.offset,
+ trackId: samplesWithIndex.track.trackId,
+ type: samplesWithIndex.samplePosition.isKeyframe ? 'key' : 'delta',
});
}
- if (sampleWithIndex.track.type === 'video') {
+ if (samplesWithIndex.track.type === 'video') {
const timestamp = Math.floor(
- (sampleWithIndex.samplePosition.cts * 1_000_000) /
- sampleWithIndex.track.timescale,
+ (samplesWithIndex.samplePosition.cts * 1_000_000) /
+ samplesWithIndex.track.timescale,
);
const duration = Math.floor(
- (sampleWithIndex.samplePosition.duration * 1_000_000) /
- sampleWithIndex.track.timescale,
+ (samplesWithIndex.samplePosition.duration * 1_000_000) /
+ samplesWithIndex.track.timescale,
);
- await options.parserState.onVideoSample(sampleWithIndex.track.trackId, {
+ await options.parserState.onVideoSample(samplesWithIndex.track.trackId, {
data: bytes,
timestamp,
duration,
- cts: sampleWithIndex.samplePosition.cts,
- dts: sampleWithIndex.samplePosition.dts,
- trackId: sampleWithIndex.track.trackId,
- type: sampleWithIndex.samplePosition.isKeyframe ? 'key' : 'delta',
+ cts: samplesWithIndex.samplePosition.cts,
+ dts: samplesWithIndex.samplePosition.dts,
+ trackId: samplesWithIndex.track.trackId,
+ type: samplesWithIndex.samplePosition.isKeyframe ? 'key' : 'delta',
});
}
diff --git a/packages/media-parser/src/boxes/iso-base-media/process-box.ts b/packages/media-parser/src/boxes/iso-base-media/process-box.ts
index d39e407e69..081e887753 100644
--- a/packages/media-parser/src/boxes/iso-base-media/process-box.ts
+++ b/packages/media-parser/src/boxes/iso-base-media/process-box.ts
@@ -434,8 +434,7 @@ export const processBox = async ({
offsetAtStart: fileOffset,
options,
});
- // TODO: Hmm
- const transformedTrack = makeBaseMediaTrack(box, null);
+ const transformedTrack = makeBaseMediaTrack(box);
if (transformedTrack) {
if (transformedTrack.type === 'audio') {
const callback = await options.onAudioTrack?.(transformedTrack);
diff --git a/packages/media-parser/src/boxes/webm/get-track.ts b/packages/media-parser/src/boxes/webm/get-track.ts
index 61342b9861..b545f86ea8 100644
--- a/packages/media-parser/src/boxes/webm/get-track.ts
+++ b/packages/media-parser/src/boxes/webm/get-track.ts
@@ -221,7 +221,6 @@ export const getTrack = ({
denominator: 1,
},
timescale,
- samplePositions: [],
codedHeight: height.value.value,
codedWidth: width.value.value,
displayAspectHeight: displayHeight
@@ -231,6 +230,7 @@ export const getTrack = ({
? displayWidth.value.value
: width.value.value,
rotation: 0,
+ trakBox: null,
};
}
@@ -245,11 +245,11 @@ export const getTrack = ({
type: 'audio',
trackId,
codec: getMatroskaAudioCodecString(track),
- samplePositions: null,
timescale,
numberOfChannels,
sampleRate,
description: getAudioDescription(track),
+ trakBox: null,
};
}
diff --git a/packages/media-parser/src/get-duration.ts b/packages/media-parser/src/get-duration.ts
index 97ac0ff4a4..5e3ea60b3a 100644
--- a/packages/media-parser/src/get-duration.ts
+++ b/packages/media-parser/src/get-duration.ts
@@ -1,8 +1,10 @@
+import {getSamplePositionsFromTrack} from './boxes/iso-base-media/get-sample-positions-from-track';
+import type {TrakBox} from './boxes/iso-base-media/trak/trak';
import type {DurationSegment} from './boxes/webm/segments/all-segments';
import {getTracks} from './get-tracks';
import type {AnySegment} from './parse-result';
import type {ParserState} from './parser-state';
-import {getMoovBox, getMvhdBox} from './traversal';
+import {getMoofBox, getMoovBox, getMvhdBox} from './traversal';
const getDurationFromMatroska = (segments: AnySegment[]): number | null => {
const mainSegment = segments.find((s) => s.type === 'Segment');
@@ -51,6 +53,7 @@ export const getDuration = (
return null;
}
+ const moofBox = getMoofBox(boxes);
const mvhdBox = getMvhdBox(moovBox);
if (!mvhdBox) {
@@ -73,7 +76,12 @@ export const getDuration = (
];
const allSamples = allTracks.map((t) => {
const {timescale: ts} = t;
- const highest = t.samplePositions
+ const samplePositions = getSamplePositionsFromTrack(
+ t.trakBox as TrakBox,
+ moofBox,
+ );
+
+ const highest = samplePositions
?.map((sp) => (sp.cts + sp.duration) / ts)
.reduce((a, b) => Math.max(a, b), 0);
return highest ?? 0;
diff --git a/packages/media-parser/src/get-tracks.ts b/packages/media-parser/src/get-tracks.ts
index 325e7259ea..dbcf7797aa 100644
--- a/packages/media-parser/src/get-tracks.ts
+++ b/packages/media-parser/src/get-tracks.ts
@@ -1,17 +1,11 @@
import {makeBaseMediaTrack} from './boxes/iso-base-media/make-track';
import type {MoovBox} from './boxes/iso-base-media/moov/moov';
+import type {TrakBox} from './boxes/iso-base-media/trak/trak';
import {getTracksFromMatroska} from './boxes/webm/get-ready-tracks';
import {getMainSegment} from './boxes/webm/traversal';
-import type {SamplePosition} from './get-sample-positions';
import type {AnySegment} from './parse-result';
import type {ParserState} from './parser-state';
-import {
- getMoofBox,
- getMoovBox,
- getMvhdBox,
- getTracksSegment,
- getTraks,
-} from './traversal';
+import {getMoovBox, getMvhdBox, getTracksSegment, getTraks} from './traversal';
type SampleAspectRatio = {
numerator: number;
@@ -20,7 +14,6 @@ type SampleAspectRatio = {
export type VideoTrack = {
type: 'video';
- samplePositions: SamplePosition[] | null;
trackId: number;
description: Uint8Array | undefined;
timescale: number;
@@ -33,24 +26,25 @@ export type VideoTrack = {
codedWidth: number;
codedHeight: number;
rotation: number;
+ trakBox: TrakBox | null;
};
export type AudioTrack = {
type: 'audio';
- samplePositions: SamplePosition[] | null;
trackId: number;
timescale: number;
codec: string;
numberOfChannels: number;
sampleRate: number;
description: Uint8Array | undefined;
+ trakBox: TrakBox | null;
};
export type OtherTrack = {
type: 'other';
- samplePositions: SamplePosition[] | null;
trackId: number;
timescale: number;
+ trakBox: TrakBox | null;
};
export type Track = VideoTrack | AudioTrack | OtherTrack;
@@ -131,7 +125,7 @@ export const getTracks = (
const tracks = getTraks(moovBox);
for (const trakBox of tracks) {
- const track = makeBaseMediaTrack(trakBox, getMoofBox(segments));
+ const track = makeBaseMediaTrack(trakBox);
if (!track) {
continue;
}
diff --git a/packages/media-parser/src/samples-from-moof.ts b/packages/media-parser/src/samples-from-moof.ts
index 1b3fb548b9..27908e80f9 100644
--- a/packages/media-parser/src/samples-from-moof.ts
+++ b/packages/media-parser/src/samples-from-moof.ts
@@ -13,7 +13,7 @@ const getSamplesFromTraf = (
const tfhdBox = getTfhdBox(trafSegment);
const defaultSampleDuration = tfhdBox?.defaultSampleDuration ?? null;
const defaultSampleSize = tfhdBox?.defaultSampleSize ?? null;
- const defaultSampleFalgs = tfhdBox?.defaultSampleFlags ?? null;
+ const defaultSampleFlags = tfhdBox?.defaultSampleFlags ?? null;
const tfdtBox = getTfdtBox(trafSegment);
const trunBoxes = getTrunBoxes(trafSegment);
@@ -49,7 +49,7 @@ const getSamplesFromTraf = (
? sample.sampleFlags
: isFirstSample && trunBox.firstSampleFlags !== null
? trunBox.firstSampleFlags
- : defaultSampleFalgs;
+ : defaultSampleFlags;
if (sampleFlags === null) {
throw new Error('Expected sample flags');
}
diff --git a/packages/media-parser/src/test/samples-from-moof.test.ts b/packages/media-parser/src/test/samples-from-moof.test.ts
index c55f51f7df..ef1bf84164 100644
--- a/packages/media-parser/src/test/samples-from-moof.test.ts
+++ b/packages/media-parser/src/test/samples-from-moof.test.ts
@@ -2360,6 +2360,7 @@ test('Should be able to parse audio sample positions from a moof atom', () => {
});
const samples = samplesFromMoof.slice(0, 15);
+ const lastSample = samplesFromMoof[samplesFromMoof.length - 1];
expect(samplesFromMoof.length).toBe(201);
expect(samples).toEqual([
{
@@ -2483,4 +2484,13 @@ test('Should be able to parse audio sample positions from a moof atom', () => {
size: 376,
},
]);
+
+ expect(lastSample).toEqual({
+ cts: 204800,
+ dts: 204800,
+ duration: 1024,
+ isKeyframe: true,
+ offset: 664534,
+ size: 698,
+ });
});
diff --git a/packages/media-parser/src/test/stream-samples.test.ts b/packages/media-parser/src/test/stream-samples.test.ts
index 28f0880b3c..0c18c0fb12 100644
--- a/packages/media-parser/src/test/stream-samples.test.ts
+++ b/packages/media-parser/src/test/stream-samples.test.ts
@@ -1,5 +1,7 @@
import {RenderInternals} from '@remotion/renderer';
import {expect, test} from 'bun:test';
+import {getSamplePositionsFromTrack} from '../boxes/iso-base-media/get-sample-positions-from-track';
+import type {TrakBox} from '../boxes/iso-base-media/trak/trak';
import {nodeReader} from '../from-node';
import {parseMedia} from '../parse-media';
@@ -20,240 +22,160 @@ test('Stream samples', async () => {
140, 176, 1, 0, 6, 104, 235, 224, 140, 178, 44, 253, 248, 248, 0,
]);
- expect(videoTracks).toEqual([
- {
- type: 'video',
- trackId: 1,
- samplePositions: [
- {
- offset: 1637,
- size: 4834,
- isKeyframe: true,
- dts: 0,
- duration: 512,
- cts: 1024,
- },
- {
- offset: 6471,
- size: 437,
- isKeyframe: false,
- dts: 512,
- duration: 512,
- cts: 1536,
- },
- {
- offset: 7868,
- size: 698,
- isKeyframe: false,
- dts: 1024,
- duration: 512,
- cts: 2048,
- },
- {
- offset: 10486,
- size: 595,
- isKeyframe: false,
- dts: 1536,
- duration: 512,
- cts: 2560,
- },
- {
- offset: 12041,
- size: 548,
- isKeyframe: false,
- dts: 2048,
- duration: 512,
- cts: 3072,
- },
- {
- offset: 14509,
- size: 611,
- isKeyframe: false,
- dts: 2560,
- duration: 512,
- cts: 3584,
- },
- {
- offset: 16080,
- size: 701,
- isKeyframe: false,
- dts: 3072,
- duration: 512,
- cts: 4096,
- },
- {
- offset: 17741,
- size: 535,
- isKeyframe: false,
- dts: 3584,
- duration: 512,
- cts: 4608,
- },
- {
- offset: 20196,
- size: 776,
- isKeyframe: false,
- dts: 4096,
- duration: 512,
- cts: 5120,
- },
- {
- offset: 21932,
- size: 586,
- isKeyframe: false,
- dts: 4608,
- duration: 512,
- cts: 5632,
- },
- ],
- description,
- timescale: 15360,
- codec: 'avc1.640020',
- sampleAspectRatio: {
- numerator: 1,
- denominator: 1,
- },
- width: 1080,
- height: 1080,
- codedWidth: 1080,
- codedHeight: 1080,
- displayAspectHeight: 1080,
- displayAspectWidth: 1080,
- rotation: 0,
+ const {trakBox, ...trackInfo} = videoTracks[0];
+ expect(trackInfo).toEqual({
+ type: 'video',
+ trackId: 1,
+ description,
+ timescale: 15360,
+ codec: 'avc1.640020',
+ sampleAspectRatio: {
+ numerator: 1,
+ denominator: 1,
},
- ]);
+ width: 1080,
+ height: 1080,
+ codedWidth: 1080,
+ codedHeight: 1080,
+ displayAspectHeight: 1080,
+ displayAspectWidth: 1080,
+ rotation: 0,
+ });
+
+ expect(getSamplePositionsFromTrack(trakBox as TrakBox, null));
+
+ const [firstAudioTrack] = audioTracks;
+ const {trakBox: trakBox2, ...audioTrack} = firstAudioTrack;
- expect(audioTracks).toEqual([
+ expect(audioTrack).toEqual({
+ type: 'audio',
+ trackId: 2,
+ timescale: 48000,
+ numberOfChannels: 2,
+ codec: 'mp3',
+ sampleRate: 48000,
+ description: undefined,
+ });
+ expect(getSamplePositionsFromTrack(trakBox2 as TrakBox, null)).toEqual([
+ {
+ offset: 6908,
+ size: 960,
+ isKeyframe: true,
+ dts: 0,
+ duration: 1152,
+ cts: 0,
+ },
+ {
+ offset: 8566,
+ size: 960,
+ isKeyframe: true,
+ dts: 1152,
+ duration: 1152,
+ cts: 1152,
+ },
+ {
+ offset: 9526,
+ size: 960,
+ isKeyframe: true,
+ dts: 2304,
+ duration: 1152,
+ cts: 2304,
+ },
+ {
+ offset: 11081,
+ size: 960,
+ isKeyframe: true,
+ dts: 3456,
+ duration: 1152,
+ cts: 3456,
+ },
+ {
+ offset: 12589,
+ size: 960,
+ isKeyframe: true,
+ dts: 4608,
+ duration: 1152,
+ cts: 4608,
+ },
+ {
+ offset: 13549,
+ size: 960,
+ isKeyframe: true,
+ dts: 5760,
+ duration: 1152,
+ cts: 5760,
+ },
+ {
+ offset: 15120,
+ size: 960,
+ isKeyframe: true,
+ dts: 6912,
+ duration: 1152,
+ cts: 6912,
+ },
+ {
+ offset: 16781,
+ size: 960,
+ isKeyframe: true,
+ dts: 8064,
+ duration: 1152,
+ cts: 8064,
+ },
+ {
+ offset: 18276,
+ size: 960,
+ isKeyframe: true,
+ dts: 9216,
+ duration: 1152,
+ cts: 9216,
+ },
+ {
+ offset: 19236,
+ size: 960,
+ isKeyframe: true,
+ dts: 10368,
+ duration: 1152,
+ cts: 10368,
+ },
+ {
+ offset: 20972,
+ size: 960,
+ isKeyframe: true,
+ dts: 11520,
+ duration: 1152,
+ cts: 11520,
+ },
+ {
+ offset: 22518,
+ size: 960,
+ isKeyframe: true,
+ dts: 12672,
+ duration: 1152,
+ cts: 12672,
+ },
+ {
+ offset: 23478,
+ size: 960,
+ isKeyframe: true,
+ dts: 13824,
+ duration: 1152,
+ cts: 13824,
+ },
+ {
+ offset: 24438,
+ size: 960,
+ isKeyframe: true,
+ dts: 14976,
+ duration: 1152,
+ cts: 14976,
+ },
{
- type: 'audio',
- trackId: 2,
- samplePositions: [
- {
- offset: 6908,
- size: 960,
- isKeyframe: true,
- dts: 0,
- duration: 1152,
- cts: 0,
- },
- {
- offset: 8566,
- size: 960,
- isKeyframe: true,
- dts: 1152,
- duration: 1152,
- cts: 1152,
- },
- {
- offset: 9526,
- size: 960,
- isKeyframe: true,
- dts: 2304,
- duration: 1152,
- cts: 2304,
- },
- {
- offset: 11081,
- size: 960,
- isKeyframe: true,
- dts: 3456,
- duration: 1152,
- cts: 3456,
- },
- {
- offset: 12589,
- size: 960,
- isKeyframe: true,
- dts: 4608,
- duration: 1152,
- cts: 4608,
- },
- {
- offset: 13549,
- size: 960,
- isKeyframe: true,
- dts: 5760,
- duration: 1152,
- cts: 5760,
- },
- {
- offset: 15120,
- size: 960,
- isKeyframe: true,
- dts: 6912,
- duration: 1152,
- cts: 6912,
- },
- {
- offset: 16781,
- size: 960,
- isKeyframe: true,
- dts: 8064,
- duration: 1152,
- cts: 8064,
- },
- {
- offset: 18276,
- size: 960,
- isKeyframe: true,
- dts: 9216,
- duration: 1152,
- cts: 9216,
- },
- {
- offset: 19236,
- size: 960,
- isKeyframe: true,
- dts: 10368,
- duration: 1152,
- cts: 10368,
- },
- {
- offset: 20972,
- size: 960,
- isKeyframe: true,
- dts: 11520,
- duration: 1152,
- cts: 11520,
- },
- {
- offset: 22518,
- size: 960,
- isKeyframe: true,
- dts: 12672,
- duration: 1152,
- cts: 12672,
- },
- {
- offset: 23478,
- size: 960,
- isKeyframe: true,
- dts: 13824,
- duration: 1152,
- cts: 13824,
- },
- {
- offset: 24438,
- size: 960,
- isKeyframe: true,
- dts: 14976,
- duration: 1152,
- cts: 14976,
- },
- {
- offset: 25398,
- size: 960,
- isKeyframe: true,
- dts: 16128,
- duration: 1152,
- cts: 16128,
- },
- ],
- timescale: 48000,
- numberOfChannels: 2,
- codec: 'mp3',
- sampleRate: 48000,
- description: undefined,
+ offset: 25398,
+ size: 960,
+ isKeyframe: true,
+ dts: 16128,
+ duration: 1152,
+ cts: 16128,
},
]);
});