Video Production Stack Exchange is a question and answer site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ι 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?

share|improve this question
    
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

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.

share|improve this answer
    
Thanks! I may try it. – zinon Jun 12 '14 at 13:37
    
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 at 19:46
    
@TomBrossman Can you provide a link to a pastebin of your command and the complete console output? – LordNeckbeard Feb 18 at 2:30
    
Sure, here it is. – Tom Brossman Feb 18 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. – LordNeckbeard Feb 18 at 18:28

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

share|improve this answer
    
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. – Professor Sparkles Jun 10 '14 at 19:33

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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