其他分享
首页 > 其他分享> > 音视频基础知识

音视频基础知识

作者:互联网

常见的音频编码器

常见的音频编码器包括OPUS(速度快,压缩率大),AAC(最为广泛的),Ogg,Speex,iLBC,AMR,G.711其中,ACC在直播系统中应用的比较广泛,OPUS是较新的音频编解码,WebRTC模式使用OPUS,固话一般使用G.711(损耗很大)系列。评测结果:OPUS>AAC>Ogg。

音频编码质量比较

音频编码率比较

 ACC

AAC(Advanced Audio Coding)由许多知名公司开发,其目的是取代MP3格式,其最开始是基于MPEG-2的音频编码技术,MPEG-4标准出现以后,AAC重新集成了其特性,加入了SBR和PS技术。常见的规格有AAC LC、AAC HE V1和AAC HE V2。

AAC格式

ADTS的结构

ADTS由7/9个字节组成

12syncword OxFFF, all bits must be 1
1MPEG Version; 0 for MPEG- -4, 1 for MPEG -2
2Layer: always 0
1protection absent, Warning, set to 1 if there is no CRC and 0 if there is CRC
2profle, the MPEG- -4 Audio Object Type minus 1
4MPEG-4 Sampling Frequency Index (15 is forbidden)
1private bit, guaranteed never to be used by MPEG, set to 0 when encoding, ignore when decoding
3MPEG- .4 Channel Configuration (in the case of 0, the channel configuration is sent via an inband PCE)
1originality, set to O when encoding, ignore when decoding
1home, set to 0 when encoding, ignore when decoding
1copyrighted id bit, the next bit of a centrally registered copyright identifier, set to 0 when encoding, ignore when decoding
1copyright id start, signals that this frame's copyright id bit is the first bit of the copyright id, set to 0 when encoding, ignore when decoding
13frame length, this value must include 7 or 9 bytes of header length: FrameLength = (ProtectionAbsent == 1? 7: 9) + size(AACFrame)
11Buffer fullness
2Number of AAC frames (RDBs) in ADTS frame minus 1, for maximum compatibility always use 1 AAC frame per ADTS frame
16CRC if protection absent is 0

Audio Object Types

Sampling Frequency Index

使用在线网站查看AAC Header

FF F1 51 80 2E 7F FC 21

Bits1111111111110001010111001000000000101110011111111111110000100001
IDMPEG-4
MPEG Layer0
CRC checksum absent1
ProfileLow Complexity profile (AAC LC)
Sampling frequency22050
Private bit0
Channel configuration2
Original/copy0
Home0
Copyright identification bit0
Copyright identification start0
AAC frame length371
ADTS buffer fullnessVBR
No raw data blocks in frame0

FFmpeg生成AAC文件

ffmpeg -i input.mp4 -vn -c:a libdfk_aac -ar 44100 -channels 2 -profile:a aac_he_v2 target.aac

音频重采样

将音频三元组(采样率、采样大小和通道数)的值转换成另外一组值。其中任何一个值发生了变换都称为重采样,例如将44100/16/2  ---> 48000/16/2。

为什么需要重采样

ffmpeg重采样的步骤

    api:

标签:采样,set,AAC,音频,when,基础知识,MPEG,音视频
来源: https://blog.csdn.net/wenfan0934/article/details/118435987