🎥 Make videos programmatically with React
get everything to work
Jonny Burger9b9a4c425e8b
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.tsindex b5d866895f..035e12f35d 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@@ -15,9 +15,9 @@ export const parseMdatSection = async ({iterator: BufferIterator;state: ParserState;}): Promise<number | null> => {+ const videoSection = state.videoSection.getVideoSection();// don't need mdat at all, can skipif (maySkipVideoData({state})) {- const videoSection = state.videoSection.getVideoSection();return videoSection.size + videoSection.start;}@@ -27,7 +27,6 @@ export const parseMdatSection = async ({if (state.supportsContentRange) {state.iso.setShouldReturnToVideoSectionAfterEnd(true);- const videoSection = state.videoSection.getVideoSection();return videoSection.size + videoSection.start;}@@ -82,7 +81,8 @@ export const parseMdatSection = async ({}// guess we reached the end!- return null;+ // iphonevideo.mov has extra padding here, so let's make sure to jump ahead+ return videoSection.size + videoSection.start;}if (iterator.bytesRemaining() < samplesWithIndex.samplePosition.size) {diff --git a/packages/media-parser/src/boxes/webm/parse-webm-header.ts b/packages/media-parser/src/boxes/webm/parse-webm-header.tsindex 3efff21ff4..a922a16422 100644--- a/packages/media-parser/src/boxes/webm/parse-webm-header.ts+++ b/packages/media-parser/src/boxes/webm/parse-webm-header.ts@@ -27,12 +27,47 @@ export const parseWebm = async ({});};+ const isInsideSegment = state.webm.isInsideSegment(iterator);+ const isInsideCluster = state.webm.isInsideCluster(iterator);+const results = await expectSegment({iterator,state,- fields,+ isInsideSegment,});- if (results !== null) {+ if (results === null) {+ return {+ status: 'incomplete',+ continueParsing,+ skipTo: null,+ };+ }++ if (isInsideCluster) {+ const segments = structure.boxes.filter((box) => box.type === 'Segment');+ const segment = segments[isInsideCluster.segment];+ if (!segment) {+ throw new Error('Expected segment');+ }++ const clusters = segment.value.find((box) => box.type === 'Cluster');+ if (!clusters) {+ throw new Error('Expected cluster');+ }++ // let's not add it to the cluster+ if (results.type !== 'Block' && results.type !== 'SimpleBlock') {+ clusters.value.push(results);+ }+ } else if (isInsideSegment) {+ const segments = structure.boxes.filter((box) => box.type === 'Segment');+ const segment = segments[isInsideSegment.index];+ if (!segment) {+ throw new Error('Expected segment');+ }++ segment.value.push(results);+ } else {structure.boxes.push(results);}diff --git a/packages/media-parser/src/boxes/webm/segments.ts b/packages/media-parser/src/boxes/webm/segments.tsindex 647342ee4d..2b282ff6a9 100644--- a/packages/media-parser/src/boxes/webm/segments.ts+++ b/packages/media-parser/src/boxes/webm/segments.ts@@ -1,16 +1,16 @@/* eslint-disable @typescript-eslint/no-use-before-define */import type {BufferIterator} from '../../buffer-iterator';import {Log} from '../../log';-import type {Options, ParseMediaFields} from '../../options';import type {ParserState} from '../../state/parser-state';+import type {SegmentSection} from '../../state/webm';import {parseEbml, postprocessEbml} from './parse-ebml';import type {ClusterSegment, MainSegment} from './segments/all-segments';import {ebmlMap,+ matroskaElements,type PossibleEbml,type TrackEntry,} from './segments/all-segments';-import {expectChildren} from './segments/parse-children';export type MatroskaSegment = PossibleEbml;@@ -19,11 +19,11 @@ export type OnTrackEntrySegment = (trackEntry: TrackEntry) => void;export const expectSegment = async ({iterator,state,- fields,+ isInsideSegment,}: {iterator: BufferIterator;state: ParserState;- fields: Options<ParseMediaFields>;+ isInsideSegment: SegmentSection | null;}): Promise<MatroskaSegment | null> => {if (iterator.bytesRemaining() === 0) {throw new Error('has no bytes');@@ -32,11 +32,6 @@ export const expectSegment = async ({const offset = iterator.counter.getOffset();const {returnToCheckpoint} = iterator.startCheckpoint();const segmentId = iterator.getMatroskaSegmentId();- Log.trace(- state.logLevel,- 'Segment ID:',- ebmlMap[segmentId as keyof typeof ebmlMap]?.name,- );if (segmentId === null) {returnToCheckpoint();@@ -44,35 +39,57 @@ export const expectSegment = async ({}const offsetBeforeVInt = iterator.counter.getOffset();- const length = iterator.getVint();+ const size = iterator.getVint();const offsetAfterVInt = iterator.counter.getOffset();- if (length === null) {+ if (size === null) {returnToCheckpoint();return null;}- const bytesRemainingNow =- iterator.byteLength() - iterator.counter.getOffset();+ const bytesRemainingNow = iterator.bytesRemaining();++ Log.trace(+ state.logLevel,+ 'Segment ID:',+ ebmlMap[segmentId as keyof typeof ebmlMap]?.name,+ 'Size:' + size,+ bytesRemainingNow,+ );- if (segmentId === '0x18538067' || segmentId === '0x1f43b675') {- const value = await expectChildren({- iterator,- length,- state,- startOffset: iterator.counter.getOffset(),- fields,+ if (segmentId === matroskaElements.Segment) {+ state.webm.addSegment({+ start: offset,+ size,});- const newSegment: ClusterSegment | MainSegment = {- type: segmentId === '0x18538067' ? 'Segment' : 'Cluster',+ const newSegment: MainSegment = {+ type: 'Segment',minVintWidth: offsetAfterVInt - offsetBeforeVInt,- value,+ value: [],};+ return newSegment;+ }++ if (segmentId === matroskaElements.Cluster) {+ if (isInsideSegment === null) {+ throw new Error('Expected to be inside segment');+ }+ state.webm.addCluster({+ start: offset,+ size,+ segment: isInsideSegment.index,+ });++ const newSegment: ClusterSegment = {+ type: 'Cluster',+ minVintWidth: offsetAfterVInt - offsetBeforeVInt,+ value: [],+ };return newSegment;}- if (bytesRemainingNow < length) {+ if (bytesRemainingNow < size) {returnToCheckpoint();return null;}@@ -80,7 +97,7 @@ export const expectSegment = async ({const segment = await parseSegment({segmentId,iterator,- length,+ length: size,state,headerReadSoFar: iterator.counter.getOffset() - offset,});diff --git a/packages/media-parser/src/boxes/webm/segments/parse-children.ts b/packages/media-parser/src/boxes/webm/segments/parse-children.tsdeleted file mode 100644index 3c20e0870a..0000000000--- a/packages/media-parser/src/boxes/webm/segments/parse-children.ts+++ /dev/null@@ -1,37 +0,0 @@-import type {BufferIterator} from '../../../buffer-iterator';-import type {Options, ParseMediaFields} from '../../../options';-import type {ParserState} from '../../../state/parser-state';-import {expectSegment} from '../segments';-import type {PossibleEbml} from './all-segments';--export const expectChildren = async ({- iterator,- length,- state,- startOffset,- fields,-}: {- iterator: BufferIterator;- length: number;- state: ParserState;- startOffset: number;- fields: Options<ParseMediaFields>;-}): Promise<PossibleEbml[]> => {- const children: PossibleEbml[] = [];- while (iterator.counter.getOffset() < startOffset + length) {- if (iterator.bytesRemaining() === 0) {- break;- }-- const child = await expectSegment({- iterator,- state,- fields,- });- if (child) {- children.push(child);- }- }-- return children;-};diff --git a/packages/media-parser/src/buffer-iterator.ts b/packages/media-parser/src/buffer-iterator.tsindex 2bc4625ff1..c5d5559e55 100644--- a/packages/media-parser/src/buffer-iterator.ts+++ b/packages/media-parser/src/buffer-iterator.ts@@ -252,10 +252,6 @@ export const getArrayBufferIterator = (view = new DataView(data.buffer);};- const byteLength = () => {- return data.byteLength;- };-const bytesRemaining = () => {return data.byteLength - counter.getDiscardedOffset();};@@ -402,7 +398,6 @@ export const getArrayBufferIterator = (peekB,peekD,getBits,- byteLength,bytesRemaining,leb128,removeBytesRead,diff --git a/packages/media-parser/src/state/webm.ts b/packages/media-parser/src/state/webm.tsindex 95f3f90234..947b4b50a4 100644--- a/packages/media-parser/src/state/webm.ts+++ b/packages/media-parser/src/state/webm.ts@@ -5,6 +5,19 @@ import {getTrackId,getTrackTimestampScale,} from '../boxes/webm/traversal';+import type {BufferIterator} from '../buffer-iterator';++export type SegmentSection = {+ start: number;+ size: number;+ index: number;+};++export type ClusterSection = {+ start: number;+ size: number;+ segment: number;+};export const webmState = () => {const trackEntries: Record<number, TrackInfo> = {};@@ -72,6 +85,9 @@ export const webmState = () => {return timescale;};+ const segments: SegmentSection[] = [];+ const clusters: ClusterSection[] = [];+return {onTrackEntrySegment,getTrackInfoByNumber: (id: number) => trackEntries[id],@@ -80,5 +96,38 @@ export const webmState = () => {timescale,getTimescale,setTimescale,+ addSegment: (seg: Omit<SegmentSection, 'index'>) => {+ const segment: SegmentSection = {+ ...seg,+ index: segments.length,+ };+ segments.push(segment);+ },+ addCluster: (cluster: ClusterSection) => {+ clusters.push(cluster);+ },+ isInsideSegment: (iterator: BufferIterator): SegmentSection | null => {+ const offset = iterator.counter.getOffset();+ const insideClusters = segments.filter((cluster) => {+ return (+ offset >= cluster.start && offset <= cluster.start + cluster.size+ );+ });+ if (insideClusters.length > 1) {+ throw new Error('Expected to only be inside 1 cluster');+ }++ return insideClusters[0] ?? null;+ },+ isInsideCluster: (iterator: BufferIterator): ClusterSection | null => {+ for (const cluster of clusters) {+ const offset = iterator.counter.getOffset();+ if (offset >= cluster.start && offset <= cluster.start + cluster.size) {+ return cluster;+ }+ }++ return null;+ },};};diff --git a/packages/media-parser/src/test/iso-base-media.test.ts b/packages/media-parser/src/test/iso-base-media.test.tsindex 5cb29fa671..e5cd42abad 100644--- a/packages/media-parser/src/test/iso-base-media.test.ts+++ b/packages/media-parser/src/test/iso-base-media.test.ts@@ -58,7 +58,7 @@ if (process.platform !== 'win32') {expect(audioSamples).toBe(544);});- test('Should get keyframes', async () => {+ test.only('Should get keyframes', async () => {const {slowKeyframes, internalStats} = await parseMedia({src: exampleVideos.iphonevideo,fields: {@@ -68,8 +68,8 @@ if (process.platform !== 'win32') {reader: nodeReader,});expect(internalStats).toEqual({- finalCursorOffset: 39048828,- skippedBytes: -14108,+ finalCursorOffset: 39062928,+ skippedBytes: -12030,});expect(slowKeyframes).toEqual([{diff --git a/packages/media-parser/src/test/keyframes.test.ts b/packages/media-parser/src/test/keyframes.test.tsindex 30e6766ede..d377da65b7 100644--- a/packages/media-parser/src/test/keyframes.test.ts+++ b/packages/media-parser/src/test/keyframes.test.ts@@ -13,7 +13,6 @@ test('should be able to get keyframes from webm', async () => {internalStats: true,},reader: nodeReader,- logLevel: 'trace',});expect(slowKeyframes).toEqual([{diff --git a/packages/media-parser/src/test/matroska.test.ts b/packages/media-parser/src/test/matroska.test.tsindex f73270018e..5b2a30faf7 100644--- a/packages/media-parser/src/test/matroska.test.ts+++ b/packages/media-parser/src/test/matroska.test.ts@@ -363,131 +363,6 @@ test('Should get duration of AV1 video', async () => {value: {value: 0, byteLength: 1},minVintWidth: 1,},- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 3,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 1,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },- {- type: 'Block',- value: new Uint8Array(),- minVintWidth: 2,- },],type: 'Cluster',minVintWidth: 3,diff --git a/packages/media-parser/src/test/parse-webm-partially.test.ts b/packages/media-parser/src/test/parse-webm-partially.test.tsindex 2cc800d877..60fc4f4319 100644--- a/packages/media-parser/src/test/parse-webm-partially.test.ts+++ b/packages/media-parser/src/test/parse-webm-partially.test.ts@@ -32,8 +32,8 @@ test('Parse WebM partially', async () => {});expect(internalStats).toEqual({- finalCursorOffset: 4562,- skippedBytes: 13190797,+ finalCursorOffset: 4540,+ skippedBytes: 13190819,});});diff --git a/packages/media-parser/src/test/skipped-avi.test.ts b/packages/media-parser/src/test/skipped-avi.test.tsindex ff1aadd6e1..7659366001 100644--- a/packages/media-parser/src/test/skipped-avi.test.ts+++ b/packages/media-parser/src/test/skipped-avi.test.ts@@ -32,7 +32,6 @@ test('Should skip media data if just wanting dimensions', async () => {dimensions: true,internalStats: true,},- logLevel: 'trace',});expect(internalStats).toEqual({diff --git a/packages/media-parser/test.json b/packages/media-parser/test.jsonnew file mode 100644index 0000000000..5bad911926--- /dev/null+++ b/packages/media-parser/test.json@@ -0,0 +1,663 @@+{+ "boxes": [+ {+ "type": "Header",+ "value": [+ {+ "type": "EBMLVersion",+ "value": {+ "value": 1,+ "byteLength": 1+ },+ "minVintWidth": 1+ },+ {+ "type": "EBMLReadVersion",+ "value": {+ "value": 1,+ "byteLength": 1+ },+ "minVintWidth": 1+ },+ {+ "type": "EBMLMaxIDLength",+ "value": {+ "value": 4,+ "byteLength": 1+ },+ "minVintWidth": 1+ },+ {+ "type": "EBMLMaxSizeLength",+ "value": {+ "value": 8,+ "byteLength": 1+ },+ "minVintWidth": 1+ },+ {+ "type": "DocType",+ "value": "webm",+ "minVintWidth": 1+ },+ {+ "type": "DocTypeVersion",+ "value": {+ "value": 2,+ "byteLength": 1+ },+ "minVintWidth": 1+ },+ {+ "type": "DocTypeReadVersion",+ "value": {+ "value": 2,+ "byteLength": 1+ },+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ },+ {+ "type": "Segment",+ "minVintWidth": 8,+ "value": [+ {+ "type": "SeekHead",+ "value": [+ {+ "type": "Seek",+ "value": [+ {+ "type": "SeekID",+ "value": "0x1549a966",+ "minVintWidth": 1+ },+ {+ "type": "SeekPosition",+ "value": {+ "value": 161,+ "byteLength": 1+ },+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ },+ {+ "type": "Seek",+ "value": [+ {+ "type": "SeekID",+ "value": "0x1654ae6b",+ "minVintWidth": 1+ },+ {+ "type": "SeekPosition",+ "value": {+ "value": 252,+ "byteLength": 1+ },+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ },+ {+ "type": "Seek",+ "value": [+ {+ "type": "SeekID",+ "value": "0x1254c367",+ "minVintWidth": 1+ },+ {+ "type": "SeekPosition",+ "value": {+ "value": 355,+ "byteLength": 2+ },+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ },+ {+ "type": "Seek",+ "value": [+ {+ "type": "SeekID",+ "value": "0x1c53bb6b",+ "minVintWidth": 1+ },+ {+ "type": "SeekPosition",+ "value": {+ "value": 1059490,+ "byteLength": 3+ },+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ },+ {+ "type": "Void",+ "value": {+ "0": 0,+ "1": 0,+ "2": 0,+ "3": 0,+ "4": 0,+ "5": 0,+ "6": 0,+ "7": 0,+ "8": 0,+ "9": 0,+ "10": 0,+ "11": 0,+ "12": 0,+ "13": 0,+ "14": 0,+ "15": 0,+ "16": 0,+ "17": 0,+ "18": 0,+ "19": 0,+ "20": 0,+ "21": 0,+ "22": 0,+ "23": 0,+ "24": 0,+ "25": 0,+ "26": 0,+ "27": 0,+ "28": 0,+ "29": 0,+ "30": 0,+ "31": 0,+ "32": 0,+ "33": 0,+ "34": 0,+ "35": 0,+ "36": 0,+ "37": 0,+ "38": 0,+ "39": 0,+ "40": 0,+ "41": 0,+ "42": 0,+ "43": 0,+ "44": 0,+ "45": 0,+ "46": 0,+ "47": 0,+ "48": 0,+ "49": 0,+ "50": 0,+ "51": 0,+ "52": 0,+ "53": 0,+ "54": 0,+ "55": 0,+ "56": 0,+ "57": 0,+ "58": 0,+ "59": 0,+ "60": 0,+ "61": 0,+ "62": 0,+ "63": 0,+ "64": 0,+ "65": 0,+ "66": 0,+ "67": 0,+ "68": 0,+ "69": 0,+ "70": 0,+ "71": 0,+ "72": 0,+ "73": 0,+ "74": 0,+ "75": 0,+ "76": 0,+ "77": 0,+ "78": 0,+ "79": 0,+ "80": 0,+ "81": 0,+ "82": 0,+ "83": 0,+ "84": 0,+ "85": 0,+ "86": 0,+ "87": 0+ },+ "minVintWidth": 8+ },+ {+ "type": "Info",+ "value": [+ {+ "type": "TimestampScale",+ "value": {+ "value": 1000000,+ "byteLength": 3+ },+ "minVintWidth": 1+ },+ {+ "type": "Title",+ "value": "Big Buck Bunny, Sunflower version",+ "minVintWidth": 1+ },+ {+ "type": "MuxingApp",+ "value": "Lavf58.63.100",+ "minVintWidth": 1+ },+ {+ "type": "WritingApp",+ "value": "Lavf58.63.100",+ "minVintWidth": 1+ },+ {+ "type": "Duration",+ "value": {+ "value": 10000,+ "size": "64"+ },+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ },+ {+ "type": "Tracks",+ "value": [+ {+ "type": "TrackEntry",+ "value": [+ {+ "type": "TrackNumber",+ "value": {+ "value": 1,+ "byteLength": 1+ },+ "minVintWidth": 1+ },+ {+ "type": "TrackUID",+ "value": "0x0413fcac0368d4bd",+ "minVintWidth": 1+ },+ {+ "type": "FlagLacing",+ "value": {+ "value": 0,+ "byteLength": 1+ },+ "minVintWidth": 1+ },+ {+ "type": "Language",+ "value": "und",+ "minVintWidth": 1+ },+ {+ "type": "CodecID",+ "value": "V_AV1",+ "minVintWidth": 1+ },+ {+ "type": "TrackType",+ "value": {+ "value": 1,+ "byteLength": 1+ },+ "minVintWidth": 1+ },+ {+ "type": "DefaultDuration",+ "value": {+ "value": 33333333,+ "byteLength": 4+ },+ "minVintWidth": 1+ },+ {+ "type": "Video",+ "value": [+ {+ "type": "PixelWidth",+ "value": {+ "value": 1920,+ "byteLength": 2+ },+ "minVintWidth": 1+ },+ {+ "type": "PixelHeight",+ "value": {+ "value": 1080,+ "byteLength": 2+ },+ "minVintWidth": 1+ },+ {+ "type": "FlagInterlaced",+ "value": {+ "value": 2,+ "byteLength": 1+ },+ "minVintWidth": 1+ },+ {+ "type": "Colour",+ "value": [+ {+ "type": "Range",+ "value": {+ "value": 1,+ "byteLength": 1+ },+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ },+ {+ "type": "CodecPrivate",+ "value": {+ "0": 129,+ "1": 8,+ "2": 12,+ "3": 0,+ "4": 10,+ "5": 11,+ "6": 0,+ "7": 0,+ "8": 0,+ "9": 66,+ "10": 171,+ "11": 191,+ "12": 195,+ "13": 119,+ "14": 111,+ "15": 228,+ "16": 1+ },+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ }+ ],+ "minVintWidth": 1+ },+ {+ "type": "Tags",+ "value": [+ {+ "type": "Tag",+ "value": [+ {+ "type": "Targets",+ "value": [],+ "minVintWidth": 1+ },+ {+ "type": "SimpleTag",+ "value": [+ {+ "type": "TagName",+ "value": "MAJOR_BRAND",+ "minVintWidth": 1+ },+ {+ "type": "TagString",+ "value": "isom",+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ },+ {+ "type": "SimpleTag",+ "value": [+ {+ "type": "TagName",+ "value": "MINOR_VERSION",+ "minVintWidth": 1+ },+ {+ "type": "TagString",+ "value": "512",+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ },+ {+ "type": "SimpleTag",+ "value": [+ {+ "type": "TagName",+ "value": "COMPATIBLE_BRANDS",+ "minVintWidth": 1+ },+ {+ "type": "TagString",+ "value": "isomav01iso2mp41",+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ },+ {+ "type": "SimpleTag",+ "value": [+ {+ "type": "TagName",+ "value": "ARTIST",+ "minVintWidth": 1+ },+ {+ "type": "TagString",+ "value": "Blender Foundation 2008, Janus Bager Kristensen 2013",+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ },+ {+ "type": "SimpleTag",+ "value": [+ {+ "type": "TagName",+ "value": "COMPOSER",+ "minVintWidth": 1+ },+ {+ "type": "TagString",+ "value": "Sacha Goedegebure",+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ },+ {+ "type": "SimpleTag",+ "value": [+ {+ "type": "TagName",+ "value": "GENRE",+ "minVintWidth": 1+ },+ {+ "type": "TagString",+ "value": "Animation",+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ },+ {+ "type": "SimpleTag",+ "value": [+ {+ "type": "TagName",+ "value": "COMMENT",+ "minVintWidth": 1+ },+ {+ "type": "TagString",+ "value": "Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net",+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ },+ {+ "type": "SimpleTag",+ "value": [+ {+ "type": "TagName",+ "value": "ENCODER",+ "minVintWidth": 1+ },+ {+ "type": "TagString",+ "value": "Lavf58.63.100",+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ }+ ],+ "minVintWidth": 8+ },+ {+ "type": "Tag",+ "value": [+ {+ "type": "Targets",+ "value": [+ {+ "type": "TagTrackUID",+ "value": "0x0413fcac0368d4bd",+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ },+ {+ "type": "SimpleTag",+ "value": [+ {+ "type": "TagName",+ "value": "HANDLER_NAME",+ "minVintWidth": 1+ },+ {+ "type": "TagString",+ "value": "GPAC ISO Video Handler",+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ },+ {+ "type": "SimpleTag",+ "value": [+ {+ "type": "TagName",+ "value": "DURATION",+ "minVintWidth": 1+ },+ {+ "type": "TagString",+ "value": "00:00:10.000000000",+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 8+ }+ ],+ "minVintWidth": 2+ },+ {+ "type": "Cluster",+ "minVintWidth": 3,+ "value": []+ },+ {+ "type": "Cluster",+ "minVintWidth": 3,+ "value": []+ },+ {+ "type": "Cues",+ "value": [+ {+ "type": "CuePoint",+ "value": [+ {+ "type": "CueTime",+ "value": {+ "value": 0,+ "byteLength": 1+ },+ "minVintWidth": 1+ },+ {+ "type": "CueTrackPositions",+ "value": [+ {+ "type": "CueTrack",+ "value": {+ "value": 1,+ "byteLength": 1+ },+ "minVintWidth": 1+ },+ {+ "type": "CueClusterPosition",+ "value": {+ "value": 866,+ "byteLength": 2+ },+ "minVintWidth": 1+ },+ {+ "type": "CueRelativePosition",+ "value": {+ "value": 3,+ "byteLength": 1+ },+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ }+ ],+ "minVintWidth": 1+ }+ ]+ }+ ],+ "type": "matroska"+}\ No newline at end of filediff --git a/packages/webcodecs/src/writers/node.ts b/packages/webcodecs/src/writers/node.tsindex f2a1d7ab59..9dab127bb3 100644--- a/packages/webcodecs/src/writers/node.ts+++ b/packages/webcodecs/src/writers/node.ts@@ -21,7 +21,7 @@ const createContent = (filename: string): CreateContent => {const write = async (data: Uint8Array) => {await new Promise<void>((resolve, reject) => {- fs.write(writeStream, data, (err) => {+ fs.write(writeStream, data, 0, data.length, undefined, (err) => {if (err) {reject(err);return;