4

Ι have an avi file that has different levels of audio. Is there a way to decrease and increase appropriately where needed the audio of my file using ffmpeg?

  • Compression is what is generally used to accomplish this kind of change in the dynamics of audio. I am not familiar enough with FFMPEG to know if it has a built in compressor though. – AJ Henderson Jun 10 '14 at 18:13
6

You can use ffmpeg with the compand audio filter (a port of sox effect filter of same name) to "compress or expand the audio's dynamic range", but admittedly this is one of the more complicated audio filters.

Example from the documentation

Make music with both quiet and loud passages suitable for listening to in a noisy environment (whatever that means):

ffmpeg -i input -filter_complex \
"[0:a]compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2[audio]" \
-map 0:v -map "[audio]" -codec:v copy output

The video is stream copied (re-muxed) in this example since you probably don't want to touch the video.

  • Maybe I'm dense but when I try your example command I get "Output with label 'audio' does not exist in any defined filter graph, or was already used elsewhere." I guess [audio] needs to be something else? We have an AVI in OP's question which is the only file we're working with. Do we substitute an audio format, a bitrate, something else as a variable? I can't make any sense of this, even after reading the documentation. Any chance you could post a full working example for the file EXAMPLE.avi please? – Tom Brossman Feb 17 '16 at 19:46
  • @TomBrossman Can you provide a link to a pastebin of your command and the complete console output? – llogan Feb 18 '16 at 2:30
  • Sure, here it is. – Tom Brossman Feb 18 '16 at 7:24
  • 1
    @TomBrossman Change -af to -filter_complex, or remove [audio] and the maps. Also see the dynaudnorm filter mentioned by Paul. I think it's newer than this answer. – llogan Feb 18 '16 at 18:28
2

FFmpeg have dynaudnorm filter, which increases audio volume where needed.

  • Can you give more specific info regarding using this in a video file? – lacostenycoder Aug 15 '16 at 20:54
  • 1
    ffmpeg -i input.file -c:v copy -af dynaudnorm output.file – Paul B. Mahol Aug 17 '16 at 10:35
1

You can use FFmpeg to adjust the levels in your video files. There is an answer on SU that explains how to do that: https://superuser.com/questions/323119/how-can-i-normalize-audio-using-ffmpeg

  • I sounds as if the OP has sections with different levels, in which case normalizing won't help since the relative volume of the sections won't change. A compressor would be the automated way to do it, but usually there's no good substitute for manual intervention. – Jim Mack Jun 10 '14 at 18:59
  • True, I just skipped through the SU answer. It's indeed just about changing the volume. – PTS Jun 10 '14 at 19:33
1

As AJ suggests, there may be ffmpeg commands to compress, but I suspect that in any case you'll need to separate the audio and video (demux), operate on the audio, and remux or re-encode. Ffmpeg, AviMux, and other tools can demux and remux most AVIs.

If there are defined sections with different levels, you can manually intervene using something like (free) Audacity to raise the levels of the quiet sections to match the louder ones. A final normalizing step, or even slight compression, could also help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.