@amazon-devices/keplermediadescriptor
The Vega Media Descriptor API provides functionality that allows apps to query the codec capabilities of the device. The API also considers the connected device's support and returns the capabilities according to the device's limitations.
Get Started
Prerequisites
The KeplerMediaDescriptor API is dependent on the following interfaces:
For instructions on how to install the Vega SDK, see Vega SDK Setup.
Setup
Add the following library dependency to the dependencies section of your package.json file.
"@amazon-devices/keplermediadescriptor": "~1.1.17",
Usage
Use this package to get the device video and audio capabilities and play your content accordingly. Some of the common use cases include:
- To Determine whether the device supports a specified video/audio codec.
- For a given video codec, determine whether the device supports a certain profile level or frame rate or bitrate or resolution.
- Determine whether the device supports a particular mime type.
- Determine whether the connected device (TV/AVR etc. in a Fire TV Stick use case) supports the Dolby codec.
Import the required interfaces from the package
import {
KeplerMediaDescriptor,
MediaFormat,
VideoDecoderConfig,
VideoFormat,
AudioDecoderConfig,
AudioFormat,
MediaFormatProfileLevel,
} from "@amazon-devices/keplermediadescriptor";
Query Video Decoder capabilities.
This example shows how to query the capabilities using the codec name. It also sets the other optional attributes like resolution, bitrate, and FPS.
let mediaFormat : MediaFormat = new MediaFormat(CodecMimeType.MIME_AVC);
// 12Mbps bitrate
mediaFormat.bitrateKbps = 12000;
// 1080p Resolution
let videoFormat = new VideoFormat();
videoFormat.resolution = {
width = 1080,
height = 1920
};
// 60fps frame rate
videoFormat.frameRate = 60;
// use the decoder config to send all the attributes
// in a single go.
const decoderConfig = new VideoDecoderConfig();
decoderConfig.mediaFormat = mediaFormat;
decoderConfig.videoFormat = videoFormat;
decoderConfig.formatProfileLevel = profileLevel;
Note: You can also include the codec value with a mime string.
// avc codec with Main Profile and Level 4.2
let mime = "video/mp4; codecs="avc1.640028""
let profileLevel = new MediaFormatProfileLevel(mime);
decoderConfig.formatProfileLevel = profileLevel;
After the VideoDecoderConfig object is ready, you can call the query method. If the capabilities
array returned has at least one entry, it means that the attributes requested are supported
by the device.
let videoCaps = await KeplerMediaDescriptor.queryMediaCapabilities(decoderConfig);
if (videoCaps.length > 0) {
console.info("The device supports the requested config");
}
Read the video capabilities returned
The capabilities returned from the queryMediaCapabilities API contain further information about the device support.
// loop through the capabilities
for (let index = 0; index < videoCaps.length; index++) {
let videoCapability = videoCaps[index];
// check if the codec is hardware backed
if (videoCapability.mediaCodecFeaturesCapabilities.hardwareBacked) {
console.log("codec is hardware backed.")
}
// Get the min and max resolution supported by the codec:
let resolutions = videoCapability.videoFormatCapabilities.resolutions;
console.log("min resolution is ", resolutions[0], " max resolution is ", resolutions[1]);
// Get the max frame rate supported by the codec for a given resolution
let maxFps = videoCapability.videoFormatCapabilities.getMaxFrameRate(resolutions[1]);
// Get all the color formats supported by the decoder:
console.log(videoCapability.videoFormatCapabilities.colorFormats);
// check if the codec supports decryption
if (videoCapability.decoderFeaturesCapabilities.decryptionSupported) {
console.log("decryption is supported by this codec");
}
}
Query Audio Decoding Capabilities
Similar to the video capabilities, you can query for audio decoding support of the device.
let mediaFormat = new MediaFormat(CodecMimeType.MIME_AAC);
let audioFormat = new AudioFormat();
audioFormat.channelCount = 2;
audioFormat.sampleRate = 44100;
const decoderConfig = new AudioDecoderConfig();
decoderConfig.mediaFormat = mediaFormat;
decoderConfig.audioFormat = audioFormat;
let audioCaps = await KeplerMediaDescriptor.queryMediaCapabilities(decoderConfig);
Check Dolby support
You can use queryMediaCapabilities() method to determine the Dolby support of the device. For a Fire TV Stick the method takes into consideration items such as the connected TV and AVR.
let mediaFormat = new MediaFormat(CodecMimeType.MIME_AC3); // or MIME_EAC3
const decoderConfig = new AudioDecoderConfig();
decoderConfig.mediaFormat = mediaFormat;
let audioCaps = await KeplerMediaDescriptor.queryMediaCapabilities(decoderConfig);
if (audioCaps.length > 0) {
console.log("the device supports DOLBY digital audio");
}
Read the audio capabilities returned
// loop through the capabilities
for (let index = 0; index < audioCaps.length; index++) {
let audioCapability = audioCaps[index];
if (audioCapability.decoderFeaturesCapabilities.decryptionSupported) {
console.log("The codec supports decryption");
}
}
FAQ
- Q: Can I get all the codecs supported by the device in a single call?
- Use
CodecMimeType.MIME_VIDEO_UNSPECIFIEDandCodecMimeType.MIME_AUDIO_UNSPECIFIEDas a wild card.
API Reference
Classes
- AudioDecoderConfig — The AudioDecoderConfig defines all the attributes required for audio
- AudioFormat — AudioFormat provides setters to set different properties
- DecoderFeatures — DecoderFeatures provides setters for different decoder features.
- KeplerMediaDescriptor — The entry point for KMD apis. This class provides apis to query the media capabilities of
- MediaCodecFeatures — MediaCodecFeatures provides setters for different codec features.
- MediaFormat — Represents the format of the media.
- MediaFormatProfileLevel — Class to set the codec profile and level.
- VideoDecoderConfig — The VideoDecoderConfig defines all the attributes required for Video
- VideoFormat — VideoFormat provides setters to set different properties
Interfaces
- AudioDecoderCapabilities — Interface to get the capabilities of the audio codec queried for decode use case.
- DecoderFeaturesCapabilities — Interface to get capabilities about the features supported
- MediaCodecFeaturesCapabilities — Interface to get features supported by media codecs.
- MediaFormatProfileLevelCapabilities — Interface to get the Profile level and codec param capabilities
- ProfileLevel — Profile and Level values for codecs.
- Resolution — Video Resolution in pixels
- VideoDecoderCapabilities — Interface to get the capabilities of the video codec queried for decode use case.
- VideoFormatCapabilities — Interface to get video format capabilities
Enumerations
- AudioSampleFormat — Audio Raw Sample Format
- CodecMimeType — Codec Mime Types
- VideoColorMatrix — Video Color Matrix
- VideoColorPrimaries — Video Color Primaries
- VideoColorTransfer — Video Color Transfer
Type Aliases
Variables
- AV1Level2 — AV1 level 2
- AV1Level21 — AV1 level 2.1
- AV1Level22 — AV1 level 2.2
- AV1Level23 — AV1 level 2.3
- AV1Level3 — AV1 level 3
- AV1Level31 — AV1 level 3.1
- AV1Level32 — AV1 level 3.2
- AV1Level33 — AV1 level 3.3
- AV1Level4 — AV1 level 4
- AV1Level41 — AV1 level 4.1
- AV1Level42 — AV1 level 4.2
- AV1Level43 — AV1 level 4.3
- AV1Level5 — AV1 level 5
- AV1Level51 — AV1 level 5.1
- AV1Level52 — AV1 level 5.2
- AV1Level53 — AV1 level 5.3
- AV1Level6 — AV1 level 6
- AV1Level61 — AV1 level 6.1
- AV1Level62 — AV1 level 6.2
- AV1Level63 — AV1 level 6.3
- AV1Level7 — AV1 level 7
- AV1Level71 — AV1 level 7.1
- AV1Level72 — AV1 level 7.2
- AV1Level73 — AV1 level 7.3
- AV1LevelUnknown — unknown AV1 level
- AV1ProfileMain10 — AV1 main profile 10 bit depth
- AV1ProfileMain10HDR10 — AV1 main profile 10 bit depth for HDR
- AV1ProfileMain10HDR10Plus — AV1 main profile 10 bit depth for HDR10+
- AV1ProfileMain8 — AV1 main profile 8 bit depth
- AV1ProfileUnknown — Unknown AV1 profile
- AVCLevel1 — AVC level 1
- AVCLevel11 — AVC level 1.1
- AVCLevel12 — AVC level 1.2
- AVCLevel13 — AVC level 1.3
- AVCLevel1b — AVC level 1b
- AVCLevel2 — AVC level 2
- AVCLevel21 — AVC level 2.1
- AVCLevel22 — AVC level 2.2
- AVCLevel3 — AVC level 3
- AVCLevel31 — AVC level 3.1
- AVCLevel32 — AVC level 3.2
- AVCLevel4 — AVC level 4
- AVCLevel41 — AVC level 4.1
- AVCLevel42 — AVC level 4.2
- AVCLevel5 — AVC level 5
- AVCLevel51 — AVC level 5.1
- AVCLevel52 — AVC level 5.2
- AVCLevel6 — AVC level 6
- AVCLevel61 — AVC level 6.1
- AVCLevel62 — AVC level 6.2
- AVCLevelUnknown — unknown AVC level
- AVCProfileBaseline — AVC baseline profile
- AVCProfileConstrainedBaseline — AVC Constrained Baseline Profile
- AVCProfileConstrainedHigh — AVC Constrained High Profile
- AVCProfileExtended — AVC extended profile
- AVCProfileHigh — AVC high profile
- AVCProfileHigh10 — AVC high profile 10
- AVCProfileHigh422 — AVC high profile 4:2:2
- AVCProfileHigh444 — AVC high profile 4:4:4
- AVCProfileMain — AVC main profile
- AVCProfileUnknown — Unknown AVC profile
- DolbyVisionLevelFhd24 — Dolby vision level FHD 2.4
- DolbyVisionLevelFhd30 — Dolby vision level FHD 3.0
- DolbyVisionLevelFhd60 — Dolby vision level FHD 6.0
- DolbyVisionLevelHd24 — Dolby vision level HD 2.4
- DolbyVisionLevelHd30 — Dolby vision level HD 3.0
- DolbyVisionLevelUhd24 — Dolby vision level UHD 2.4
- DolbyVisionLevelUhd30 — Dolby vision level UHD 3.0
- DolbyVisionLevelUhd48 — Dolby vision level UHD 4.8
- DolbyVisionLevelUhd60 — Dolby vision level UHD 6.0
- DolbyVisionLevelUnknown — Unknown dolby vision level
- DolbyVisionProfileDvavPen — Dolby vision profile based on AV1 codec.
- DolbyVisionProfileDvavPer — Dolby vision profile based on AV1 codec.
- DolbyVisionProfileDvavSe — Dolby vision profile based on AVC codec.
- DolbyVisionProfileDvheDen — Dolby vision profile based on 8 bit HEVC codec.
- DolbyVisionProfileDvheDer — Dolby vision profile based on 8 bit HEVC codec.
- DolbyVisionProfileDvheDtb — Dolby vision profile based on HEVC codec.
- DolbyVisionProfileDvheDth — Dolby vision profile based on 10bit HEVC codec
- DolbyVisionProfileDvheDtr — Dolby vision profile based on HEVC codec.
- DolbyVisionProfileDvheSt — Dolby vision profile based on HEVC codec.
- DolbyVisionProfileDvheStn — Dolby vision profile based on HEVC codec.
- DolbyVisionProfileUnknown — Unknwon Dolby vision profile
- H263Level10 — H263 level 1.0
- H263Level20 — H263 level 2.0
- H263Level30 — H263 level 3.0
- H263Level40 — H263 level 4.0
- H263Level50 — H263 level 5.0
- H263Level60 — H263 level 6.0
- H263Level70 — H263 level 7.0
- H263LevelUnknown — Unknown h263 level
- H263ProfileBackwardCompatible — H263 BackwardCompatible profile
- H263ProfileBaseline — H263 baseline profile
- H263ProfileH320Coding — H263 H320Coding profile
- H263ProfileHighCompression — H263 HighCompression profile
- H263ProfileHighLatency — H263 HighLatency profile
- H263ProfileInterlace — H263 Interlace profile
- H263ProfileInternet — H263 Internet profile
- H263ProfileISWV2 — H263 ISWV2 profile
- H263ProfileISWV3 — H263 ISWV3 profile
- H263ProfileUnknown — Unknown H263 profile
- HEVCHighTierLevel4 — HEVC high tier level 4
- HEVCHighTierLevel41 — HEVC high tier level 4.1
- HEVCHighTierLevel5 — HEVC high tier level 5
- HEVCHighTierLevel51 — HEVC high tier level 5.1
- HEVCHighTierLevel52 — HEVC high tier level 5.2
- HEVCHighTierLevel6 — HEVC high tier level 6
- HEVCHighTierLevel61 — HEVC high tier level 6.1
- HEVCHighTierLevel62 — HEVC high tier level 6.2
- HEVCLevelUnknown — Unknown HEVC level
- HEVCMainTierLevel1 — HEVC main tier level 1
- HEVCMainTierLevel2 — HEVC main tier level 2
- HEVCMainTierLevel21 — HEVC main tier level 2.1
- HEVCMainTierLevel3 — HEVC main tier level 3
- HEVCMainTierLevel31 — HEVC main tier level 3.1
- HEVCMainTierLevel4 — HEVC main tier level 4
- HEVCMainTierLevel41 — HEVC main tier level 4.1
- HEVCMainTierLevel5 — HEVC main tier level 5
- HEVCMainTierLevel51 — HEVC main tier level 5.1
- HEVCMainTierLevel52 — HEVC main tier level 5.2
- HEVCMainTierLevel6 — HEVC main tier level 6
- HEVCMainTierLevel61 — HEVC main tier level 6.1
- HEVCMainTierLevel62 — HEVC main tier level 6.2
- HEVCProfileMain — HEVC main profile
- HEVCProfileMain10 — HEVC main 10 proile
- HEVCProfileMain10HDR10 — HEVC HDR main 10 profile
- HEVCProfileMain10HDR10Plus — HEVC HDR10+ main 10 profile
- HEVCProfileMainStill — HEVC Main Still Picture profile
- HEVCProfileUnknown — Unknown HEVC profile
- MPEG2LevelH14 — MPEG2 high 1440
- MPEG2LevelHL — MPEG2 high level
- MPEG2LevelHP — MPEG2 level HP
- MPEG2LevelLL — MPEG2 low level
- MPEG2LevelML — MPEG2 main level
- MPEG2LevelUnknown — Unknown MPEG2 level
- MPEG2Profile422 — MPEG2 4:2:2 profile
- MPEG2ProfileHigh — MPEG2 high profile
- MPEG2ProfileMain — MPEG2 main profile
- MPEG2ProfileSimple — MPEG2 simple profile
- MPEG2ProfileSNR — MPEG2 SNR scalable profile
- MPEG2ProfileSpatial — MPEG2 spatially scalable profile
- MPEG2ProfileUnknown — unknown MPEG2 profile
- MPEG4Level0 — MPEG4 level 0
- MPEG4Level0b — MPEG4 level 0b
- MPEG4Level1 — MPEG4 level 1
- MPEG4Level2 — MPEG4 level 2
- MPEG4Level3 — MPEG4 level 3
- MPEG4Level3b — MPEG4 level 3b
- MPEG4Level4 — MPEG4 level 4
- MPEG4Level4a — MPEG4 level 4a
- MPEG4Level5 — MPEG4 level 5
- MPEG4Level6 — MPEG4 level 6
- MPEG4LevelUnknown — Unknown MPEG4 level
- MPEG4ProfileAdvancedCoding — MPEG4 advanced coding profile
- MPEG4ProfileAdvancedCore — MPEG4 advanced core profile
- MPEG4ProfileAdvancedRealTime — MPEG4 advanced realtime profile
- MPEG4ProfileAdvancedScalable — MPEG4 advanced scalable profile
- MPEG4ProfileAdvancedSimple — MPEG4 advanced simple profile
- MPEG4ProfileBasicAnimated — MPEG4 basic animated profile
- MPEG4ProfileCore — MPEG4 core profile
- MPEG4ProfileCoreScalable — MPEG4 core scalable profile
- MPEG4ProfileHybrid — MPEG4 hybrid profile
- MPEG4ProfileMain — MPEG4 main profile
- MPEG4ProfileNbit — MPEG4 Nbit profile
- MPEG4ProfileScalableTexture — MPEG4 scalable texture profile
- MPEG4ProfileSimple — MPEG4 simple profile
- MPEG4ProfileSimpleFace — MPEG4 simple face profile
- MPEG4ProfileSimpleFBA — MPEG4 simple FBA profile
- MPEG4ProfileSimpleScalable — MPEG4 simple scalable profile
- MPEG4ProfileUnknown — unknown MPEG4 profile
- VP8LevelUnknown — Unknown VP8 level
- VP8LevelVersion0 — VP8 level version 0
- VP8LevelVersion1 — VP8 level version 1
- VP8LevelVersion2 — VP8 level version 2
- VP8LevelVersion3 — VP8 level version 3
- VP8ProfileMain — VP8 main profile
- VP8ProfileUnknown — Unknown VP8 profile
- VP9Level1 — VP9 Level 1
- VP9Level11 — VP9 Level 1.1
- VP9Level2 — VP9 Level 2
- VP9Level21 — VP9 Level 2.1
- VP9Level3 — VP9 Level 3
- VP9Level31 — VP9 Level 3.1
- VP9Level4 — VP9 Level 4
- VP9Level41 — VP9 Level 4.1
- VP9Level5 — VP9 Level 5
- VP9Level51 — VP9 Level 5.1
- VP9Level52 — VP9 Level 5.2
- VP9Level6 — VP9 Level 6
- VP9Level61 — VP9 Level 6.1
- VP9Level62 — VP9 Level 6.2
- VP9LevelUnknown — Unknown VP9 level
- VP9Profile0 — VP9 profile 0
- VP9Profile1 — VP9 profile 1
- VP9Profile2 — VP9 profile 2
- VP9Profile2HDR — VP9 profile 2 for HDR
- VP9Profile2HDR10Plus — VP9 profile 2 for HDR10+
- VP9Profile3 — VP9 profile 3
- VP9Profile3HDR — VP9 profile 3 for HDR
- VP9Profile3HDR10Plus — VP9 profile 3 for HDR10+
- VP9ProfileUnknown — Unknown VP9 profile
Last updated: Jul 22, 2026

