packages/docs/docs/media-parser/fields.mdx
:::warning We are phasing out Media Parser and are moving to Mediabunny! :::
The following fields are available in parseMedia():
dimensionsMediaParserDimensions | 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.
durationInSecondsnumber | null
The duration of the video in seconds.
Only returns a non-null value if the duration is stored in the metadata.
slowDurationInSecondsnumber
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.
namestring
The name of the file.
containerThe container of the file.
sizenumber | null
The size of the input in bytes.
mimeTypestring | null
The MIME type of the file that was returned when the file was fetched.
Only available if using the webReader (default).
slowStructureThe internal structure of the video. Unstable, internal data structure, refer to the TypeScript types to see what's inside.
fpsnumber | null
The frame rate of the video.
Only returns a non-null value if the frame rate is stored in the metadata.
slowFpsnumber
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.
videoCodecMediaParserVideoCodec | 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).
audioCodecMediaParserAudioCodec | 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).
metadataMetadata fields such as ID3 tags or EXIF data.
See metadata for more information.
locationMediaParserLocation | null
The location of the video was shot. Either null if not available or:
latitude: The latitude of the locationlongitude: The longitude of the locationaltitude: The altitude of the location (can be null)horizontalAccuracy: The horizontal accuracy of the location (can be null)tracksAn array of MediaParserTrack.
keyframesMediaParserKeyframe[] | 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.
slowKeyframesAn array of keyframes, same as keyframes, but it is guaranteed to return a value.
Will read the entire video file to determine the keyframes.
slowNumberOfFramesnumber
The number of video frames in the media.
Will read the entire video file to determine the number of frames.
unrotatedDimensionsMediaParserDimensions | null
The dimensions of the video before rotation.
isHdrboolean
Whether the video is in HDR (High dynamic range).
rotationnumber
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.
:::
imagesEmbedded images in the file, for example an album cover inside an MP3.
sampleRatenumber | null
The audio sample rate, if there is an audio track.
numberOfAudioChannelsnumber | null
The number of audio channels, if there is an audio track.
slowAudioBitratenumber
The audio bitrate in bits per second. null if there is no audio track.
:::note 1 byte is 8 bits. :::
slowVideoBitratenumber | null
The video bitrate in bits per second. null if there is no video track.
:::note 1 byte is 8 bits. :::
m3uStreamsM3uStream[] | null
Only for .m3u8, this will return a non-null value if the file is a playlist.