本文主要是介绍Android支持的音频格式,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
转载自:http://my.oschina.net/AlexZhuang/blog/56207 以及http://developer.android.com/guide/topics/media/mediaplayer.html
AAC: Advanced Audio Coding codec (as well as both profiles of HE-AAC, High Efficiency AAC), .m4a (audio/m4a) or.3gp (audio/3gpp) files. AAC is a popular standard that is used by the iPod and other portable media players. Android supports this audio format inside of MPEG-4 audio files and inside of 3GP files (which are based on the MPEG-4 format). Recent additions to the AAC specification, High Efficiency AAC are also supported.
AAC(Advanced Audio Coding),中文称为“高级音频编码”,出现于1997年,基于 MPEG-2的音频编码技术。
优点:相对于mp3,AAC格式的音质更佳,文件更小。
不足:AAC属于有损压缩的格式,与时下流行的APE、FLAC等无损格式相比音质存在“本质上”的差距。加之,目前传输速度更快的USB3.0和16G以上大容量MP3正在加速普及,也使得AAC头上“小巧”的光环不复存在了。
MP3是一种音频压缩技术,其全称是动态影像专家压缩标准音频层面3(Moving Picture Experts Group Audio Layer III),简称为MP3。它被设计用来大幅度地降低音频数据量。利用 MPEG Audio Layer 3 的技术,将音乐以1:10 甚至 1:12 的压缩率,压缩成容量较小的文件,而对于大多数用户来说重放的音质与最初的不压缩音频相比没有明显的下降。
根据MPEG规范的说法,MPEG-4中的AAC(Advanced audio coding)将是MP3格式的下一代。MP3还分为耳机MP3和外放MP3两大类,传统MP3需要带耳机才有很好的音质,但是对人们的耳膜有所伤害,新型的MP3主要方向是外放MP3,对耳膜几乎没有任何伤害,从而得到人们的喜爱。
Supported Media Formats
IN THIS DOCUMENT
- Network Protocols
- Core Media Formats
- Video Encoding Recommendations
SEE ALSO
- Multimedia and Camera
KEY CLASSES
MediaPlayer
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+)".
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) | |
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+) | |
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+) |
Video Encoding Recommendations
Table 2, below, lists examples of video encoding profiles and parameters that the Android media framework supports for playback in the H.264 Baseline Profile codec. While table 3 lists examples that the framework supports for playback in the VP8 media codec.
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.
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 |
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 |
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 anymdat
atoms, but must succeed theftyp
atom. - 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支持的音频格式的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!