Take the 2-minute tour ×
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.

Ι 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 at 18:13

3 Answers 3

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 -af \
"[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 at 13:37

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 at 18:59
    
True, I just skipped through the SU answer. It's indeed just about changing the volume. –  Professor Sparkles Jun 10 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

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.