Android支持的媒体格式

Android Supported Media Formats

This document describes the media codec, container, and network protocol support provided by the Android platform.

As an application developer, you are free to make use of any media codec that is available on any Android-powered device, including those provided by the Android platform and those that are device-specific.However, it is a best practice to use media encoding profiles that are device-agnostic.

Network Protocols


The following network protocols are supported for audio and video playback:

  • RTSP (RTP, SDP)
  • HTTP/HTTPS progressive streaming
  • HTTP/HTTPS live streamingdraft protocol:
    • MPEG-2 TS media files only
    • Protocol version 3 (Android 4.0 and above)
    • Protocol version 2 (Android 3.x)
    • Not supported before Android 3.0

Note:HTTPS is not supported before Android 3.1.

Core Media Formats


The table below describes the media format support built into the Android platform. Note that any given mobile device may provide support for additional formats or file types not listed in the table.

Note:Media codecs that are not guaranteed to be available on all Android platform versions are accordingly noted in parentheses—for example "(Android 3.0+)".

Table 1.Core media format and codec support.

Type Format / Codec Encoder Decoder Details Supported File Type(s) / Container Formats
Audio AAC LC/LTP Mono/Stereo content in any combination of standard bit rates up to 160 kbps and sampling rates from 8 to 48kHz • 3GPP (.3gp)
• MPEG-4 (.mp4, .m4a)
• ADTS raw AAC (.aac, decode in Android 3.1+, encode in Android 4.0+, ADIF not supported)
• MPEG-TS (.ts, not seekable, Android 3.0+)
HE-AACv1 (AAC+)
HE-AACv2 (enhanced AAC+)
AMR-NB 4.75 to 12.2 kbps sampled @ 8kHz 3GPP (.3gp)
AMR-WB 9 rates from 6.60 kbit/s to 23.85 kbit/s sampled @ 16kHz 3GPP (.3gp)
FLAC
(Android 3.1+)
Mono/Stereo (no multichannel). Sample rates up to 48 kHz (but up to 44.1 kHz is recommended on devices with 44.1 kHz output, as the 48 to 44.1 kHz downsampler does not include a low-pass filter). 16-bit recommended; no dither applied for 24-bit. FLAC (.flac) only
MP3 Mono/Stereo 8-320Kbps constant (CBR) or variable bit-rate (VBR) MP3 (.mp3)
MIDI MIDI Type 0 and 1. DLS Version 1 and 2. XMF and Mobile XMF. Support for ringtone formats RTTTL/RTX, OTA, and iMelody • Type 0 and 1 (.mid, .xmf, .mxmf)
• RTTTL/RTX (.rtttl, .rtx)
• OTA (.ota)
• iMelody (.imy)
Vorbis • Ogg (.ogg)
• Matroska (.mkv, Android 4.0+)
PCM/WAVE 8- and 16-bit linear PCM (rates up to limit of hardware) WAVE (.wav)
Image JPEG Base+progressive JPEG (.jpg)
GIF GIF (.gif)
PNG PNG (.png)
BMP BMP (.bmp)
WEBP
(Android 4.0+)

(Android 4.0+)
WebP (.webp)
Video H.263 • 3GPP (.3gp)
• MPEG-4 (.mp4)
H.264 AVC
(Android 3.0+)
Baseline Profile (BP) • 3GPP (.3gp)
• MPEG-4 (.mp4)
• MPEG-TS (.ts, AAC audio only, not seekable, Android 3.0+)
MPEG-4 SP 3GPP (.3gp)
VP8
(Android 2.3.3+)
Streamable only in Android 4.0 and aboveWebM(.webm)
• Matroska (.mkv, Android 4.0+)

Video Encoding Recommendations


Table 2, below, lists examples of video encoding profiles and parameters that the Android media framework supports for playback. In addition to these encoding parameter recommendations, a device's availablevideo recordingprofiles can be used as a proxy for media playback capabilities. These profiles can be inspected using theCamcorderProfileclass, which is available since API level 8.

Table 2.Examples of supported video encoding parameters.

SD (Low quality) SD (High quality) HD (Not available on all devices)
Video codec H.264 Baseline Profile H.264 Baseline Profile H.264 Baseline Profile
Video resolution 176 x 144 px 480 x 360 px 1280 x 720 px
Video frame rate 12 fps 30 fps 30 fps
Video bitrate 56 Kbps 500 Kbps 2 Mbps
Audio codec AAC-LC AAC-LC AAC-LC
Audio channels 1 (mono) 2 (stereo) 2 (stereo)
Audio bitrate 24 Kbps 128 Kbps 192 Kbps

For video content that is streamed over HTTP or RTSP, there are additional requirements:

  • For 3GPP and MPEG-4 containers, themoovatom must precede anymdatatoms, but must succeed theftypatom.
  • For 3GPP, MPEG-4, and WebM containers, audio and video samples corresponding to the same time offset may be no more than 500 KB apart. To minimize this audio/video drift, consider interleaving audio and video in smaller chunk sizes.

Android支持的媒体格式

