0

I can do audio phase subtraction in Adobe Audition like so:

How can I do this with FFmpeg? Is it possible?

I've googled for audio phase subtraction, and looked at https://ffmpeg.org/ffmpeg-filters.html, nothing seems to work for me.

I want to do phase subtraction in batches and support for stereo audio.

3
  • 1
    You can do this in something like Audacity, but why the need for batch processing? It's the kind of thing that only works if you have absolute phase-alignment to start with*. I struggle to see a use case you would have multiple examples of this type of overlay with identical start-points/phase alignment. It makes the whole question feel like a bit of an XY Problem *[I didn't watch the whole thing, but did the guy tell you it took him 20 minutes to phase-align his example before he started the video?]
    – Tetsujin
    Apr 22, 2023 at 17:26
  • 1
    See the aeval filter.
    – Gyan
    Apr 22, 2023 at 19:01
  • 1
    @tetsujin I want to compare audio compression using different codecs, with perfectly aligned audio files. Additionally, I want to compare audio encoding across various scenarios, which is why I need to perform this task in batches.
    – Calarpo
    Apr 23, 2023 at 4:08

1 Answer 1

2

I have found a solution:

ffmpeg -i input0.wav -i input1.wav \
  -filter_complex \
  "[1]    aeval  = -val(0) | -val(1)                     [a]; \
   [0][a] amerge = inputs=2,pan=stereo|c0<c0+c2|c1<c1+c3 [b]" \
  -map "[b]" -c:a flac output.flac

This command subtracts input1.wav from input0.wav and assumes that both inputs are stereo.

See https://trac.ffmpeg.org/wiki/AudioChannelManipulation for manipulating audio channels.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.