[FFmpeg-user] Separately processing color channels via separate files

Martin Cracauer cracauer at cons.org
Sat Jan 4 15:57:13 CET 2014

I went down the route below (left for reference) but I need a
kickstarter on how blend is supposed to work if I want to merge color
channels from different files.

I have separate files: 1) cyan+audio 2) red.  I have made my desired
separate adjustments to both (mainly saturation).  But I have
difficulties mixing the red color channel back in.

Here is what I tried:

ffmpeg -i cyan.mkv -i red.mkv -map 0 [filter] [copyaudio] out.mkv

For [filter] being:

-filter_complex 'blend=all_expr=A+B'
   ==> that leads to a binary blob (all on/off) and small file

-filter_complex 'blend=c0_expr=A:c1_expr=A:c2_expr=B:c3_expr=A' \
  ==> darker pink

-filter_complex 'blend=all_mode=addition' 
  ==> that leads to a pink monochrome video.  Very pretty

-filter_complex 'blend=all_mode=multiply' 
  ==> that leads to a dark green monochrome video.  Very ugly

-filter_complex 'blend=all_mode=and' 
  ==> that leads to a green pixelated video

-filter_complex "[0:v][1:v]blend=all_mode=addition[out]"  -map '[out]' \
  ==> that leads to just cyan, the mix in doesn't happen

What am I missing? I suspect that some of the things I tried actually
only deal with alpha channel values (which I have none of).

I seem to be particularly confused about 'blend=all_expr=A+B' which
doesn't seem to do what I want at all.  All I ever get out of it is
pacman style pixels.


Martin Cracauer wrote on Thu, Jan 02, 2014 at 12:06:34PM -0500: 
> I wonder whether this will work:
> Can I separate out color channels into different video files,
> manipulate them (e.g. different saturation for each channel) and then
> mix them back together.
> Something along these lines, getting two files for red and cyan:
> ffmpeg -i source.mkv -vf colorbalance=rs=-1:rm=-1:rh=-1 cyan.mkv
> [analog for green and blue = -1] red.mkv
> Then mix it back in:
> ffmpeg -i cyan.mmkv -vf 'movie=red.mkv [somemagic] overlay=0:0 [out]' final.mkv
> Before I go down this route, is there anything that makes this doomed
> to fail?
> Is there a better method to kill individual color channels than -vf
> colorbalance?
> Is there any hope to maybe do the separation without re-encoding? Can
> I just kill a channel without reencoding?
> Thanks
> Martin
> -- 
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> Martin Cracauer <cracauer at cons.org>   http://www.cons.org/cracauer/

Martin Cracauer <cracauer at cons.org>   http://www.cons.org/cracauer/

More information about the ffmpeg-user mailing list