Skip to main content

TypeScript Types Reference

The following types are part of the stable API of @remotion/media-parser:

MediaParserDimensions

import type {MediaParserDimensions} from '@remotion/media-parser';
(alias) type MediaParserDimensions = { width: number; height: number; } import MediaParserDimensions

MediaParserAudioCodec

import type {MediaParserAudioCodec} from '@remotion/media-parser';
(alias) type MediaParserAudioCodec = "opus" | "aac" | "mp3" | "ac3" | "vorbis" | "pcm-u8" | "pcm-s16" | "pcm-s24" | "pcm-s32" | "pcm-f32" | "flac" | "aiff" import MediaParserAudioCodec

More values may be added in the future, this would not be considered a breaking change.

MediaParserVideoCodec

import type {MediaParserVideoCodec} from '@remotion/media-parser';
(alias) type MediaParserVideoCodec = "vp8" | "vp9" | "h264" | "av1" | "h265" | "prores" import MediaParserVideoCodec

More values may be added in the future, this would not be considered a breaking change.

MediaParserContainer

import type {MediaParserContainer} from '@remotion/media-parser';
(alias) type MediaParserContainer = "mp4" | "webm" | "avi" | "transport-stream" | "mp3" | "aac" | "flac" | "m3u8" | "wav" import MediaParserContainer

More values may be added in the future, this would not be considered a breaking change.

MediaParserLocation

import type {MediaParserLocation} from '@remotion/media-parser';
(alias) type MediaParserLocation = { latitude: number; longitude: number; altitude: number | null; horizontalAccuracy: number | null; } import MediaParserLocation

MediaParserEmbeddedImage

import type {MediaParserEmbeddedImage} from '@remotion/media-parser';
(alias) type MediaParserEmbeddedImage = { description: string | null; mimeType: string | null; data: Uint8Array; } import MediaParserEmbeddedImage
  • mimeType: The MIME type of the image, or null
  • description: A description of the image, or null
  • data: The image data as a Uint8Array

MediaParserKeyframe

import type {MediaParserKeyframe} from '@remotion/media-parser';
(alias) type MediaParserKeyframe = { positionInBytes: number; sizeInBytes: number; presentationTimeInSeconds: number; decodingTimeInSeconds: number; trackId: number; } import MediaParserKeyframe
  • presentationTimeInSeconds: The time in seconds when the keyframe should be presented
  • decodingTimeInSeconds: The time in seconds when the keyframe should be decoded
  • positionInBytes: The position in bytes where the keyframe is located in the file
  • sizeInBytes: The size of the keyframe in bytes
  • trackId: The ID of the track the frame belongs to

MediaParserLogLevel

import type {MediaParserLogLevel} from '@remotion/media-parser';
(alias) type MediaParserLogLevel = "trace" | "verbose" | "info" | "warn" | "error" import MediaParserLogLevel

MediaParserMetadataEntry

import type {MediaParserMetadataEntry} from '@remotion/media-parser';
(alias) type MediaParserMetadataEntry = { key: string; value: string | number; trackId: number | null; } import MediaParserMetadataEntry

MediaParserAudioSample

import type {MediaParserAudioSample} from '@remotion/media-parser';
(alias) type MediaParserAudioSample = { data: Uint8Array; timestamp: number; duration: number | undefined; type: "key" | "delta"; decodingTimestamp: number; offset: number; } import MediaParserAudioSample

MediaParserOnAudioSample

import type {MediaParserOnAudioSample} from '@remotion/media-parser';
(alias) type MediaParserOnAudioSample = (sample: MediaParserAudioSample) => void | Promise<OnTrackDoneCallback | void> | Promise<void> | OnTrackDoneCallback import MediaParserOnAudioSample

The data, timestamp, duration, type fields are in a format so that this type can be passed into the EncodedAudioChunk constructor.

The other fields are for informative purposes.

MediaParserVideoSample

import type {MediaParserVideoSample} from '@remotion/media-parser';
(alias) type MediaParserVideoSample = { data: Uint8Array; timestamp: number; type: "key" | "delta"; duration: number | undefined; decodingTimestamp: number; offset: number; avc?: MediaParserAvcExtraInfo; } import MediaParserVideoSample

Note: timestamp is the presentation timestamp of the sample. decodingTimestamp is the timestamp of the sample when it will be decoded.

