Android 播放视频(三)媒体支持格式

来源:互联网 发布:黑暗之魂3淘宝被禁止 编辑:程序博客网 时间:2024/04/29 21:51
#Android 播放视频(三)媒体支持格式这篇文档介绍Android平台媒体编解码器、容器和网络协议的支持。作为一个应用开发者,你可以任意使用Android设备上的媒体编解码器,包括Android平台提供的以及一些特定的设备。**然而最好的方式是使用与设备无关的解码器。**##网络协议以下的协议都支持音频、视频播放。 - RTSP(RTP, SDP) - HTTP/HTTPS progressive streaming - HTTP/HTTPS live streaming [draft protocol](https://tools.ietf.org/html/draft-pantos-http-live-streaming-18); - MPEG-2 TS media files only - 协议版本 3 (Android 4.0或者更高) - 协议版本2(Android 3.x) - 不支持Android3.0以下版本> 注意:Android3.1之前版本不支持HTTPS。##核心媒体格式下表描述了构建在Android平台内所支持的媒体格式,请注意一些移动设备会支持列表之外的格式、文件类型。> 注意:媒体编解码器并不保证在所有的Android版本上都有效,以此要注意(Android 3.0+) 表1. 核心媒体格式和编解码支持。
Type Format / Codec Encoder Decoder Details Supported File Type(s) / Container Formats Audio AAC LC Support for mono/stereo/5.0/5.1 content with standard sampling rates from 8 to 48 kHz. • 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+)
(Android 4.1+) HE-AACv2 (enhanced AAC+)   Support for stereo/5.0/5.1 content with standard sampling rates from 8 to 48 kHz. AAC ELD (enhanced low delay AAC)
(Android 4.1+)
(Android 4.1+) Support for mono/stereo content with standard sampling rates from 16 to 48 kHz 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
(Android 4.1+) 8- and 16-bit linear PCM (rates up to limit of hardware). Sampling rates for raw PCM recordings at 8000, 16000 and 44100 Hz. WAVE (.wav) Opus  
(Android 5.0+)   Matroska (.mkv) Image JPEG Base+progressive JPEG (.jpg) GIF     GIF (.gif) PNG   PNG (.png) BMP     BMP (.bmp) WebP
(Android 4.0+)
(Lossless, Transparency, Android 4.2.1+)
(Android 4.0+)
(Lossless, Transparency, Android 4.2.1+)   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+) H.265 HEVC  
(Android 5.0+) Main Profile Level 3 for mobile devices and Main Profile Level 4.1 for Android TV • MPEG-4 (.mp4)
MPEG-4 SP     3GPP (.3gp) VP8
(Android 4.3+)
(Android 2.3.3+) Streamable only in Android 4.0 and above • WebM (.webm)
• Matroska (.mkv, Android 4.0+) VP9  
(Android 4.4+)   • WebM (.webm)
• Matroska (.mkv, Android 4.0+)

视频编码推荐

表2,如下列表中的例子是Android媒体框架支持的配置和参数,支持的H.264 Baseline Profile解码器播方。列表三是框架支持VP8的媒体编解码。
除了推荐的这些编码参数,设备上的有效视频录制参数可以作为一个媒体播放的代理使用,这些参数可以内签到正在使用的类CamcorderProfile中,该类since API leve 8.
表2.支持视频编码H.264Baseline参数

/ SD (Low quality) SD (High quality) HD 720p (N/A on all devices) 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

表3.支持视频VP8编码参数

\ SD (Low quality) SD (High quality) HD 720p (N/A on all devices) HD 1080p (N/A on all devices) Video resolution 320 x 180 px 640 x 360 px 1280 x 720 px 1920 x 1080 px Video frame rate 30 fps 30 fps 30 fps 30 fps Video bitrate 800 Kbps 2 Mbps 4 Mbps 10 Mbps

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

  • 对于3GPP和MPEG-4容器中,MOOV原子必须先于任何MDAT原子,但一定要成功的ftyp原子。
  • 对于3GPP,MPEG4和WebM容器,对应于相同时间偏移的音频和视频样本可以不大于500 KB相隔。为了减少这种音频/视频漂移,考虑更小的块大小交错的音频和视频。

出处:http://developer.android.com/guide/appendix/media-formats.html

0 0
原创粉丝点击