Skip to content

Instantly share code, notes, and snippets.

@Roman-Port
Created December 3, 2023 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Roman-Port/0f95f3739ee0bd5158ea4cd43c94e8f9 to your computer and use it in GitHub Desktop.
Save Roman-Port/0f95f3739ee0bd5158ea4cd43c94e8f9 to your computer and use it in GitHub Desktop.
FFMPEG Stereo Difference Split and Join
Creates L+R and L-R channels:
ffmpeg -i test.wav -filter_complex "[0:a]channelsplit=channel_layout=stereo[l][r];[r]volume=volume=-1[ri];[l][ri]amix=inputs=2[diff];[0:a]channelsplit=channel_layout=stereo[l][r];[l][r]amix=inputs=2:weights=0.5[add]" -map "[add]" add.wav -map "[diff]" diff.wav
Merges L+R and L-R back into a stereo file, identical to the original input:
ffmpeg -i add.wav -i diff.wav -filter_complex "[1:a]volume=volume=-1[diffi];[0:a][1:a]amix=inputs=2[l];[0:a][diffi]amix=inputs=2[r];[l][r]join=inputs=2:channel_layout=stereo[outpre];[outpre]volume=volume=2[out]" -map "[out]" testout.wav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment