Multimedia formats supported by the Android platform

foreword

This document describes the media codecs, containers, and network protocol support provided by the Android platform. (excerpt from google docs)

As an application developer, you can use any media codec available on any Android device (including Android platform-provided media codecs and device-specific media codecs). However, the best practice is to use a device-independent media encoding profile.

The following table describes the media format support built into the Android platform. Codecs not guaranteed to be available on all Android platform versions are noted in parentheses, eg: (Android 3.0 and higher). Note that any given mobile device may support other formats or file types not listed in this table.

Section 5 of the Android Compatibility Definition specifies the media formats a device must support to be compatible with Android 8.1.

1. Audio support

Audio Formats and Codecs

format/codec Encoder decoder details Supported file types/container formats
AAC LC Supports mono/stereo/5.0/5.1 content with a standard sample rate of 8-48 kHz. • 3GPP (.3gp)
• MPEG-4 (.mp4, .m4a) • ADTS Raw AAC (.aac, decodes in Android 3.1 and higher, encodes in Android 4.0 and higher, does not support ADIF) • MPEG-TS (.ts, non-seekable, Android 3.0 and higher)
HE-AACv1 (AAC+)
(Android 4.1 and higher)
HE-AACv2 (Enhanced AAC+)   Stereo/5.0/5.1 content is supported with a standard sample rate of 8-48 kHz.
AAC ELD (Enhanced Low Latency AAC)
(Android 4.1 and higher)

(Android 4.1 and higher)
Supports mono/stereo content with a standard sample rate of 16-48 kHz
AMR-NB 4.75-12.2 kbps, sampling rate 8 kHz 3GPP (.3gp)
AMR-WB Choice of 9 bit rates (between 6.60-23.85 kbit/s) with a sample rate of 16 kHz 3GPP (.3gp)
FLAC
(Android 4.1 and higher)

(Android 3.1 and higher)
Mono/Stereo (not multi-channel). Sampling rates up to 48 kHz are possible (but for devices with a 44.1 kHz output, no higher than 44.1 kHz is recommended, as the 48-44.1 kHz downsampler does not include a low-pass filter). 16-bit is recommended; for 24-bit, no dithering will be applied. Only FLAC (.flac) is supported
GSM   Android supports GSM decoding on phone devices GSM (.gsm)
MIDI   MIDI types 0 and 1. DLS versions 1 and 2. XMF and Mobile XMF. Supports ringtone formats RTTTL/RTX, OTA and iMelody • Type 0 and 1 (.mid, .xmf, .mxmf)
• RTTTL/RTX (.rtttl, .rtx) • OTA (.ota) • iMelody (.imy)
MP3   Mono/Stereo 8-320 Kbps Constant (CBR) or Variable Bit Rate (VBR) MP3 (.mp3)
Opus
(Android 5.0 and higher)
Matroska (.mkv)
PCM/WAVE
(Android 4.1 and higher)
8-bit and 16-bit linear PCM (bitrate up to hardware cap). Sampling rates required to record raw PCM at 8000, 16000, and 44100 Hz. WAVE (.wav)
Vorbis     • Ogg (.ogg)
• Matroska (.mkv, Android 4.0 and higher)

2. Video support

Video Formats and Codecs

format/codec Encoder decoder details Supported file types/container formats
H.263 Support for H.263 is not required in Android 7.0 and higher • 3GPP (.3gp)
• MPEG-4 (.mp4)
H.264 AVC
Baseline Profile (BP)

(Android 3.0 and higher)
• 3GPP (.3gp)
• MPEG-4 (.mp4) • MPEG-TS (.ts, AAC audio only, non-seekable, Android 3.0 and higher)
H.264 AVC
Main Profile (MP)

(Android 6.0 and higher)
Decoders are required and encoders are recommended.
H.265 HEVC
(Android 5.0 and higher)
Main Profile Level 3 for Mobile and Main Profile Level 4.1 for Android TV • MPEG-4 (.mp4)
MPEG-4 SP     3GPP (.3gp)
VP8
(Android 4.3 and higher)

