Given two audio streams, I'd like to remove the audio in one stream that also exists in another. In this particular case the 1st stream contains everything mixed, and the 2nd stream contains just the background noise which also exists in the 1st stream. Is there a reasonable way to go about "subtracting" this background audio track from the 1st audio track?

Ideally using ffmpeg, but open to anything. I've naively tried inverting the background channel and mixing it with the first channel with this ffmpeg filter: aeval=val(0)|-val(1) but that doesn't work. I assume that's because the background is mixed at a different level. (I'm also assuming they're exactly in phase)

Any other ideas?

audio visualization

For reference, here's ffmpeg showcqt filter on each channel side by side. You can see how the 2nd column seems to "contain" all of the audio in the first column, plus some more. (and mixed at different levels)

1 Answer 1


Inverting the background should work, that's exactly how a balanced audio connection works to eliminate noise, but how exact a match is your isolated background track compared to the mixed track? It's only going to fully work if it is recorded at the exact same quality, volume, etc, and the timing is precisely the same. What was the recording source for each track? How confident are you that the two sets of background audio that were recorded are identical to each other?

  • My guess is that the match isn't exact. Or rather, that it is exact in the time dimension, but that the volume differs. For context, I'm interested in doing this in general, but a particular use case I have in mind is isolating dialogue from a 5.1 surround audio. Typically with 5.1 sound center channel (FC) contains all the dialogue, and sometime it also has the background sound at a lower volume. That same background sound is also in the FR and FL channels (assuming no stereo differences, true most of the time). So I'd like to subtract FR+FL from the FC to get just dialogue!
    – Chris
    Jul 28, 2020 at 0:00
  • I would suggest making a new post, specifically asking for the best way to isolate dialogue from a 5.1 audio mix. In this case, I doubt the audio in other channels matches enough to invert like you tried (but worth a shot), but I suspect there are other methods available that will work better. I've seen it done somewhat successfully by filtering frequencies to remove "non-voice" sounds, but there might be other better ways of doing this. Jul 28, 2020 at 23:58

Your Answer

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

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