Skip to content

🎥 Make videos programmatically with React

hex not needed

Jonny Burger07807f742480
diff --git a/packages/media-parser/src/boxes/webm/parse-ebml.ts b/packages/media-parser/src/boxes/webm/parse-ebml.ts
index 2aaea6343e..1a54a351a0 100644
--- a/packages/media-parser/src/boxes/webm/parse-ebml.ts
+++ b/packages/media-parser/src/boxes/webm/parse-ebml.ts
@@ -1,6 +1,6 @@
import type {BufferIterator} from '../../buffer-iterator';
import type {PossibleEbml} from './segments/all-segments';
-import {ebmlMap, type Ebml, type EbmlParsed} from './segments/all-segments';
+import {ebmlMap} from './segments/all-segments';
export type Prettify<T> = {
[K in keyof T]: T[K];
@@ -31,7 +31,7 @@ export const parseEbml = (iterator: BufferIterator): Prettify<PossibleEbml> => {
if (hasInMap.type === 'uint') {
const value = iterator.getUint(size);
- return {type: hasInMap.name, value, hex};
+ return {type: hasInMap.name, value};
}
if (hasInMap.type === 'string') {
@@ -40,7 +40,6 @@ export const parseEbml = (iterator: BufferIterator): Prettify<PossibleEbml> => {
return {
type: hasInMap.name,
value,
- hex,
};
}
@@ -50,7 +49,6 @@ export const parseEbml = (iterator: BufferIterator): Prettify<PossibleEbml> => {
return {
type: hasInMap.name,
value,
- hex,
};
}
@@ -60,7 +58,6 @@ export const parseEbml = (iterator: BufferIterator): Prettify<PossibleEbml> => {
return {
type: hasInMap.name,
value: undefined,
- hex,
};
}
@@ -72,12 +69,11 @@ export const parseEbml = (iterator: BufferIterator): Prettify<PossibleEbml> => {
[...iterator.getSlice(size)]
.map((b) => b.toString(16).padStart(2, '0'))
.join(''),
- hex,
};
}
if (hasInMap.type === 'children') {
- const children: EbmlParsed<Ebml>[] = [];
+ const children: PossibleEbml[] = [];
const startOffset = iterator.counter.getOffset();
// eslint-disable-next-line no-constant-condition
@@ -97,7 +93,7 @@ export const parseEbml = (iterator: BufferIterator): Prettify<PossibleEbml> => {
}
}
- return {type: hasInMap.name, value: children as PossibleEbml[], hex};
+ return {type: hasInMap.name, value: children};
}
// @ts-expect-error
diff --git a/packages/media-parser/src/boxes/webm/segments/all-segments.ts b/packages/media-parser/src/boxes/webm/segments/all-segments.ts
index 94990aed5d..6dae603d43 100644
--- a/packages/media-parser/src/boxes/webm/segments/all-segments.ts
+++ b/packages/media-parser/src/boxes/webm/segments/all-segments.ts
@@ -557,7 +557,6 @@ export type EbmlValue<T extends Ebml> = T extends EbmlWithUint8
export type EbmlParsed<T extends Ebml> = {
type: T['name'];
value: EbmlValue<T>;
- hex: string;
};
export const ebmlMap = {
diff --git a/packages/media-parser/src/test/create-matroska.test.ts b/packages/media-parser/src/test/create-matroska.test.ts
index 99946d2b87..89f404fb7e 100644
--- a/packages/media-parser/src/test/create-matroska.test.ts
+++ b/packages/media-parser/src/test/create-matroska.test.ts
@@ -31,40 +31,32 @@ test('Should make Matroska header that is same as input', () => {
{
type: 'EBMLVersion',
value: 1,
- hex: '0x4286',
},
{
type: 'EBMLReadVersion',
value: 1,
- hex: '0x42f7',
},
{
type: 'EBMLMaxIDLength',
value: 4,
- hex: '0x42f2',
},
{
type: 'EBMLMaxSizeLength',
value: 8,
- hex: '0x42f3',
},
{
type: 'DocType',
value: 'webm',
- hex: '0x4282',
},
{
type: 'DocTypeVersion',
value: 4,
- hex: '0x4287',
},
{
type: 'DocTypeReadVersion',
value: 2,
- hex: '0x4285',
},
],
- hex: '0x1a45dfa3',
});
});
@@ -118,17 +110,13 @@ test('Should parse seekHead', async () => {
{
type: 'SeekID',
value: '0x1f43b675',
- hex: '0x53ab',
},
{
type: 'SeekPosition',
value: 3911,
- hex: '0x53ac',
},
],
- hex: '0x4dbb',
},
],
- hex: '0x114d9b74',
});
});
diff --git a/packages/media-parser/src/test/matroska.test.ts b/packages/media-parser/src/test/matroska.test.ts
index 71c5854518..7a846b59c3 100644
--- a/packages/media-parser/src/test/matroska.test.ts
+++ b/packages/media-parser/src/test/matroska.test.ts
@@ -1,6 +1,5 @@
import {RenderInternals} from '@remotion/renderer';
import {expect, test} from 'bun:test';
-import {matroskaElements} from '../boxes/webm/segments/all-segments';
import {nodeReader} from '../from-node';
import {parseMedia} from '../parse-media';
@@ -25,41 +24,33 @@ test('Should get duration of AV1 video', async () => {
expect(parsed.boxes).toEqual([
{
- hex: '0x1a45dfa3',
type: 'Header',
value: [
{
- hex: '0x4286',
type: 'EBMLVersion',
value: 1,
},
{
- hex: '0x42f7',
type: 'EBMLReadVersion',
value: 1,
},
{
- hex: '0x42f2',
type: 'EBMLMaxIDLength',
value: 4,
},
{
- hex: '0x42f3',
type: 'EBMLMaxSizeLength',
value: 8,
},
{
- hex: '0x4282',
type: 'DocType',
value: 'webm',
},
{
- hex: '0x4287',
type: 'DocTypeVersion',
value: 2,
},
{
- hex: '0x4285',
type: 'DocTypeReadVersion',
value: 2,
},
@@ -76,32 +67,26 @@ test('Should get duration of AV1 video', async () => {
value: [
{
type: 'SeekID',
- hex: matroskaElements.SeekID,
value: '0x1549a966',
},
{
type: 'SeekPosition',
- hex: matroskaElements.SeekPosition,
value: 161,
},
],
- hex: matroskaElements.Seek,
},
{
type: 'Seek',
value: [
{
type: 'SeekID',
- hex: matroskaElements.SeekID,
value: '0x1654ae6b',
},
{
type: 'SeekPosition',
value: 214,
- hex: matroskaElements.SeekPosition,
},
],
- hex: matroskaElements.Seek,
},
{
type: 'Seek',
@@ -109,15 +94,12 @@ test('Should get duration of AV1 video', async () => {
{
type: 'SeekID',
value: '0x1254c367',
- hex: matroskaElements.SeekID,
},
{
type: 'SeekPosition',
value: 322,
- hex: matroskaElements.SeekPosition,
},
],
- hex: matroskaElements.Seek,
},
{
type: 'Seek',
@@ -125,47 +107,37 @@ test('Should get duration of AV1 video', async () => {
{
type: 'SeekID',
value: '0x1c53bb6b',
- hex: matroskaElements.SeekID,
},
{
type: 'SeekPosition',
value: 347329,
- hex: matroskaElements.SeekPosition,
},
],
- hex: matroskaElements.Seek,
},
],
- hex: matroskaElements.SeekHead,
},
{
type: 'Void',
value: undefined,
- hex: matroskaElements.Void,
},
{
type: 'Info',
- hex: matroskaElements.Info,
value: [
{
type: 'TimestampScale',
value: 1000000,
- hex: matroskaElements.TimestampScale,
},
{
type: 'MuxingApp',
value: 'Lavf60.3.100',
- hex: matroskaElements.MuxingApp,
},
{
type: 'WritingApp',
value: 'Lavf60.3.100',
- hex: matroskaElements.WritingApp,
},
{
type: 'Duration',
value: 1000,
- hex: matroskaElements.Duration,
},
],
},
@@ -186,7 +158,6 @@ test('Should get duration of AV1 video', async () => {
{
type: 'FlagLacing',
value: 0,
- hex: matroskaElements.FlagLacing,
},
{
type: 'language-segment',
@@ -195,12 +166,10 @@ test('Should get duration of AV1 video', async () => {
{
type: 'CodecID',
value: 'V_AV1',
- hex: matroskaElements.CodecID,
},
{
type: 'TrackType',
value: 1,
- hex: matroskaElements.TrackType,
},
{
type: 'default-duration-segment',
@@ -212,12 +181,10 @@ test('Should get duration of AV1 video', async () => {
{
type: 'PixelWidth',
value: 1920,
- hex: matroskaElements.PixelWidth,
},
{
type: 'PixelHeight',
value: 1080,
- hex: matroskaElements.PixelHeight,
},
{
type: 'color-segment',
@@ -509,7 +476,6 @@ test('Should get duration of AV1 video', async () => {
],
},
{
- hex: '0x1c53bb6b',
type: 'Cues',
value: undefined,
},