Android支持的音频格式

2024-04-17 02:08
文章标签 android 支持 音频格式

本文主要是介绍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头上“小巧”的光环不复存在了。

前景:以发展的眼光来看,正如“高清”正在被越来越多的人所接受一样,“无损”必定是未来音乐格式的绝对主流。AAC这种“有损”格式的前景不容乐观。


MP3: MPEG-1 Audio Layer 3, .mp3 (audio/mp3) files. MP3, probably the most widely used audio codec, is supported. This allows Android to utilize the vast majority of audio available online through various web sites and music stores. 

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,对耳膜几乎没有任何伤害,从而得到人们的喜爱。


AMR: Adaptive Multi-Rate codec (both AMR Narrowband, AMR-NB, and AMR Wideband, AMR-WB),  .3gp (audio/3gpp) or .amr (audio/amr) files. AMR is the audio codec that has been standardized as the primary voice audio codec in use by the 3GPP (3rd Generation Partnership Project). The 3GPP is a telecommunications industry organization that creates specifications for the partner companies to use. In other words, the AMR codec is what is primarily used for voice 
calling applications on modern mobile phones and generally supported across mobile handset manufacturers and carriers. As such, this codec is generally useful for voice encoding but doesn’t perform well for more complex types of audio such as music. 
全称Adaptive Multi-Rate和Adaptive Multi-Rate Wideband,主要用于  移动设备的音频,压缩比比较大,但相对其他的  压缩格式质量比较差,由于多用于人声,通话,效果还是很不错的。

Ogg : Ogg Vorbis, .ogg (application/ogg) files. Ogg Vorbis is an open source, patent-free audio codec with quality that is comparable to commercial and patent-encumbered codecs such as MP3 and AAC. It was developed by volunteers and is currently maintained by the Xiph.Org foundation. 
Ogg全称应该是OGGVobis(oggVorbis)是一种新的  音频压缩格式,类似于MP3等的音乐格式。Ogg是完全免费、开放和没有专利限制的。OggVorbis文件的扩展名是.OGG。Ogg  文件格式可以不断地进行大小和  音质的改良,而不影响旧有的编码器或  播放器。

PCM: Pulse Code Modulation commonly used in WAVE or WAV files (Waveform Audio Format), .wav (audio/x-wav) files. PCM is the technique used for storing audio on computers and other digital audio devices. It is generally an uncompressed audio file with data that represents the amplitude of a piece of audio over time. The “sample rate” is how often an amplitude reading is stored. The “bit-depth” is how many bits are used to represent an individual sample. A piece of audio data with a sample rate of 16kHz and a bit-depth of 32 bits means that it will contain 32 bits of data representing the amplitude of the audio and it will have 16,000 of these per second. The higher the sample rate and the higher the bit-depth, the more accurate the digitization of the audio is. Sample rate and bit-depth also determine how large the audio file will be when its length is taken into account. Android supports PCM audio data within WAV files. WAV is a long-standing standard audio format on PCs. 
脉冲编码调制(PulseCodeModulation),简称PCM。是数字信号是对连续变化的模拟信号进行抽样、量化和编码产生。PCM的优点就是音质好,缺点就是体积大。PCM可以提供用户从2M到155M速率的数字数据专线业务,也可以提供话音、图象传送、远程教学等其他业务。PCM有两个标准(表现形式):E1和T1。 

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.

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 CamcorderProfileclass, which is available since API level 8.

Table 2. Examples of supported video encoding parameters for the H.264 Baseline Profile codec.

  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

Table 3. Examples of supported video encoding parameters for the VP8 codec.

  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 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支持的音频格式的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/910515

相关文章

Android实现任意版本设置默认的锁屏壁纸和桌面壁纸(两张壁纸可不一致)

客户有些需求需要设置默认壁纸和锁屏壁纸  在默认情况下 这两个壁纸是相同的  如果需要默认的锁屏壁纸和桌面壁纸不一样 需要额外修改 Android13实现 替换默认桌面壁纸: 将图片文件替换frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.*  (注意不能是bmp格式) 替换默认锁屏壁纸: 将图片资源放入vendo