The data, timestamp, duration, type fields are in a format so that this type can be passed into the EncodedVideoChunk constructor.

The other fields are for informative purposes.

MediaParserOnVideoSample

import type {MediaParserOnVideoSample} from '@remotion/media-parser';
(alias) type MediaParserOnVideoSample = (sample: MediaParserVideoSample) => void | Promise<OnTrackDoneCallback | void> | Promise<void> | OnTrackDoneCallback import MediaParserOnVideoSample

MediaParserAudioTrack

import type {MediaParserAudioTrack} from '@remotion/media-parser';
(alias) type MediaParserAudioTrack = { codec: string; sampleRate: number; description: Uint8Array | undefined; numberOfChannels: number; type: "audio"; trackId: number; codecEnum: MediaParserAudioCodec; timescale: 1000000; originalTimescale: number; codecData: MediaParserCodecData | null; startInSeconds: number; trackMediaTimeOffsetInTrackTimescale: number; } import MediaParserAudioTrack

MediaParserOnAudioTrackParams

import type {MediaParserOnAudioTrackParams} from '@remotion/media-parser';
(alias) type MediaParserOnAudioTrackParams = { track: MediaParserAudioTrack; container: MediaParserContainer; } import MediaParserOnAudioTrackParams

MediaParserOnVideoTrackParams

import type {MediaParserOnVideoTrackParams} from '@remotion/media-parser';
(alias) type MediaParserOnVideoTrackParams = { track: MediaParserVideoTrack; container: MediaParserContainer; } import MediaParserOnVideoTrackParams

MediaParserAdvancedColor

import type {MediaParserAdvancedColor} from '@remotion/media-parser';
(alias) type MediaParserAdvancedColor = { transfer: MediaParserTransferCharacteristics | null; matrix: MediaParserMatrixCoefficients | null; primaries: MediaParserPrimaries | null; fullRange: boolean | null; } import MediaParserAdvancedColor

MediaParserMatrixCoefficients

import type {MediaParserMatrixCoefficients} from '@remotion/media-parser';
(alias) type MediaParserMatrixCoefficients = "rgb" | "bt709" | "bt470bg" | "smpte170m" | "bt2020-ncl" import MediaParserMatrixCoefficients

More values may be added in the future, this would not be considered a breaking change.

MediaParserPrimaries

import type {MediaParserPrimaries} from '@remotion/media-parser';
(alias) type MediaParserPrimaries = "bt709" | "bt470bg" | "smpte170m" | "bt2020" | "smpte432" | null import MediaParserPrimaries

More values may be added in the future, this would not be considered a breaking change.

MediaParserTransferCharacteristics

import type {MediaParserTransferCharacteristics} from '@remotion/media-parser';
(alias) type MediaParserTransferCharacteristics = "bt709" | "smpte170m" | "iec61966-2-1" | "linear" | "pq" | "hlg" import MediaParserTransferCharacteristics

More values may be added in the future, this would not be considered a breaking change.

MediaParserVideoTrack

import {MediaParserVideoCodec, MediaParserCodecData, MediaParserSampleAspectRatio, MediaParserAdvancedColor} from '@remotion/media-parser';

export type MediaParserVideoTrack = {
  // WebCodecs
  codec: string;
  description: Uint8Array | undefined;
  colorSpace: VideoColorSpaceInit;
  codedWidth: number;
  codedHeight: number;
  displayAspectWidth: number;
  displayAspectHeight: number;
  // Non-WebCodecs
  type: 'video';
  trackId: number;
  codecEnum: MediaParserVideoCodec;
  codecData: MediaParserCodecData | null;
  sampleAspectRatio: MediaParserSampleAspectRatio;
  width: number;
  height: number;
  rotation: number;
  fps: number | null;
  timescale: number;
  advancedColor: MediaParserAdvancedColor;
  m3uStreamFormat: 'ts' | 'mp4' | null;
  // When the track starts in seconds - can be non-zero for MP4 containers.
  // You don't need to account for it, as the samples will already be offset by this amount.
  startInSeconds: number;
};

See: VideoColorSpaceInit WebCodecs definition

MediaParserAudioTrack

import type {MediaParserAudioTrack} from '@remotion/media-parser';
(alias) type MediaParserAudioTrack = { codec: string; sampleRate: number; description: Uint8Array | undefined; numberOfChannels: number; type: "audio"; trackId: number; codecEnum: MediaParserAudioCodec; timescale: 1000000; originalTimescale: number; codecData: MediaParserCodecData | null; startInSeconds: number; trackMediaTimeOffsetInTrackTimescale: number; } import MediaParserAudioTrack

