Skip to main content

Available Fields

The following fields are available in parseMedia():

dimensions

{width: number, height: number} | null

The dimensions of the video.
Any rotation is already applied - the dimensions are like a media player would show them.
Use unrotatedDimensions to get the dimensions before rotation.

If the media passed is an audio file, this will return null.

durationInSeconds

number | null

The duration of the video in seconds.
Only returns a non-null value if the duration is stored in the metadata.

slowDurationInSeconds

number

The duration of the video in seconds, but it is guaranteed to return a value.
If needed, the entire video file is read to determine the duration.

name

string

The name of the file.

container

"mp4" | "webm" | "avi" | "transport-stream" | "mp3" | "aac" | "wav" | "flac"

The container of the file.

size

number | null

The size of the input in bytes.

mimeType

string | null

The MIME type of the file that was returned when the file was fetched.
Only available if using the fetchReader or webFileReader.

structure

The internal structure of the video. Unstable, internal data structure, refer to the TypeScript types to see what's inside.

fps

number | null

The frame rate of the video.
Only returns a non-null value if the frame rate is stored in the metadata.

slowFps

number

The frame rate of the video, but it is guaranteed to return a value.
If needed, the entire video file is read to determine the frame rate.

videoCodec

The video codec of the file.
If multiple video tracks are present, this will be the first video track.
One of "h264", "h265", "vp8", "vp9", "av1", "prores" or null (in case of an unknown codec).

audioCodec

The audio codec of the file.
If multiple audio tracks are present, this will be the first audio track.
One of 'aac', 'mp3', 'aiff', 'opus', 'pcm', 'flac', 'unknown' (audio is there but not recognized) or null (in case of no audio detected).

metadata

Metadata fields such as ID3 tags or EXIF data.
See metadata for more information.

location

The location of the video was shot. Either null if not available or:

  • latitude: The latitude of the location
  • longitude: The longitude of the location
  • altitude: The altitude of the location (can be null)
  • horizontalAccuracy: The horizontal accuracy of the location (can be null)

tracks

Returns an object of two two arrays videoTracks and audioTracks.
The data structure of them is not yet stable.

keyframes

Return type: MediaParserKeyframe[] | null

An array of keyframes. Each keyframe has the following structure:

  • 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

Only being returned if the keyframe information are stored in the metadata, otherwise null.

slowKeyframes

Return type: MediaParserKeyframe[]

An array of keyframes, same as keyframes, but it is guaranteed to return a value.

Will read the entire video file to determine the keyframes.

slowNumberOfFrames

number

The number of video frames in the media.
Will read the entire video file to determine the number of frames.

unrotatedDimensions

{width: number, height: number}

The dimensions of the video before rotation.

isHdr

boolean

Whether the video is in HDR (High dynamic range).

rotation

number

The rotation of the video in degrees (e.g. -90 for a 90° counter-clockwise rotation).

images

Return type: MediaParserEmbeddedImage[]

Embedded images in the file, for example an album cover inside an MP3.
Each array element has the following fields:

  • mimeType: The MIME type of the image, or null
  • description: A description of the image, or null
  • data: The image data as a Uint8Array

sampleRate

number | null

The audio sample rate, if there is an audio track.

numberOfAudioChannels

number | null

The number of audio channels, if there is an audio track.

slowAudioBitrate

number

The audio bitrate in bits per second. null if there is no audio track.

note

1 byte is 8 bits.

slowVideoBitrate

number | null

The video bitrate in bits per second. null if there is no video track.

note

1 byte is 8 bits.

m3uStreams

Only for .m3u8, this will return a non-null value if the file is a playlist.

An array of objects with the following fields:

  • bandwidth: The bandwidth of the stream. May be null.
  • averageBandwidth: 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.
  • url: The URI of the stream
  • id: A unique identifier that Remotion gives the stream
  • dedicatedAudioTracks: Audio tracks that are connected to this stream but are in a separate file. Currently these need to be processed yourself. We plan a breaking change to allow you to select an audio stream and allowing you to get the samples in the usual interleaved manner. This value is an array with objects of the following shape:
    • url: The URL 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.