FFMPEG调整音频文件音量大小
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了FFMPEG调整音频文件音量大小相关的知识,希望对你有一定的参考价值。
参考技术A 来自 < https://trac.ffmpeg.org/wiki/AudioVolume >Changing volume
To change the audio volume, you may use FFmpeg's volume audio filter.
If we want our volume to be half of the input volume:
ffmpeg -i input.wav -filter:a "volume=0.5" output.wav
150% of current volume:
ffmpeg -i input.wav -filter:a "volume=1.5" output.wav
You can also use decibel measures. To increase the volume by 10dB:
ffmpeg -i input.wav -filter:a "volume=10dB" output.wav
To reduce the volume, use a negative value:
ffmpeg -i input.wav -filter:a "volume=-5dB" output.wav
Note that the volume filter only adjusts the volume. It does not set the volume. To set or otherwise normalize the volume of a stream, see the sections below.
Peak and RMS Normalization
To normalize the volume to a given peak or RMS level, the file first has to be analyzed using the volumedetect filter:
ffmpeg -i input.wav -filter:a volumedetect -f null /dev/null
Read the output values from the command line log:
[Parsed_volumedetect_0 @ 0x7f8ba1c121a0] mean_volume: -16.0 dB
[Parsed_volumedetect_0 @ 0x7f8ba1c121a0] max_volume: -5.0 dB
...
... then calculate the required offset, and use the volume filter as shown above.
Loudness Normalization
If you want to normalize the (perceived) loudness of the file, use the loudnorm filter, which implements the EBU R128 algorithm:
ffmpeg -i input.wav -filter:a loudnorm output.wav
This is recommended for most applications, as it will lead to a more uniform loudness level compared to simple peak-based normalization. However, it is recommended to run the normalization with two passes, extracting the measured values from the first run, then using the values in a second run with linear normalization enabled. See the loudnorm filter documentation for more.
Automatization with ffmpeg-normalize
To automate the normalization processes with ffmpeg without having to manually perform two passes, and run normalization on multiple files (including video), you can also use the ffmpeg-normalize Python program via pip install ffmpeg-normalize.
The script defaults to EBU R128 normalization with two passes, but peak and RMS normalization are also supported.
For details, run ffmpeg-normalize -h or see the README file.
来自 < https://trac.ffmpeg.org/wiki/AudioVolume >
FFmpeg:如何在音频文件中间降低几秒钟的音量? [复制]
【中文标题】FFmpeg:如何在音频文件中间降低几秒钟的音量? [复制]【英文标题】:FFmpeg: How to decrease the volume for few seconds in the middle of audio file? [duplicate] 【发布时间】:2018-04-27 10:15:21 【问题描述】:我有一个持续时间为 120 秒的音频文件。我想使用 FFmpeg 将音量从第 80 秒静音到第 100 秒。
提前致谢。
【问题讨论】:
【参考方案1】:使用
ffmpeg -i in.mp3 -af volume=0:enable='between(t,80,100)' out.mp3
【讨论】:
以上是关于FFMPEG调整音频文件音量大小的主要内容,如果未能解决你的问题,请参考以下文章