1. 程式人生 > >FFMPEG調節音訊的音量大小,混音

FFMPEG調節音訊的音量大小,混音

找了很久,國內網站沒有,最後還是用google到ffmpeg論壇,找到了。

http://ffmpeg.gusari.org/viewtopic.php?f=25&t=517

防止論壇倒閉,在這裡備份下:

This thread is OUTDATED
Later -af option has been implemented!

Now this command
ffmpeg -i input.wav -af volume=-3dB output.wav
is perfectly working

See ticket #725

這個就是volume減掉3db。

還有一種:

To increase the volume with ffmpeg

 use the commad: 

ffmpeg -i input.wav -af 'volume=2' output.wav

Replace volume=X with a suitable number. For example 0.5 will half, 2 will double the volume.


========================

To get volume level of the media file in command line I use:

ffmpeg -i audo.mp3 -af "volumedetect" -f null /dev/null

in the output I see something like this:

[Parsed_volumedetect_0 @ 0000000004087260] n_samples: 41316480
[Parsed_volumedetect_0 @ 0000000004087260] mean_volume: -22.5 dB
[Parsed_volumedetect_0 @ 0000000004087260] max_volume: -5.8 dB
[Parsed_volumedetect_0 @ 0000000004087260] histogram_5db: 3
[Parsed_volumedetect_0 @ 0000000004087260] histogram_6db: 892
[Parsed_volumedetect_0 @ 0000000004087260] histogram_7db: 8686
[Parsed_volumedetect_0 @ 0000000004087260] histogram_8db: 36098