Skip to main content

TypeScript Types Reference

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

MediaParserDimensions

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

MediaParserAudioCodec

tsx
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

tsx
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

tsx
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

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

MediaParserEmbeddedImage

tsx
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

tsx
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

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

MediaParserMetadataEntry

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

MediaParserAudioSample

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

MediaParserOnAudioSample

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

tsx
import type {MediaParserVideoSample} from '@remotion/media-parser';
(alias) type MediaParserVideoSample = { data: Uint8Array; timestamp: number; duration: number | undefined; trackId: number; type: "key" | "delta"; cts: number; dts: number; offset: number; timescale: number; } 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

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

MediaParserAudioTrack

tsx
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: number; codecData: MediaParserCodecData | null; } import MediaParserAudioTrack

MediaParserOnAudioTrackParams

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

MediaParserOnVideoTrackParams

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

MediaParserAdvancedColor

tsx
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

tsx
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

tsx
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

tsx
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

tsx
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

tsx
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: number; codecData: MediaParserCodecData | null; } import MediaParserAudioTrack

MediaParserOtherTrack

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

MediaParserTrack

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

MediaParserSampleAspectRatio

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

MediaParserOnVideoTrack

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

MediaParserOnAudioTrack

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

MediaParserOnVideoTrackParams

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

MediaParserOnAudioTrackParams

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

ParseMediaSrc

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

M3uStream

tsx
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

tsx
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.