Combining ffmpeg-normalize with ffmpeg pan filer
I am trying to merge ffmpeg-normalize and my typical surround-to-stereo downmixing script.
My normal script in ffmpeg would look like:
ffmpeg -i UTS.mkv -map 0:a:0? -c:a:0 aac_at -aac_at_mode 3 -global_quality:a 14 -filter:a:0 "pan=stereo|FL=1.414*FC+0.707*FL+0.5*FLC+0.5*BL+0.5*SL+0.5*LFE|FR=1.414*FC+0.707*FR+0.5*FRC+0.5*BR+0.5*SR+0.5*LFE,acompressor=ratio=4" -o UTS_aac.mkv
These options take a custom pan of the surround sound channels to generate a dialogue-heavy stereo mix that preserves the LFE channel, then applies the acompressor filter. I thought it would be nice to run normalization on top of that (or at least test it out).
I tried the following syntax:
ffmpeg-normalize UTS.mxv --keep-loudness-range-target -c:a aac -e="-aac_at_mode 3 -global_quality:a 14 -filter:a:0 "pan=stereo|FL=1.414*FC+0.707*FL+0.5*FLC+0.5*BL+0.5*SL+0.5*LFE|FR=1.414*FC+0.707*FR+0.5*FRC+0.5*BR+0.5*SR+0.5*LFE,acompressor=ratio=4"" -o UTS_normal.mkv
That resulted in this error:
'FL' is not recognized as an internal or external command, operable program or batch file.
I also tried:
ffmpeg-normalize UTS.mkv --keep-loudness-range-target -c:a aac -e '[ "-aac_at_mode", "3", "-global_quality:a", "14", "-filter:a:0", "pan=stereo|FL=1.414*FC+0.707*FL+0.5*FLC+0.5*BL+0.5*SL+0.5*LFE|FR=1.414*FC+0.707*FR+0.5*FRC+0.5*BR+0.5*SR+0.5*LFE,acompressor=ratio=4" ]' -o UTSnormal.mkv
Which resulted in a different error:
ffmpeg-normalize: error: argument -f/--force: ignored explicit argument 'ilter:a:0,'
My apologies if this is a dumb question; I just can't seem to figure out this syntax and would really appreciate some help.
Thanks.
I also changed the ' ' marks to " " in the second syntax example and ran it again. That resulted in the first error again ('FL' is not recognized...)
Not on a computer right now, so I can only guess, but you're going to want to use the "pre filter" or "post filter" options instead of the "extra" option. You cannot override the entire filter chain, since that is what ffmpeg-normalize will be using for its internal processing.
Regarding the pipe symbol, you may have to escape that with a backslash, since otherwise it may be interpreted as piping the output to another command.
See here for some examples of pre filtering: https://github.com/slhck/ffmpeg-normalize/wiki/examples#filters
For that, use the --extra-output-options option. The audio channel option in ffmpeg is not a filter, so it needs to be applied to the output file and cannot be used in the pre-filter list of filters.
That should be the same. You can downmix in ffmpeg-normalize, too.
I would recommend to downmix first just using ffmpeg, then use ffmpeg-normalize to perform normalization on the stereo file.