scripts:ffmpeg:dynamic_range_compression_dynaudnorm_compand

Volume Adjustment and Dynamic Range Compression using dynaudnorm and compand

Normally, dynamic range compression is bad. Makes music sound lifeless. However, I hate adjusting volume between and during tracks when I'm walking.
Normalization takes care of consistent volume across tracks but not sudden jumps or louder rms. Dynaudnorm can essentially vary the volume throughout a track based on the peak volume, without losing range.

For most uses, only use dynaudnorm, don't even add the compand. My use here is more aggressive and will change volumes much faster as well as compress range a bit (hopefully without distorting too much).
Compand will basically compress the range, and will probably distort, so use with caution, esp when mixing like this.

In this case, this is literally music for me when I'm walking, and needs to take up minimal space on my phone, so I compress with opus at 64 or even 32 kbit/s. While that would sound like garbage in the mp3 era, 64 is ok, and 32 most certainly artifacts, but still usable, especially with my garbage earbuds from a Samsung Galaxy Q I'm waiting on to stop working.

Sounds bad? yes. but at least I don't have to reach into my pocket to change volumes every minute.

(Parallel is just used so I can batch process on my system).

parallel --ungroup -j30 -q -a /tmp/files ffmpeg -i "{}" -filter_complex "[0:a]dynaudnorm=framelen=200:gausssize=11:maxgain=30:targetrms=0.5:altboundary=1:compress=8:correctdc=1[int];[int]compand=attacks=0:points=-80/-900|-45/-15|-27/-9|0/-7|20/-7:gain=4[out]" -map "[out]" -vn -c:a libopus -b:a 32k -vbr on -compression_level 10  -map_metadata 0 -id3v2_version 3 -y "../export/{.}.ogg"
  • scripts/ffmpeg/dynamic_range_compression_dynaudnorm_compand.txt
  • Last modified: 2022-06-12 04:08
  • by Tony