sox处理mp3_音频处理常用Linux命令总结(一)

803c93edd808c9affd4c02d2e5c4b9e0.png

今天总结一下常用的linux音频处理工具

soX - Sound eXchange

soxi

soxi 常用选项soxi:      SoX vUsage: soxi [-V[level]] [-T] [-t|-r|-c|-s|-d|-D|-b|-B|-p|-e|-a] infile1 ...-V[n]  Increment or set verbosity level (default is 2)-T  With -s, -d or -D, display the total across all given files-t  Show detected file-type-r  Show sample-rate-c  Show number of channels-s  Show number of samples (0 if unavailable)-d  Show duration in hours, minutes and seconds (0 if unavailable)-D  Show duration in seconds (0 if unavailable)-b  Show number of bits per sample (0 if not applicable)-B  Show the bitrate averaged over the whole file (0 if unavailable)-p  Show estimated sample precision in bits-e  Show the name of the audio encoding-a  Show file comments (annotations) if availableWith no options, as much information as is available is shown foreach given file.

查看音频信息

用法格式:soxi file.wav例:soxi D8_999.wavInput File     : 'D8_999.wav' # 文件名Channels       : 1            # 通道数:常用有单声道,双声道等Sample Rate    : 16000        # 采样率:常用有8000Hz,16000Hz等Precision      : 16-bit       # 采样位深:常用的有 8-bit, 16-bitDuration       : 00:00:08.06 = 129000 samples ~ 604.688 CDDA sectorsFile Size      : 258kBit Rate       : 256kSample Encoding: 16-bit Signed Integer PCM

播放音频

用法格式:播放一遍  play file.wav播放n遍   play file.wav repeat n例子:play D8_999.wavD8_999.wav: File Size: 258k      Bit Rate: 256k  Encoding: Signed PCM  Channels: 1 @ 16-bit  # 通道数以及采样位深Samplerate: 16000Hz     # 采样率Replaygain: off  Duration: 00:00:08.06In:100%  00:00:08.06 [00:00:00.00] Out:356k  [      |      ]        Clip:0Done.

修改音频采样率

用法格式:sox inout.wav -r samplerate output.wav例:sox D8_999_before.wav -r 8000 D8_999_after.wavsoxi -r D8_999_before.wav16000soxi -r D8_999_after.wav8000

将pcm文件转化为wav文件

用法格式:sox -t raw -c [channal] -e signed-integer -b [bits] -r [samplerate] [input.pcm] [output.wav]-t|--type FILETYPE       File type of audio-c|--channels CHANNELS   Number of channels of audio data; e.g. 2 = stereo-e|--encoding ENCODING   Set encoding (ENCODING may be one of signed-integer,                         unsigned-integer, floating-point, mu-law, a-law,                         ima-adpcm, ms-adpcm, gsm-full-rate)-b|--bits BITS           Encoded sample size in bits-r|--rate RATE           Sample rate of audio例:sox -t raw -c 1 -e signed-integer -b 16 -r 16000 D8_999.pcm D8_999.wav将D8_999.pcm文件转化为D8_999.wav通道数为1采样位深为16-bit采样率为16000Hz

ffmpeg - 音视频转换工具

视频中提取音频

用法格式:ffmpeg -i video.mp4 -ar 16000 -ac 1 audio.wav

截取一段音频

用法格式:ffmpeg -i input.mp3 -ss [start_time] -to [end_time] -c copy output.mp3[start_time]/[end_time]格式:00:00.00 or 00:00
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值