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

user3295: 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

user3908: 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.

user-1: FFmpeg have dynaudnorm filter, which increases audio volume where needed.

user1760: 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.

6047: <p>Ι 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?</p>
 3295: <p>You can use FFmpeg to adjust the levels in your video files.
There is an answer on SU that explains how to do that: <a href="https://superuser.com/questions/323119/how-can-i-normalize-audio-using-ffmpeg">https://superuser.com/questions/323119/how-can-i-normalize-audio-using-ffmpeg</a></p>
 3908: <p>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.</p>

<p>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.</p>
 -1: <p>FFmpeg have dynaudnorm filter, which increases audio volume where needed.</p>
 1760: <p>You can use <code>ffmpeg</code> with the <a href="http://ffmpeg.org/ffmpeg-filters.html#compand" rel="nofollow noreferrer">compand audio filter</a> (a port of <code>sox</code> effect filter of same name) to &quot;compress or expand the audio's dynamic range&quot;, but admittedly this is one of the more complicated audio filters.</p>
<h3>Example from the <a href="http://ffmpeg.org/ffmpeg-filters.html#compand" rel="nofollow noreferrer">documentation</a></h3>
<p>Make music with both quiet and loud passages suitable for listening to in a noisy environment (whatever that means):</p>
<pre><code>ffmpeg -i input -filter_complex \
&quot;[0:a]compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2[audio]&quot; \
-map 0:v -map &quot;[audio]&quot; -codec:v copy output
</code></pre>
<p>The video is <a href="http://ffmpeg.org/ffmpeg.html#Stream-copy" rel="nofollow noreferrer">stream copied</a> (re-muxed) in this example since you probably don't want to touch the video.</p>
