问题描述
是否可以在不降低采样率的情况下压缩wav音频文件?
Is it possible to compress a wav audio file without reducing the sampling rate?
我有一个具有256位速率和8000Hz采样率的音频文件。我只想将比特率降低到128/64 kbs
I have an audio file with 256 bit rate and sampling rate - 8000Hz. I would just like to reduce the bit rate to 128/64 kbs
我尝试转换为mp3并返回到wav,
ffmpeg -i input.wav 1 .mp3
ffmpeg -i 1.mp3 -acodec pcm_s16le -ar 4000 out.wav
,但这也会降低采样率。
ffmpeg -i 1.mp3 -acodec pcm_s16le -ab 128 out.wav具有默认的256位速率
I tried converting to mp3 and back to wav, ffmpeg -i input.wav 1.mp3 ffmpeg -i "1.mp3" -acodec pcm_s16le -ar 4000 out.wavbut this reduced sampling rate as well. ffmpeg -i "1.mp3" -acodec pcm_s16le -ab 128 out.wav has default 256 bit rate
推荐答案
PCM( WAV)未压缩,因此 -b:a
/ -ab
被忽略。
计算PCM比特率
假设立体声输入,每秒8000个采样,每个采样16位:
PCM ("WAV") is uncompressed, so -b:a
/-ab
is ignored.
Calculating PCM bitrate
Assuming a stereo input, 8000 samples per second, 16 bits per sample:
sample rate × number of channels × bits per sample = bitrate
8000 × 2 × 16 = 256000 bits/s, or 256 kb/s
确定通道,采样率,位深度
您可以只查看 ffmpeg -i input.wav
的输出,也可以使用 ffprobe
以获得更简洁的输出:
Determine channels, sample rate, bit depth
You can just view the output of ffmpeg -i input.wav
or use ffprobe
for a more concise output:
$ ffprobe -loglevel error -select_streams a -show_entries stream=sample_rate,channels,bits_per_sample -of default=nw=1 input.wav
sample_rate=8000
channels=2
bits_per_sample=16
降低比特率
您可以减少通道数量,更改采样率和/或更改位深度,但是另一种选择是使用无损压缩格式,例如FLAC:
Reducing bitrate
You can reduce the number of channels, change the sample rate, and/or change the bit depth, but another option is to use a lossless compressed format such as FLAC:
$ ffmpeg -i audio.wav audio.flac
$ ls -alh audio.wav audio.flac
6.1M audio.flac
11M audio.wac
这篇关于WAV音频文件压缩不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!