查看音量
准备原生音频original.mp3
查看original.mp3的音量信息:
bash
ffmpeg -i original.mp3 -filter_complex volumedetect -c:v copy -f null /dev/null
输出:
bash
Input #0, mp3, from 'original.mp3':
Metadata:
artist : Administrator
encoder : Studio One 6.0.1.90430
TBPM : 120
date : 2023
Duration: 00:00:26.41, start: 0.025057, bitrate: 320 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
Metadata:
encoder : LAME3.100
[Parsed_volumedetect_0 @ 0x55d0ba56dac0] n_samples: 0
Stream mapping:
Stream #0:0 (mp3float) -> volumedetect:default
volumedetect:default -> Stream #0:0 (pcm_s16le)
Press [q] to stop, [?] for help
Output #0, null, to '/dev/null':
Metadata:
artist : Administrator
date : 2023
TBPM : 120
encoder : Lavf60.3.100
Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Metadata:
encoder : Lavc60.3.100 pcm_s16le
size=N/A time=00:00:26.35 bitrate=N/A speed= 684x A
video:0kB audio:4544kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Parsed_volumedetect_0 @ 0x55d0ba59c280] n_samples: 2326514
[Parsed_volumedetect_0 @ 0x55d0ba59c280] mean_volume: -35.5 dB
[Parsed_volumedetect_0 @ 0x55d0ba59c280] max_volume: -13.8 dB
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_13db: 8
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_14db: 99
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_15db: 189
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_16db: 191
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_17db: 273
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_18db: 596
[Parsed_volumedetect_0 @ 0x55d0ba59c280] histogram_19db: 1003
音量平均值:mean_volume: -35.5 dB
音量最大值:max_volume: -13.8 dB
提高音量
bash
ffmpeg -i original.mp3 -af "volume=3.0,highpass=f=200,lowpass=f=3000,afftdn=nr=50" original.volume=3.0,highpass=f=200,lowpass=f=3000,afftdn=nr=50.wav
参数简单说明下:
volume:提供响度,3.0表示提高为原来的3倍;
hightpass:高通滤波器;
lowpass:低通滤波器;
afftdn:使用FFT对音频样本进行降噪
输出:
bash
Input #0, mp3, from 'original.mp3':
Metadata:
artist : Administrator
encoder : Studio One 6.0.1.90430
TBPM : 120
date : 2023
Duration: 00:00:26.41, start: 0.025057, bitrate: 320 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
Metadata:
encoder : LAME3.100
Stream mapping:
Stream #0:0 -> #0:0 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'original.volume=3.0,highpass=f=200,lowpass=f=3000,afftdn=nr=50.wav':
Metadata:
IART : Administrator
ICRD : 2023
TBPM : 120
ISFT : Lavf60.3.100
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Metadata:
encoder : Lavc60.3.100 pcm_s16le
size= 4544kB time=00:00:26.37 bitrate=1411.4kbits/s speed= 165x
video:0kB audio:4544kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.002450%
在提高音量后,再看看音量信息:
bash
ffmpeg -i original.volume\=3.0\,highpass\=f\=200\,lowpass\=f\=3000\,afftdn\=nr\=50.wav -filter_complex volumedetect -c:v copy -f null /dev/null
输出:
bash
Input #0, wav, from 'original.volume=3.0,highpass=f=200,lowpass=f=3000,afftdn=nr=50.wav':
Metadata:
artist : Administrator
date : 2023
encoder : Lavf60.3.100
Duration: 00:00:26.38, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
[Parsed_volumedetect_0 @ 0x55819c4a4200] n_samples: 0
Stream mapping:
Stream #0:0 (pcm_s16le) -> volumedetect:default
volumedetect:default -> Stream #0:0 (pcm_s16le)
Press [q] to stop, [?] for help
Output #0, null, to '/dev/null':
Metadata:
artist : Administrator
date : 2023
encoder : Lavf60.3.100
Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Metadata:
encoder : Lavc60.3.100 pcm_s16le
size=N/A time=00:00:26.35 bitrate=N/A speed=1.88e+03x
video:0kB audio:4544kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Parsed_volumedetect_0 @ 0x55819c4c35c0] n_samples: 2326514
[Parsed_volumedetect_0 @ 0x55819c4c35c0] mean_volume: -33.3 dB
[Parsed_volumedetect_0 @ 0x55819c4c35c0] max_volume: -7.7 dB
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_7db: 6
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_8db: 18
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_9db: 63
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_10db: 78
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_11db: 123
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_12db: 236
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_13db: 324
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_14db: 474
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_15db: 732
[Parsed_volumedetect_0 @ 0x55819c4c35c0] histogram_16db: 1144
音量平均值:mean_volume: -33.3 dB
音量最大值:max_volume: -7.7 dB