I have four assets, a white background, a red background, a circle on black, and a pikachu painting.
Here are the assets (all rgb pngs, no alpha channels):-
I'm trying to overlay the red onto white to give red_on_white, then overlay the circle onto the red_on_white, to give circle_on_red_on_white. I then want to crop part of that now 'rasterised' output out from circle_on_red_on_white, and blend the crop of that with the pikachu asset. And then overlay the blended pair back onto the circle_on_red_on_white.
However, the blended pair comes out looking pink, which is not right.
The blended pair should come out looking like this:- which is how it comes out with this line of code:-
ffmpeg -i circle_rgb_50.png -i pikachu_rgb.png -filter_complex "[0:v][1:v]blend=all_mode=screen" pikachu_screened_over_circle.png
However, when I do the overlays and crop aswell, like this:-
ffmpeg -i bg_rgb_png.png -i color_clip_rgb24_png.png -i circle_rgb_50.png -i pikachu_rgb.png -filter_complex "[0:v][1:v]overlay=0:0[out1];[out1][2:v]overlay=0:0[out2];[out2]split[out2_1][out2_2];[out2_1]crop=50:50:0:0:exact=1,setsar=1[cropped2];[3:v][cropped2]blend=all_mode=screen[blended];[out2_2][blended]overlay=0:0" white_red_circle_pika_from_pngs.png
it comes out looking pink like this:-
I was wondering why it is that it comes out looking pink ? and how I can make it look like it does when it was just the circle and pikachu being blended together ?
So that you can take a crop of the 'rasterised' underlayer, and use that crop for the blend, and then overlay the blend back onto the 'rasterised' underlayer
I was wondering why it is that it comes out looking pink ?
Because when you apply overlay
filter you get alpha channel. You may check it in the output of ffmpeg (in Output section):
... Video: png, rgba...
or with any tool that shows channels.
and how I can make it look like it does when it was just the circle and pikachu being blended together ?
You may force overlay
filter to use rgb
format and make your filter_complex
simpler:
ffmpeg -hide_banner -y \
-i color_clip_rgb24_png.png \
-i circle_rgb_50.png \
-i pikachu_rgb.png \
-filter_complex \
"[1:v][2:v]blend=all_mode=screen[pica_circle];
[0:v][pica_circle]overlay=format=rgb" \
white_red_circle_pika_from_pngs.png