Android.Media.MediaFormat Class
Encapsulates the information describing the format of media data, be it audio or video.

See Also: MediaFormat Members

Syntax

[Android.Runtime.Register("android/media/MediaFormat", DoNotGenerateAcw=true)]
public sealed class MediaFormat : Java.Lang.Object

Remarks

Encapsulates the information describing the format of media data, be it audio or video. The format of the media data is specified as string/value pairs. Keys common to all audio/video formats, all keys not marked optional are mandatory:
NameValue TypeDescription
MediaFormat.KeyMimeStringThe type of the format.
MediaFormat.KeyMaxInputSizeIntegeroptional, maximum size of a buffer of input data
MediaFormat.KeyBitRateIntegerencoder-only, desired bitrate in bits/second
Video formats have the following keys:
NameValue TypeDescription
MediaFormat.KeyWidthInteger
MediaFormat.KeyHeightInteger
MediaFormat.KeyColorFormatIntegerset by the user for encoders, readable in the output format of decoders
MediaFormat.KeyFrameRateInteger or Floatencoder-only
MediaFormat.KeyCaptureRateInteger
MediaFormat.KeyIFrameIntervalIntegerencoder-only
MediaFormat.KeyMaxWidthIntegerdecoder-only, optional, max-resolution width
MediaFormat.KeyMaxHeightIntegerdecoder-only, optional, max-resolution height
MediaFormat.KeyRepeatPreviousFrameAfterLongvideo encoder in surface-mode only
MediaFormat.KeyPushBlankBuffersOnStopInteger(1)video decoder rendering to a surface only
Specify both MediaFormat.KeyMaxWidth and MediaFormat.KeyMaxHeight to enable adaptive playback (seamless resolution change) for a video decoder that supports it (NoType:android/media/MediaCodecInfo$CodecCapabilities;Href=../../../reference/android/media/MediaCodecInfo.CodecCapabilities.html#FEATURE_AdaptivePlayback). The values are used as hints for the codec: they are the maximum expected resolution to prepare for. Depending on codec support, preparing for larger maximum resolution may require more memory even if that resolution is never reached. These fields have no effect for codecs that do not support adaptive playback.



Audio formats have the following keys:
NameValue TypeDescription
MediaFormat.KeyChannelCountInteger
MediaFormat.KeySampleRateInteger
MediaFormat.KeyIsAdtsIntegeroptional, if decoding AAC audio content, setting this key to 1 indicates that each audio frame is prefixed by the ADTS header.
MediaFormat.KeyAacProfileIntegerencoder-only, optional, if content is AAC audio, specifies the desired profile.
MediaFormat.KeyAacSbrModeIntegerencoder-only, optional, if content is AAC audio, specifies the desired SBR mode.
MediaFormat.KeyAacDrcTargetReferenceLevelIntegerdecoder-only, optional, if content is AAC audio, specifies the target reference level.
MediaFormat.KeyAacEncodedTargetLevelIntegerdecoder-only, optional, if content is AAC audio, specifies the target reference level used at encoder.
MediaFormat.KeyAacDrcBoostFactorIntegerdecoder-only, optional, if content is AAC audio, specifies the DRC boost factor.
MediaFormat.KeyAacDrcAttenuationFactorIntegerdecoder-only, optional, if content is AAC audio, specifies the DRC attenuation factor.
MediaFormat.KeyAacDrcHeavyCompressionIntegerdecoder-only, optional, if content is AAC audio, specifies whether to use heavy compression.
MediaFormat.KeyAacMaxOutputChannelCountIntegerdecoder-only, optional, if content is AAC audio, specifies the maximum number of channels the decoder outputs.
MediaFormat.KeyChannelMaskIntegeroptional, a mask of audio channel assignments
MediaFormat.KeyFlacCompressionLevelIntegerencoder-only, optional, if content is FLAC audio, specifies the desired compression level.
Subtitle formats have the following keys:
MediaFormat.KeyMimeStringThe type of the format.
MediaFormat.KeyLanguageStringThe language of the content.

[Android Documentation]

Requirements

Namespace: Android.Media
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 16