Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-17T19:46:59.500Z
Answers.Text: 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?
Answers.UserDisplayName: Tom Brossman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-18T02:30:33.373Z
Answers.Text: @TomBrossman Can you provide a link to a pastebin of your command and the complete console output?
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-18T07:24:53.290Z
Answers.Text: Sure, [here it is](http://pastebin.com/0tz8RHNA).
Answers.UserDisplayName: Tom Brossman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-18T18:28:24.153Z
Answers.Text: @TomBrossman Change `-af` to `-filter_complex`, or remove `[audio]` and the maps. Also see the [dynaudnorm](https://ffmpeg.org/ffmpeg-filters.html#dynaudnorm) filter mentioned by Paul. I think it's newer than this answer.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-10T23:49:46.840Z
Answers.LastActivityDate: 2016-02-18T18:26:26.440Z
Answers.LastEditDate: 2020-06-17T09:53:03.607Z
Answers.UserDisplayName: llogan
Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-10T19:06:05.897Z
Answers.LastActivityDate: 2014-06-10T19:06:05.897Z
Answers.UserDisplayName: Jim Mack
Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-10T18:59:06.773Z
Answers.Text: 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.
Answers.UserDisplayName: Jim Mack
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-10T19:33:53.813Z
Answers.Text: True, I just skipped through the SU answer. It's indeed just about changing the volume.
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-10T18:32:14.597Z
Answers.LastActivityDate: 2014-06-10T18:32:14.597Z
Answers.LastEditDate: 2017-03-20T10:18:33.487Z
Answers.UserDisplayName: timonsku
Body: <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>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-06-10T18:13:32.627Z
Comments.Text: 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.
Comments.UserDisplayName: AJ Henderson
Tags: <ffmpeg><audio>
Title: ffmpeg: Normalize audio in an avi file
UserDisplayName: zinon
ThreadText: # ffmpeg: Normalize audio in an avi file
  
  (Asked by: username_0 on 2014-06-10)
  
  Ι 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?
  
  **Tags:** ffmpeg, audio
  
  > **Comments:**
  > **username_1**: 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.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2014-06-10. Score: 6
  
  You can use `ffmpeg` with the [compand audio filter](http://ffmpeg.org/ffmpeg-filters.html#compand) (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](http://ffmpeg.org/ffmpeg-filters.html#compand)
  
  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](http://ffmpeg.org/ffmpeg.html#Stream-copy) (re-muxed) in this example since you probably don't want to touch the video.
  
  > **Comments:**
  > **username_3**: 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?  
  > **username_2**: @username_3 Can you provide a link to a pastebin of your command and the complete console output?  
  > **username_3**: Sure, [here it is](http://pastebin.com/0tz8RHNA).  
  > **username_2**: @username_3 Change `-af` to `-filter_complex`, or remove `[audio]` and the maps. Also see the [dynaudnorm](https://ffmpeg.org/ffmpeg-filters.html#dynaudnorm) filter mentioned by Paul. I think it's newer than this answer.  
  
  ---
  
  ### Answer by username_4 on 2014-06-10. Score: 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.
  
  
  ---
  
  ### Answer by username_5 on 2014-06-10. Score: 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>
  
  > **Comments:**
  > **username_4**: 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.  
  > **username_5**: True, I just skipped through the SU answer. It's indeed just about changing the volume.  
  
  ---
  
  