Android支持的媒体格式

来源:互联网 发布:网络小祖宗是什么意思 编辑:程序博客网 时间:2024/04/28 19:50

Android Supported Media Formats

IN THIS DOCUMENT

  1. Network Protocols
  2. Core Media Formats
  3. Video Encoding Recommendations

SEE ALSO

  1. Multimedia and Camera

KEY CLASSES

  1. MediaPlayer
  2. MediaRecorder

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 streaming draft 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.

TypeFormat / CodecEncoderDecoderDetailsSupported File Type(s) / Container FormatsAudioAAC LC/LTPMono/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-NB4.75 to 12.2 kbps sampled @ 8kHz3GPP (.3gp)AMR-WB9 rates from 6.60 kbit/s to 23.85 kbit/s sampled @ 16kHz3GPP (.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) onlyMP3 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)ImageJPEGBase+progressiveJPEG (.jpg)GIF  GIF (.gif)PNG PNG (.png)BMP  BMP (.bmp)WEBP
(Android 4.0+)
(Android 4.0+) WebP (.webp)VideoH.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 above• WebM(.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 available video recording profiles can be used as a proxy for media playback capabilities. These profiles can be inspected using the CamcorderProfile class, 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 codecH.264 Baseline ProfileH.264 Baseline ProfileH.264 Baseline ProfileVideo resolution176 x 144 px480 x 360 px1280 x 720 pxVideo frame rate12 fps30 fps30 fpsVideo bitrate56 Kbps500 Kbps2 MbpsAudio codecAAC-LCAAC-LCAAC-LCAudio channels1 (mono)2 (stereo)2 (stereo)Audio bitrate24 Kbps128 Kbps192 Kbps

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

  • For 3GPP and MPEG-4 containers, the moov atom must precede any mdat atoms, but must succeed the ftypatom.
  • 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支持的媒体格式

在这份文件中

  1. 网络协议
  2. 核心媒体格式
  3. 视频编码建议

参见

  1. 多媒体和相机

重点班

  1. MediaPlayer的
  2. MediaRecorder

本文档介绍了媒体编解码器,容器,和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的。为了减少这种音频/视频的漂移,考虑交错较小的块大小的音频和视频。


原创粉丝点击