本文档介绍了媒体编解码器,容器,和Android平台所提供的网络协议的支持。

作为应用程序开发人员,您可以自由使用任何媒体编解码器,可用在任何Android的供电设备,包括Android平台所提供的那些设备特定的。但是,它是最好的做法是使用媒体编码配置文件是设备无关

网络协议


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

  • RTSP协议(RTP,SDP的)
  • HTTP / HTTPS的进步流
  • HTTP / HTTPS的现场直播议定书草案
    • MPEG-2 TS流媒体文件只
    • 协议版本3(的Andr​​oid 4.0及以上)
    • 议定书“第2版(Android的3.x版)
    • 不支持之前的Andr​​oid 3.0

注:HTTPS不支持之前的Android 3.1。

核心媒体格式


下表介绍了Android平台内置的媒体格式支持。请注意,任何特定的移动设备可能提供额外的格式或者表中未列出的文件类型的支持。

注:例如,括号“(Android 3.0的+)”中指出,不能保证所有Android平台版本的媒体编解码器相应。

表1。核心媒体格式和编解码器支持。

类型 格式/编解码器 编码器 解码器 详情 支持的文件类型(S)/容器格式
音频 AAC的LC / LTP 在任何组合标准比特率高达160 kbps和采样率从8至48kHz的单声道/立体声内容 •3GPP(.3 gp)的
MPEG-4(MP4,。M4A)
ADTS的原始的AAC(AAC,在Android 3.1解码,在Android 4.0编码,不支持将ADIF)
的MPEG-TS(TS,不可搜索的Android 5.0 +)
HE-AACv1(AAC +格式)
HE-AACv2(增强型AAC +等)
AMR-NB的 4.75至12.2 kbps的@ 8kHz的采样 3GPP(.3 GP)
AMR-WB的 9从6.60 kbit / s到23.85 kbit / s的@ 16kHz的采样率 3GPP(.3 GP)
后手
(Android的3.1 +)
单声道/立体声(多声道)。采样率可达48千赫(但高达44.1千赫,44.1千赫输出设备,建议为48至44.1千赫downsampler不包括一个低通滤波器)。16位建议;申请的24位没有抖动。 FLAC(FLAC)只
的MP3 单声道/立体声8-320Kbps的恒定(CBR)或可变比特率(VBR) MP3(MP3)
的MIDI 的MIDI类型0和1。当值律师服务版本1和2。XMF和移动XMF。为RTTTL / RTX,大田,iMelody铃声格式的支持 •类型0和1(。中旬,XMF,mxmf)
•RTTTL / RTX(。RTTTL,RTX)
•OTA(OTA)
•iMelody(。IMY)
Vorbis格式 •奥格(OGG)
的Matroska(MKV,Android的4.0 +)
PCM /波 8 - 位和16位线性PCM(速率高达硬件限制) WAVE(。WAV)
图像 JPEG格式 基地+累进 JPEG(JPG)
的GIF GIF(GIF)
巴布亚新几内亚 PNG(。PNG)
骨形态发生蛋白 BMP(。BMP)
WEBP
(Android的4.0 +)

(Android的4.0 +)
WebP(。webp)
视频 H.263的 •3GPP(.3 gp)的
MPEG-4(MP4)
H.264 AVC
(采用Android 3.0 +)
基线(BP) •3GPP(.3 gp)的
MPEG-4(MP4)
的MPEG-TS(TS,只AAC音频,不可搜索的Android 3.0 +)
MPEG-4 SP 3GPP(.3 GP)
VP8的
(Android的2.3.3 +)
流化只有在Android 4.0及以上WEBM(WEBM)
的Matroska(MKV,Android的4.0 +)

视频编码建议


表2,下面,列出了视频编码配置文件和参数,Android的媒体播放支持框架的例子。除了 ​​这些编码参数的建议,可用录像设备的配置文件可以被用来作为一个媒体播放功能的代理。检查这些文件,可以使用CamcorderProfile类,这是因为API级别8。

表2。支持的视频编码参数的例子。

SD(低质量) SD(高品质) 高清(不是所有的设备可用)
视频编解码器 的H.264 Baseline Profile 的H.264 Baseline Profile 的H.264 Baseline Profile
视频分辨率 176×144像​​素 480×360像素 1280×720像素
视频帧率 12 FPS 每秒30帧 每秒30帧
视频比特率 56 Kbps的 500 Kbps的 2 Mbps的
音频编解​​码器 的AAC-LC 的AAC-LC 的AAC-LC
音频通道 1(单声道) 2(立体声) 2(立体声)
音频比特率 24 Kbps的 128 Kbps的 192 Kbps的

对于视频的内容是通过HTTP或RTSP流,也有额外的要求:

  • MOOV原子3GPP和MPEG-4容器,必须先于任何MDAT原子,但必须成功的ftyp的原子。
  • 对于3GPP,MPEG-4和的WEBM容器,音频和视频同时偏移相应的样本可能是除了不超过500 KB的。为了减少这种音频/视频的漂移,考虑交错较小的块大小的音频和视频。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值