Android平台播放RTSP流的几种方案探究(VLC VS ExoPlayer VS SmartPlayer)

技术背景 好多开发者需要遴选Android平台RTSP直播播放器的时候,不知道如何选的好,本文针对常用的方案,做个大概的说明: 1. 使用VLC for Android VLC Media Player(VLC多媒体播放器),最初命名为VideoLAN客户端,是VideoLAN品牌产品,是VideoLAN计划的多媒体播放器。它支持众多音频与视频解码器及文件格式,并支持DVD影音光盘,VCD影

android-opencv-jni

//------------------start opencv--------------------@Override public void onResume(){ super.onResume(); //通过OpenCV引擎服务加载并初始化OpenCV类库,所谓OpenCV引擎服务即是 //OpenCV_2.4.3.2_Manager_2.4_*.apk程序包,存

从状态管理到性能优化:全面解析 Android Compose

文章目录 引言一、Android Compose基本概念1.1 什么是Android Compose?1.2 Compose的优势1.3 如何在项目中使用Compose 二、Compose中的状态管理2.1 状态管理的重要性2.2 Compose中的状态和数据流2.3 使用State和MutableState处理状态2.4 通过ViewModel进行状态管理 三、Compose中的列表和滚动

Android 10.0 mtk平板camera2横屏预览旋转90度横屏拍照图片旋转90度功能实现

1.前言 在10.0的系统rom定制化开发中,在进行一些平板等默认横屏的设备开发的过程中,需要在进入camera2的 时候,默认预览图像也是需要横屏显示的,在上一篇已经实现了横屏预览功能,然后发现横屏预览后,拍照保存的图片 依然是竖屏的,所以说同样需要将图片也保存为横屏图标了,所以就需要看下mtk的camera2的相关横屏保存图片功能, 如何实现实现横屏保存图片功能 如图所示: 2.mtk

android应用中res目录说明

Android应用的res目录是一个特殊的项目,该项目里存放了Android应用所用的全部资源,包括图片、字符串、颜色、尺寸、样式等,类似于web开发中的public目录,js、css、image、style。。。。 Android按照约定,将不同的资源放在不同的文件夹中,这样可以方便的让AAPT(即Android Asset Packaging Tool , 在SDK的build-tools目

Android fill_parent、match_parent、wrap_content三者的作用及区别

这三个属性都是用来适应视图的水平或者垂直大小,以视图的内容或尺寸为基础的布局,比精确的指定视图的范围更加方便。 1、fill_parent 设置一个视图的布局为fill_parent将强制性的使视图扩展至它父元素的大小 2、match_parent 和fill_parent一样,从字面上的意思match_parent更贴切一些,于是从2.2开始,两个属性都可以使用,但2.3版本以后的建议使

Android Environment 获取的路径问题

1. 以获取 /System 路径为例 /*** Return root of the "system" partition holding the core Android OS.* Always present and mounted read-only.*/public static @NonNull File getRootDirectory() {return DIR_ANDR

Android逆向(反调,脱壳,过ssl证书脚本)

文章目录 总结 基础Android基础工具 定位关键代码页面activity定位数据包参数定位堆栈追踪 编写反调脱壳好用的脚本过ssl证书校验抓包反调的脚本打印堆栈bilibili反调的脚本 总结 暑假做了两个月的Android逆向,记录一下自己学到的东西。对于app渗透有了一些思路。 这两个月主要做的是代码分析,对于分析完后的持久化等没有学习。主要是如何反编译源码,如何找到

android系统源码12 修改默认桌面壁纸--SRO方式

1、aosp12修改默认桌面壁纸 代码路径 :frameworks\base\core\res\res\drawable-nodpi 替换成自己的图片即可,不过需要覆盖所有目录下的图片。 由于是静态修改,则需要make一下,重新编译。 2、方法二Overlay方式 由于上述方法有很大缺点,修改多了之后容易遗忘自己修改哪些文件,为此我们采用另外一种方法,使用Overlay方式。