MediaParserOtherTrack

import type {MediaParserOtherTrack} from '@remotion/media-parser';
(alias) type MediaParserOtherTrack = { type: "other"; trackId: number; timescale: 1000000; originalTimescale: number; trakBox: TrakBox | null; startInSeconds: number; trackMediaTimeOffsetInTrackTimescale: number; } import MediaParserOtherTrack

MediaParserTrack

import type {MediaParserTrack} from '@remotion/media-parser';
(alias) type MediaParserTrack = MediaParserVideoTrack | MediaParserAudioTrack | MediaParserOtherTrack import MediaParserTrack

MediaParserSampleAspectRatio

import type {MediaParserSampleAspectRatio} from '@remotion/media-parser';
(alias) type MediaParserSampleAspectRatio = { numerator: number; denominator: number; } import MediaParserSampleAspectRatio

MediaParserOnVideoTrack

import type {MediaParserOnVideoTrack} from '@remotion/media-parser';
(alias) type MediaParserOnVideoTrack = (options: MediaParserOnVideoTrackParams) => MediaParserOnVideoSample | Promise<MediaParserOnVideoSample | null> | null import MediaParserOnVideoTrack

MediaParserOnAudioTrack

import type {MediaParserOnAudioTrack} from '@remotion/media-parser';
(alias) type MediaParserOnAudioTrack = (options: MediaParserOnAudioTrackParams) => MediaParserOnAudioSample | Promise<MediaParserOnAudioSample | null> | null import MediaParserOnAudioTrack

MediaParserOnVideoTrackParams

import type {MediaParserOnVideoTrackParams} from '@remotion/media-parser';
(alias) type MediaParserOnVideoTrackParams = { track: MediaParserVideoTrack; container: MediaParserContainer; } import MediaParserOnVideoTrackParams

MediaParserOnAudioTrackParams

import type {MediaParserOnAudioTrackParams} from '@remotion/media-parser';
(alias) type MediaParserOnAudioTrackParams = { track: MediaParserAudioTrack; container: MediaParserContainer; } import MediaParserOnAudioTrackParams

ParseMediaSrc

import type {ParseMediaSrc} from '@remotion/media-parser';
(alias) type ParseMediaSrc = string | Blob | URL import ParseMediaSrc

M3uStream

import type {M3uStream} from '@remotion/media-parser';
(alias) type M3uStream = { src: string; bandwidthInBitsPerSec: number | null; averageBandwidthInBitsPerSec: number | null; dimensions: MediaParserDimensions | null; codecs: string[] | null; id: number; associatedPlaylists: M3uAssociatedPlaylist[]; } import M3uStream
  • bandwidthInBitsPerSec: The bandwidth of the stream. May be null.
  • averageBandwidthInBitsPerSec: The average bandwidth of the stream. May be null.
  • resolution: The resolution of the stream. May be null.
  • codecs: The codec strings of the stream as an array May be null.
  • src: The URL or file path of the stream
  • id: A unique identifier that Remotion gives the stream
  • associatedPlaylists: An array of M3uAssociatedPlaylist - other (probably audio) tracks that are connected to this stream but live in a separate file.

M3uAssociatedPlaylist

import type {M3uAssociatedPlaylist} from '@remotion/media-parser';
(alias) type M3uAssociatedPlaylist = { groupId: string; language: string | null; name: string | null; autoselect: boolean; default: boolean; channels: number | null; src: string; id: number; isAudio: boolean; } import M3uAssociatedPlaylist
  • src: The URL or file path of the audio track
  • autoselect: Corresponds to the AUTOSELECT attribute in the HLS playlist
  • default: Corresponds to the DEFAULT attribute in the HLS playlist
  • language: The language of the audio track
  • name: The name of the audio track
  • groupId: The group ID of the audio track
  • channels: The number of audio channels in the audio track, or null.

SeekResolutionv4.0.312

import type {SeekResolution} from '@remotion/media-parser';
(alias) type SeekResolution = { type: "valid-but-must-wait"; } | { type: "invalid"; } | { type: "intermediary-seek"; byte: number; } | { type: "do-seek"; byte: number; timeInSeconds: number; } import SeekResolution