@remotion/media-parser
Version:
A pure JavaScript library for parsing video files
733 lines (732 loc) • 22.1 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.range = exports.primaries = exports.matrixCoefficients = exports.transferCharacteristics = exports.color = exports.trackUID = exports.trackNumber = exports.tags = exports.tagSegment = exports.flagLacing = exports.displayUnit = exports.displayHeight = exports.displayWidth = exports.bitDepth = exports.interlaced = exports.alphaMode = exports.channels = exports.samplingFrequency = exports.tagTrackUidType = exports.titleType = exports.infoType = exports.writingApp = exports.timestampScale = exports.duration = exports.muxingApp = exports.heightType = exports.widthType = exports.trackType = exports.codecID = exports.voidHeader = exports.seekHead = exports.seek = exports.seekPosition = exports.maxCache = exports.minCache = exports._name = exports.seekId = exports.matroskaHeader = exports.docTypeReadVersion = exports.docTypeVersion = exports.docType = exports.ebmlMaxSizeLength = exports.ebmlMaxIdLength = exports.ebmlReadVersion = exports.ebmlVersion = exports.getSegmentName = exports.knownIdsWithThreeLength = exports.knownIdsWithTwoLength = exports.knownIdsWithOneLength = exports.matroskaElements = void 0;
exports.ebmlMap = exports.tagStringType = exports.tagNameType = exports.simpleTagType = exports.targetsType = exports.cluster = exports.segment = exports.blockGroup = exports.simpleBlock = exports.block = exports.timestampEntry = exports.tracks = exports.trackEntry = exports.trackTimestampScale = exports.codecName = exports.blockElement = exports.blockDurationSegment = exports.referenceBlock = exports.flagDefault = exports.videoSegment = exports.audioSegment = exports.maxBlockAdditionIdSegment = exports.blockAdditionsSegment = exports.codecPrivate = exports.defaultDuration = exports.language = exports.ChromaSitingVert = exports.ChromaSitingHorz = void 0;
exports.matroskaElements = {
Header: '0x1a45dfa3',
EBMLMaxIDLength: '0x42f2',
EBMLVersion: '0x4286',
EBMLReadVersion: '0x42f7',
EBMLMaxSizeLength: '0x42f3',
DocType: '0x4282',
DocTypeVersion: '0x4287',
DocTypeReadVersion: '0x4285',
Segment: '0x18538067',
SeekHead: '0x114d9b74',
Seek: '0x4dbb',
SeekID: '0x53ab',
SeekPosition: '0x53ac',
Info: '0x1549a966',
SegmentUUID: '0x73a4',
SegmentFilename: '0x7384',
PrevUUID: '0x3cb923',
PrevFilename: '0x3c83ab',
NextUUID: '0x3eb923',
NextFilename: '0x3e83bb',
SegmentFamily: '0x4444',
ChapterTranslate: '0x6924',
ChapterTranslateID: '0x69a5',
ChapterTranslateCodec: '0x69bf',
ChapterTranslateEditionUID: '0x69fc',
TimestampScale: '0x2ad7b1',
Duration: '0x4489',
DateUTC: '0x4461',
Title: '0x7ba9',
MuxingApp: '0x4d80',
WritingApp: '0x5741',
Cluster: '0x1f43b675',
Timestamp: '0xe7',
SilentTracks: '0x5854',
SilentTrackNumber: '0x58d7',
Position: '0xa7',
PrevSize: '0xab',
SimpleBlock: '0xa3',
BlockGroup: '0xa0',
Block: '0xa1',
BlockVirtual: '0xa2',
BlockAdditions: '0x75a1',
BlockMore: '0xa6',
BlockAdditional: '0xa5',
BlockAddID: '0xee',
BlockDuration: '0x9b',
ReferencePriority: '0xfa',
ReferenceBlock: '0xfb',
ReferenceVirtual: '0xfd',
CodecState: '0xa4',
DiscardPadding: '0x75a2',
Slices: '0x8e',
TimeSlice: '0xe8',
LaceNumber: '0xcc',
FrameNumber: '0xcd',
BlockAdditionID: '0xcb',
Delay: '0xce',
SliceDuration: '0xcf',
ReferenceFrame: '0xc8',
ReferenceOffset: '0xc9',
ReferenceTimestamp: '0xca',
EncryptedBlock: '0xaf',
Tracks: '0x1654ae6b',
TrackEntry: '0xae',
TrackNumber: '0xd7',
TrackUID: '0x73c5',
TrackType: '0x83',
FlagEnabled: '0xb9',
FlagDefault: '0x88',
FlagForced: '0x55aa',
FlagHearingImpaired: '0x55ab',
FlagVisualImpaired: '0x55ac',
FlagTextDescriptions: '0x55ad',
FlagOriginal: '0x55ae',
FlagCommentary: '0x55af',
FlagLacing: '0x9c',
MinCache: '0x6de7',
MaxCache: '0x6df8',
DefaultDuration: '0x23e383',
DefaultDecodedFieldDuration: '0x234e7a',
TrackTimestampScale: '0x23314f',
TrackOffset: '0x537f',
MaxBlockAdditionID: '0x55ee',
BlockAdditionMapping: '0x41e4',
BlockAddIDValue: '0x41f0',
BlockAddIDName: '0x41a4',
BlockAddIDType: '0x41e7',
BlockAddIDExtraData: '0x41ed',
Name: '0x536e',
Language: '0x22b59c',
LanguageBCP47: '0x22b59d',
CodecID: '0x86',
CodecPrivate: '0x63a2',
CodecName: '0x258688',
AttachmentLink: '0x7446',
CodecSettings: '0x3a9697',
CodecInfoURL: '0x3b4040',
CodecDownloadURL: '0x26b240',
CodecDecodeAll: '0xaa',
TrackOverlay: '0x6fab',
CodecDelay: '0x56aa',
SeekPreRoll: '0x56bb',
TrackTranslate: '0x6624',
TrackTranslateTrackID: '0x66a5',
TrackTranslateCodec: '0x66bf',
TrackTranslateEditionUID: '0x66fc',
Video: '0xe0',
FlagInterlaced: '0x9a',
FieldOrder: '0x9d',
StereoMode: '0x53b8',
AlphaMode: '0x53c0',
OldStereoMode: '0x53b9',
PixelWidth: '0xb0',
PixelHeight: '0xba',
PixelCropBottom: '0x54aa',
PixelCropTop: '0x54bb',
PixelCropLeft: '0x54cc',
PixelCropRight: '0x54dd',
DisplayWidth: '0x54b0',
DisplayHeight: '0x54ba',
DisplayUnit: '0x54b2',
AspectRatioType: '0x54b3',
UncompressedFourCC: '0x2eb524',
GammaValue: '0x2fb523',
FrameRate: '0x2383e3',
Colour: '0x55b0',
MatrixCoefficients: '0x55b1',
BitsPerChannel: '0x55b2',
ChromaSubsamplingHorz: '0x55b3',
ChromaSubsamplingVert: '0x55b4',
CbSubsamplingHorz: '0x55b5',
CbSubsamplingVert: '0x55b6',
ChromaSitingHorz: '0x55b7',
ChromaSitingVert: '0x55b8',
Range: '0x55b9',
TransferCharacteristics: '0x55ba',
Primaries: '0x55bb',
MaxCLL: '0x55bc',
MaxFALL: '0x55bd',
MasteringMetadata: '0x55d0',
PrimaryRChromaticityX: '0x55d1',
PrimaryRChromaticityY: '0x55d2',
PrimaryGChromaticityX: '0x55d3',
PrimaryGChromaticityY: '0x55d4',
PrimaryBChromaticityX: '0x55d5',
PrimaryBChromaticityY: '0x55d6',
WhitePointChromaticityX: '0x55d7',
WhitePointChromaticityY: '0x55d8',
LuminanceMax: '0x55d9',
LuminanceMin: '0x55da',
Projection: '0x7670',
ProjectionType: '0x7671',
ProjectionPrivate: '0x7672',
ProjectionPoseYaw: '0x7673',
ProjectionPosePitch: '0x7674',
ProjectionPoseRoll: '0x7675',
Audio: '0xe1',
SamplingFrequency: '0xb5',
OutputSamplingFrequency: '0x78b5',
Channels: '0x9f',
ChannelPositions: '0x7d7b',
BitDepth: '0x6264',
Emphasis: '0x52f1',
TrackOperation: '0xe2',
TrackCombinePlanes: '0xe3',
TrackPlane: '0xe4',
TrackPlaneUID: '0xe5',
TrackPlaneType: '0xe6',
TrackJoinBlocks: '0xe9',
TrackJoinUID: '0xed',
TrickTrackUID: '0xc0',
TrickTrackSegmentUID: '0xc1',
TrickTrackFlag: '0xc6',
TrickMasterTrackUID: '0xc7',
TrickMasterTrackSegmentUID: '0xc4',
ContentEncodings: '0x6d80',
ContentEncoding: '0x6240',
ContentEncodingOrder: '0x5031',
ContentEncodingScope: '0x5032',
ContentEncodingType: '0x5033',
ContentCompression: '0x5034',
ContentCompAlgo: '0x4254',
ContentCompSettings: '0x4255',
ContentEncryption: '0x5035',
ContentEncAlgo: '0x47e1',
ContentEncKeyID: '0x47e2',
ContentEncAESSettings: '0x47e7',
AESSettingsCipherMode: '0x47e8',
ContentSignature: '0x47e3',
ContentSigKeyID: '0x47e4',
ContentSigAlgo: '0x47e5',
ContentSigHashAlgo: '0x47e6',
Cues: '0x1c53bb6b',
CuePoint: '0xbb',
CueTime: '0xb3',
CueTrackPositions: '0xb7',
CueTrack: '0xf7',
CueClusterPosition: '0xf1',
CueRelativePosition: '0xf0',
CueDuration: '0xb2',
CueBlockNumber: '0x5378',
CueCodecState: '0xea',
CueReference: '0xdb',
CueRefTime: '0x96',
CueRefCluster: '0x97',
CueRefNumber: '0x535f',
CueRefCodecState: '0xeb',
Attachments: '0x1941a469',
AttachedFile: '0x61a7',
FileDescription: '0x467e',
FileName: '0x466e',
FileMediaType: '0x4660',
FileData: '0x465c',
FileUID: '0x46ae',
FileReferral: '0x4675',
FileUsedStartTime: '0x4661',
FileUsedEndTime: '0x4662',
Chapters: '0x1043a770',
EditionEntry: '0x45b9',
EditionUID: '0x45bc',
EditionFlagHidden: '0x45bd',
EditionFlagDefault: '0x45db',
EditionFlagOrdered: '0x45dd',
EditionDisplay: '0x4520',
EditionString: '0x4521',
EditionLanguageIETF: '0x45e4',
ChapterAtom: '0xb6',
ChapterUID: '0x73c4',
ChapterStringUID: '0x5654',
ChapterTimeStart: '0x91',
ChapterTimeEnd: '0x92',
ChapterFlagHidden: '0x98',
ChapterFlagEnabled: '0x4598',
ChapterSegmentUUID: '0x6e67',
ChapterSkipType: '0x4588',
ChapterSegmentEditionUID: '0x6ebc',
ChapterPhysicalEquiv: '0x63c3',
ChapterTrack: '0x8f',
ChapterTrackUID: '0x89',
ChapterDisplay: '0x80',
ChapString: '0x85',
ChapLanguage: '0x437c',
ChapLanguageBCP47: '0x437d',
ChapCountry: '0x437e',
ChapProcess: '0x6944',
ChapProcessCodecID: '0x6955',
ChapProcessPrivate: '0x450d',
ChapProcessCommand: '0x6911',
ChapProcessTime: '0x6922',
ChapProcessData: '0x6933',
Tags: '0x1254c367',
Tag: '0x7373',
Targets: '0x63c0',
TargetTypeValue: '0x68ca',
TargetType: '0x63ca',
TagTrackUID: '0x63c5',
TagEditionUID: '0x63c9',
TagChapterUID: '0x63c4',
TagAttachmentUID: '0x63c6',
SimpleTag: '0x67c8',
TagName: '0x45a3',
TagLanguage: '0x447a',
TagLanguageBCP47: '0x447b',
TagDefault: '0x4484',
TagDefaultBogus: '0x44b4',
TagString: '0x4487',
TagBinary: '0x4485',
Void: '0xec',
Crc32: '0xbf',
};
const matroskaIds = Object.values(exports.matroskaElements);
exports.knownIdsWithOneLength = matroskaIds.filter((id) => id.length === 4);
exports.knownIdsWithTwoLength = matroskaIds.filter((id) => id.length === 6);
exports.knownIdsWithThreeLength = matroskaIds.filter((id) => id.length === 8);
const getSegmentName = (id) => {
var _a;
return (_a = Object.entries(exports.matroskaElements).find(([, value]) => value === id)) === null || _a === void 0 ? void 0 : _a[0];
};
exports.getSegmentName = getSegmentName;
exports.ebmlVersion = {
name: 'EBMLVersion',
type: 'uint',
};
exports.ebmlReadVersion = {
name: 'EBMLReadVersion',
type: 'uint',
};
exports.ebmlMaxIdLength = {
name: 'EBMLMaxIDLength',
type: 'uint',
};
exports.ebmlMaxSizeLength = {
name: 'EBMLMaxSizeLength',
type: 'uint',
};
exports.docType = {
name: 'DocType',
type: 'string',
};
exports.docTypeVersion = {
name: 'DocTypeVersion',
type: 'uint',
};
exports.docTypeReadVersion = {
name: 'DocTypeReadVersion',
type: 'uint',
};
const voidEbml = {
name: 'Void',
type: 'uint8array',
};
exports.matroskaHeader = {
name: 'Header',
type: 'children',
};
exports.seekId = {
name: 'SeekID',
type: 'hex-string',
};
exports._name = {
name: 'Name',
type: 'string',
};
exports.minCache = {
name: 'MinCache',
type: 'uint',
};
exports.maxCache = {
name: 'MaxCache',
type: 'uint',
};
exports.seekPosition = {
name: 'SeekPosition',
type: 'uint',
};
exports.seek = {
name: 'Seek',
type: 'children',
};
exports.seekHead = {
name: 'SeekHead',
type: 'children',
};
exports.voidHeader = {
name: 'Void',
type: 'uint8array',
};
exports.codecID = {
name: 'CodecID',
type: 'string',
};
exports.trackType = {
name: 'TrackType',
type: 'uint',
};
exports.widthType = {
name: 'PixelWidth',
type: 'uint',
};
exports.heightType = {
name: 'PixelHeight',
type: 'uint',
};
exports.muxingApp = {
name: 'MuxingApp',
type: 'string',
};
exports.duration = {
name: 'Duration',
type: 'float',
};
exports.timestampScale = {
name: 'TimestampScale',
type: 'uint',
};
exports.writingApp = {
name: 'WritingApp',
type: 'string',
};
exports.infoType = {
name: 'Info',
type: 'children',
};
exports.titleType = {
name: 'Title',
type: 'string',
};
exports.tagTrackUidType = {
name: 'TagTrackUID',
type: 'hex-string',
};
exports.samplingFrequency = {
name: 'SamplingFrequency',
type: 'float',
};
exports.channels = {
name: 'Channels',
type: 'uint',
};
exports.alphaMode = {
name: 'AlphaMode',
type: 'uint',
};
exports.interlaced = {
name: 'FlagInterlaced',
type: 'uint',
};
exports.bitDepth = {
name: 'BitDepth',
type: 'uint',
};
exports.displayWidth = {
name: 'DisplayWidth',
type: 'uint',
};
exports.displayHeight = {
name: 'DisplayHeight',
type: 'uint',
};
exports.displayUnit = {
name: 'DisplayUnit',
type: 'uint',
};
exports.flagLacing = {
name: 'FlagLacing',
type: 'uint',
};
exports.tagSegment = {
name: 'Tag',
type: 'children',
};
exports.tags = {
name: 'Tags',
type: 'children',
};
exports.trackNumber = {
name: 'TrackNumber',
type: 'uint',
};
exports.trackUID = {
name: 'TrackUID',
type: 'hex-string',
};
exports.color = {
name: 'Colour',
type: 'children',
};
exports.transferCharacteristics = {
name: 'TransferCharacteristics',
type: 'uint',
};
exports.matrixCoefficients = {
name: 'MatrixCoefficients',
type: 'uint',
};
exports.primaries = {
name: 'Primaries',
type: 'uint',
};
exports.range = {
name: 'Range',
type: 'uint',
};
exports.ChromaSitingHorz = {
name: 'ChromaSitingHorz',
type: 'uint',
};
exports.ChromaSitingVert = {
name: 'ChromaSitingVert',
type: 'uint',
};
exports.language = {
name: 'Language',
type: 'string',
};
exports.defaultDuration = {
name: 'DefaultDuration',
type: 'uint',
};
exports.codecPrivate = {
name: 'CodecPrivate',
type: 'uint8array',
};
exports.blockAdditionsSegment = {
name: 'BlockAdditions',
type: 'uint8array',
};
exports.maxBlockAdditionIdSegment = {
name: 'MaxBlockAdditionID',
type: 'uint',
};
exports.audioSegment = {
name: 'Audio',
type: 'children',
};
exports.videoSegment = {
name: 'Video',
type: 'children',
};
exports.flagDefault = {
name: 'FlagDefault',
type: 'uint',
};
exports.referenceBlock = {
name: 'ReferenceBlock',
type: 'uint',
};
exports.blockDurationSegment = {
name: 'BlockDuration',
type: 'uint',
};
exports.blockElement = {
name: 'Block',
type: 'uint8array',
};
exports.codecName = {
name: 'CodecName',
type: 'string',
};
exports.trackTimestampScale = {
name: 'TrackTimestampScale',
type: 'float',
};
exports.trackEntry = {
name: 'TrackEntry',
type: 'children',
};
exports.tracks = {
name: 'Tracks',
type: 'children',
};
exports.timestampEntry = {
name: 'Timestamp',
type: 'uint',
};
exports.block = {
name: 'Block',
type: 'uint8array',
};
exports.simpleBlock = {
name: 'SimpleBlock',
type: 'uint8array',
};
exports.blockGroup = {
name: 'BlockGroup',
type: 'children',
};
exports.segment = {
name: 'Segment',
type: 'children',
};
exports.cluster = {
name: 'Cluster',
type: 'children',
};
exports.targetsType = {
name: 'Targets',
type: 'children',
};
exports.simpleTagType = {
name: 'SimpleTag',
type: 'children',
};
exports.tagNameType = {
name: 'TagName',
type: 'string',
};
exports.tagStringType = {
name: 'TagString',
type: 'string',
};
exports.ebmlMap = {
[]: exports.matroskaHeader,
[]: exports.docType,
[]: exports.targetsType,
[]: exports.simpleTagType,
[]: exports.tagNameType,
[]: exports.tagStringType,
[]: exports.docTypeVersion,
[]: exports.docTypeReadVersion,
[]: exports.ebmlVersion,
[]: exports.ebmlReadVersion,
[]: exports.ebmlMaxIdLength,
[]: exports.ebmlMaxSizeLength,
[]: voidEbml,
[]: {
name: 'Cues',
type: 'children',
},
[]: {
name: 'CuePoint',
type: 'children',
},
[]: {
name: 'CueTime',
type: 'uint',
},
[]: {
name: 'CueTrackPositions',
type: 'children',
},
[]: {
name: 'CueClusterPosition',
type: 'uint',
},
[]: {
name: 'CueRelativePosition',
type: 'uint',
},
[]: {
name: 'CueBlockNumber',
type: 'uint',
},
[]: {
name: 'CueTrack',
type: 'uint',
},
[]: {
name: 'DateUTC',
type: 'uint8array',
},
[]: exports.trackTimestampScale,
[]: {
name: 'CodecDelay',
type: 'uint8array',
},
[]: {
name: 'SeekPreRoll',
type: 'uint8array',
},
[]: {
name: 'DiscardPadding',
type: 'uint8array',
},
[]: {
name: 'OutputSamplingFrequency',
type: 'uint8array',
},
[]: exports.codecName,
[]: {
name: 'Position',
type: 'uint8array',
},
[]: {
name: 'SliceDuration',
type: 'uint8array',
},
[]: exports.tagTrackUidType,
[]: exports.seekHead,
[]: exports.seek,
[]: exports.seekId,
[]: exports._name,
[]: exports.minCache,
[]: exports.maxCache,
[]: exports.seekPosition,
[]: {
name: 'Crc32',
type: 'uint8array',
},
[]: exports.muxingApp,
[]: {
name: 'WritingApp',
type: 'string',
},
[]: {
name: 'SegmentUUID',
type: 'string',
},
[]: exports.duration,
[]: {
name: 'CodecID',
type: 'string',
},
[]: exports.trackType,
[]: exports.widthType,
[]: exports.heightType,
[]: exports.timestampScale,
[]: exports.infoType,
[]: exports.titleType,
[]: exports.samplingFrequency,
[]: exports.channels,
[]: exports.alphaMode,
[]: exports.interlaced,
[]: exports.bitDepth,
[]: exports.displayHeight,
[]: exports.displayWidth,
[]: exports.displayUnit,
[]: exports.flagLacing,
[]: exports.tags,
[]: exports.tagSegment,
[]: exports.trackNumber,
[]: exports.trackUID,
[]: exports.color,
[]: exports.language,
[]: exports.defaultDuration,
[]: exports.codecPrivate,
[]: exports.blockDurationSegment,
[]: exports.blockAdditionsSegment,
[]: exports.maxBlockAdditionIdSegment,
[]: exports.audioSegment,
[]: exports.videoSegment,
[]: exports.flagDefault,
[]: exports.referenceBlock,
[]: exports.trackEntry,
[]: {
name: 'Timestamp',
type: 'uint',
},
[]: exports.tracks,
[]: exports.block,
[]: exports.simpleBlock,
[]: exports.blockGroup,
[]: {
name: 'Segment',
type: 'children',
},
[]: {
name: 'Cluster',
type: 'children',
},
[]: exports.transferCharacteristics,
[]: exports.matrixCoefficients,
[]: exports.primaries,
[]: exports.range,
[]: exports.ChromaSitingHorz,
[]: exports.ChromaSitingVert,
};