Skip to main content

Available Fields

The following fields are available in parseMedia():

dimensions​

MediaParserDimensions | 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 media in seconds, but it is guaranteed to return a value.

If needed, the entire video file is read to determine the duration.
However, if the duration is stored in the metadata, it will be used, so it will not read the entire file.

name​

string

The name of the file.

container​

MediaParserContainer

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 webReader (default).

slowStructure​

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. However, if the frame rate is stored in the metadata, it will be used, so it will not read the entire file.

videoCodec​

MediaParserVideoCodec | null

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​

MediaParserAudioCodec | null

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​

MediaParserMetadataEntry[]

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

location​

MediaParserLocation | null

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​

MediaParserTrack[]

An array of MediaParserTrack.

keyframes​

MediaParserKeyframe[] | null

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

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

slowKeyframes​

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​

MediaParserDimensions | null

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).
Always one of the following values: 0, 90, 180, 270.

note

Breaking change from v4.0.328: The rotation is now in counter-clockwise degrees, where as before it was in clockwise degrees.
This is because the WebCodecs spec now supports rotation and since MediaParserVideoTrack can be passed to VideoDecoder.configure(), this change was necessary to make sure the rotation is always in the correct direction.

images​

MediaParserEmbeddedImage[]

Embedded images in the file, for example an album cover inside an MP3.

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​

M3uStream[] | null

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