(Android 2.3.3 and higher)
Can only stream on Android 4.0 and above WebM (.webm)
• Matroska (.mkv, Android 4.0 and higher)
VP9
(Android 4.4 and higher)
WebM (.webm)
• Matroska (.mkv, Android 4.0 and higher)

Video Encoding Recommendations

下表列出了建议使用 H.264 Baseline Profile 编解码器进行播放的 Android 媒体框架视频编码配置文件和参数。同样的建议也适用于 Main Profile 编解码器,该编解码器仅在 Android 6.0 及更高版本中可用。

  标清(低画质) 标清(高画质) 高清 720p(在所有设备上均不适用)
视频分辨率 176 x 144 像素 480 x 360 像素 1280 x 720 像素
视频帧速率 12 fps 30 fps 30 fps
视频比特率 56 Kbps 500 Kbps 2 Mbps
音频编解码器 AAC-LC AAC-LC AAC-LC
声道 1(单声道) 2(立体声) 2(立体声)
音频比特率 24 Kbps 128 Kbps 192 Kbps

下表列出了建议使用 VP8 媒体编解码器进行播放的 Android 媒体框架视频编码配置文件和参数。

  标清(低画质) 标清(高画质) 高清 720p(在所有设备上均不适用) 高清 1080p(在所有设备上均不适用)
视频分辨率 320 x 180 像素 640 x 360 像素 1280 x 720 像素 1920 x 1080 像素
视频帧速率 30 fps 30 fps 30 fps 30 fps
视频比特率 800 Kbps 2 Mbps 4 Mbps 10 Mbps

视频解码建议

对于所有 VP8、VP9、H.264 和 H.265 编解码器,设备实现都必须支持通过标准 Android API 在同一视频流内实时进行动态视频分辨率和帧速率切换,并且能够支持设备上每个编解码器所支持的最大分辨率。

支持杜比视界解码器的实现必须遵循以下准则:

  • 提供具有杜比视界功能的提取器。

  • 在设备屏幕或标准视频输出端口(如 HDMI)上正确显示杜比视界内容。

  • 将向后兼容的基本层(如果存在)的轨道索引设为与组合式杜比视界层的轨道索引相同。

视频流式传输要求

对于通过 HTTP 或 RTSP 流式传输的视频内容,还有一些其他要求:

  • 对于 3GPP 和 MPEG-4 容器,moov Atom 必须位于任何 mdat Atom 之前,但必须位于 ftyp Atom 之后。
  • 对于 3GPP、MPEG-4 和 WebM 容器,对应于相同时间偏移量的音频和视频样本的偏差不能超过 500
    KB。要最大限度地减少这种音频/视频偏差,请考虑以较小的区块大小交错插入音频和视频。

三、图片支持

格式/编解码器 编码器 解码器 详细信息 支持的文件类型/容器格式
BMP     BMP (.bmp)
GIF     GIF (.gif)
JPEG 基准式 + 渐进式 JPEG (.jpg)
PNG   PNG (.png)
WebP
(Android 4.0 及更高版本)
(无损、透明度、Android 4.2.1 及更高版本)

(Android 4.0 及更高版本)
(无损、透明度、Android 4.2.1 及更高版本)
  WebP (.webp)
HEIF  
(Android 8.0 及更高版本)
  HEIF(.heic;.heif)

四、网络协议

音频和视频播放支持以下网络协议:

  • RTSP(RTP、SDP)
  • HTTP/HTTPS 渐进式流式传输
  • HTTP/HTTPS 实时流式传输草案协议:
    • 仅限 MPEG-2 TS 媒体文件
    • 协议版本 3(Android 4.0 及更高版本)
    • 协议版本 2 (Android 3.x)
    • 在 Android 3.0 之前的版本中不支持

Guess you like

Origin blog.csdn.net/qq_35831940/article/details/118909572