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

Paul B Mahol onemda at gmail.com
Mon Jan 6 18:31:34 CET 2014

On 1/4/14, Martin Cracauer <cracauer at cons.org> wrote:
> 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.

It sums A+B but it does not clip, addition does clip, it is just FFMIN(A+B, 255)
it is there because expr is sloooow.

If you need some other blend mode and expr is very slow I'm all ears.

More information about the ffmpeg-user mailing list