Last active
December 13, 2021 10:54
-
-
Save relthyg/b0048f0ad197649c00a569557ac0b407 to your computer and use it in GitHub Desktop.
ffmpeg cheat sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Downmix 5.1 to stereo, compress dynamic range and normalize an audio track using ffmpeg. | |
# | |
# This comes in handy when you're constantly fiddling with your volume control while watching a movie | |
# because the dialogues are too silent and the explosions too loud. | |
# | |
# Firstly, Surround sound is mixed down to stereo. Then, audio is normalized with the intention to "fit" | |
# the "points" of the following DRC process using the compand filter. The last step is to ensure that the end | |
# result is normalized. | |
# | |
# See: | |
# [1] https://superuser.com/a/1219033 | |
# [2] https://forum.videohelp.com/threads/349883-Remixing-DTS-5-1-to-good-AC3-5-1-track#post2202882 | |
# [3] http://sox.sourceforge.net/sox.html | |
# [4] http://ffmpeg.org/ffmpeg-filters.html#compand | |
# [5] http://ffmpeg.org/ffmpeg-filters.html#dynaudnorm | |
DOWNMIX="pan=stereo|FL < 1.0*FL + 0.707*FC + 0.707*BL|FR < 1.0*FR + 0.707*FC + 0.707*BR" # See [1] | |
COMPAND="compand=.1|.1:.3|.3:-90/-90|-70/-64|-43/-37|-31/-31|-21/-21|0/-20:6:0:0:0.1" # "Film Standard" compand filter from [2] | |
FILTER_CHAIN="$DOWNMIX, dynaudnorm, $COMPAND, dynaudnorm" | |
ffmpeg -i "$1" -filter:a:0 "$FILTER_CHAIN" processed_"$1".wav |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment