amr格式解析

AMR File Format:

AMR( AdaptiveMultiRate ) is an audio format which is extensively used in mobile devices in various applications ranging from normal audio player/recorder to VoIP kind of applications. AMR can be further categorized as

1) AMR-NB( NarrowBand )

2) AMR-WB( WideBand )

But in general terms, AMR refers to AMR-NB. The AMR file format (*.amr) has the following structure:

Each AMR file consists of a 6-byte header that identifies the file as AMR audio. This header is always set to: 0x23, 0x21, 0x41, 0x4D, 0x52, 0x0A. This is common across all AMR-NB files. If the header is not as it should be, the file is probably corrupted and should not be used.

From here( ie. from the 7th byte ) the AMR file consists of a whole number of packed frames of audio (into bandwidth inefficient, octet-aligned mode ). These frames each constitute 20ms of audio. Each frame can be encoded using any of the valid AMR-NB modes (0-7, 8 SID in DTX mode). Because the frames can be encoded at different rates, this method of encoding is called Adaptive Multi-Rate(AMR).

Each frame can be encoded using one of 8 varying levels of compression using various bitrates(AMR modes 0-7). Following are the various AMR modes and their corresponding bitrates:

MODE               BIT RATES
0           - AMR 4.75 - Encodes at 4.75kbit/s
1           - AMR 5.15 - Encodes at 5.15kbit/s
2           - AMR 5.9  - Encodes at 5.9kbit/s
3           - AMR 6.7  - Encodes at 6.7kbit/s
4           - AMR 7.4  - Encodes at 7.4kbit/s
5           - AMR 7.95 - Encodes at 7.95kbit/s
6           - AMR 10.2 - Encodes at 10.2kbit/s
7           - AMR 12.2 - Encodes at 12.2kbit/s

Each frame consists of a 1-byte header, then the rest of the frame is audio data. The entire frame is fed into the AMR decoder (header too). The frame size can be deduced from the frame header.

The 2nd bit through 5th bit (counting the most significant bit as the first bit) comprise the CMR (Codec Mode Request), values 0-7 being valid for AMR. The top bit of the CMR can actually be ignored, though it is used when AMR forms RTP payloads. The lower 3-bits of the header are reserved and are not used. Viewing the header from most significant bit to least significant bit, the encoding is XCCCCXXX, where Xs are reserved (typically 0) and the Cs are the CMR.

Frame size of AMR modes in bytes (including the header byte) are shown below:

CMR      MODE        FRAME SIZE( in bytes )
0 AMR 4.75 13
1 AMR 5.15 14
2 AMR 5.9 16
3 AMR 6.7 18
4 AMR 7.4 20
5 AMR 7.95 21
6 AMR 10.2 27
7 AMR 12.2 32

目录
1.    概述
2.    AMR编码方式
3.    AMR文件结构示范图
4.    AMR帧头格式分析
5.    异常帧分析
6.    AMR帧读取算法
7.    参考资料

1.      概述

现在很多智能手机都支持多媒体功能,特别是音频和视频播放功能,而AMR文件格式是手机端普遍支持的音频文件格式。

 

AMR,全称是:Adaptive Multi-Rate,自适应多速率,是一种音频编码文件格式,专用于有效地压缩语音频率。

 

AMR音频主要用于移动设备的音频压缩,压缩比非常高,但是音质比较差,主要用于语音类的音频压缩,不适合对音质要求较高的音乐类音频的压缩。

 

下面是两个AMR示范文件,一个是新闻类,一个是歌曲,可以听出来,音乐类压缩成AMR格式后,音质大大降低。

编号

文件名

文件长度

时长

1

h.amr              (歌曲)

409KB

04:21

2

zbc1217.amr<

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值