wav文件分析

参考文档:https://blog.csdn.net/glw0223/article/details/88063489

分析文件1905_mono_2s.wav,文件下载地址

ffprobe分析

gaoliwendeMacBook-Pro:testfile gaoliwen$ ffprobe 1905_mono_2s.wav
ffprobe version 4.1 Copyright (c) 2007-2018 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, wav, from '1905_mono_2s.wav':
  Metadata:
    encoder         : Lavf58.20.100
  Duration: 00:00:02.05, bitrate: 256 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, 1 channels, s16, 256 kb/s

ls查看大小

gaoliwendeMacBook-Pro:testfile gaoliwen$ ls -lat 1905_mono_2s.wav
-rw-r--r--@ 1 gaoliwen  staff  65614 Mar  1 17:23 1905_mono_2s.wav

共65614字节。

hex help工具查看

文件头

中间忽略

文件尾

0x00 至  0x1004d  转成十进制是65614字节

具体(字段)分析

字节偏移字节描述
0-3bytes52 49 46 46ChunkID,RIFF
4-7bytes46 00 01 00ChunkSize,长度,0x 01 00 46 表示后面的字节长度(不包括本身),也就是0x010046 加上8个字节就是文件大小
8-11bytes57 41 56 45Format,WAVE(前12字节是The RIFF Header Chunkhttps://tools.ietf.org/html/draft-ema-vpim-wav-00#section-2.2.1
12-15bytes66 6d 74 20

Subchunk1ID,fmt,FourCC格式,最后一个自己补充

16-19bytes10 00 00 00

Subchunk1Size,格式块长度,0x 10,即16个字节长度。就是后面的01 00 01 00 80 3e 00 00 00 7d 00 00 02 00 10 00

20-21bytes01 00AudioFormat,0x01,即PCM 脉冲编码调制格式
22-23bytes01 00

NumChannels,0x01,即单声道。(单声道为 1,立体声或双声道为 2)

24-27bytes80 3e 00 00

SampleRate,0x 3e 80转成十进制是16000,就是16k采样率

28-31bytes00 7d 00 00

ByteRate,0x 7d 00是32000,即1声道x16k采样率x16位采样/8 = (该数值为:声道数×采样频率×每样本的数据位数/8),和ffprobe分析的256kbps是相同的

32-33bytes02 00

BlockAlign,采样帧大小。该数值为:声道数×位数/8。即每个采样2个字节

34-35bytes10 00BitsPerSample:0x 00 10,即16位采样(12-35字节,共24字节,是The Format Chunkhttps://tools.ietf.org/html/draft-ema-vpim-wav-00#section-2.2.2
36-39bytes4c 49 53 54

LIST

40-43bytes1a 00 00 00

size,即0x 1a,从下一个字节开始26个字节

44-69bytes共26个字节
70-73bytes64 61 74 61

data,

https://tools.ietf.org/html/draft-ema-vpim-wav-00#section-2.2.3

74-77bytes00 00 01 00

数据长度0x 01 00 00,即65536字节的音频裸数据,

78-65613bytes共65536个字节PCM数据

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值