1

I'm trying to achieve complex effect with ffmpeg, but I seem to be failing the syntax of -filter_complex somewhere.

The goal is to capture part of the screen (with UScreenCapture direct show device) where I display two images side by side (called [bg] and [key], or [rgb] and [alpha] in the filter chain). On the left is the image itself, on the right its alpha channel, shown in black and white. Then I want to compose that on top of another input (some video input from a file or other capture device... but a file in this case, called [video] in the filter chain).

To compose the three together, first I blend 'multiply' the alpha with the video, turning to black everything outside the white alpha(dumped into [out1]), and blend 'multiply' the image background with the negative alpha (dumped into [out2]). To end the chain I add the two outs with blend mode addition... and dump it to a pipe

Theoretically it should work but it keeps complaining about stream specifier 'alpha' matching no stream:

ffmpeg -v debug -f dshow -i video=UScreenCapture -i chroma.mp4 -filter_complex \
"[0:v]split[bg][key]; \
 [bg]crop=720:576:0:0, format=gbrap,setsar=0:1[rgb]; \
 [key]crop=720:576:720:0,format=gray8,setsar=0:1,scale=720:576[alpha]; \
 [1:v]scale=720:576,format=yuv420p,setsar=0:1[video]; \
 [alpha]negate[neg_alpha]; \
 [video][neg_alpha]blend=all_mode='multiply':all_opacity=1[masked_video]; \
 [rgb][alpha]blend=all_mode='multiply':all_opacity=1[masked_3d]; \
 [masked_video][masked_3d]blend=all_mode='addition':all_opacity=1[out]" \
-map "[out]"-c:v mpeg2video -f avi - | ffplay -
3
  • You should trim your filtergraph, if possible, to keep only the minimum filters necessary for the problem to arise. You should also include the complete console output from your command.
    – llogan
    Commented Dec 2, 2014 at 18:22
  • Add a space before -c:v mpeg2video
    – user6898
    Commented Dec 6, 2014 at 10:54
  • Have you tested to see that this works?
    – Dr Mayhem
    Commented Dec 9, 2014 at 9:00

1 Answer 1

1

filgergraph as described can not work, you can not use [alpha] twice, you need to split it:

[0:v]split[bg][key]; [bg]crop=720:576:0:0, format=gbrap,setsar=0:1[rgb]; [key]crop=720:576:720:0,format=gray8,setsar=0:1,scale=720:576,split[alpha2][alpha]; [1:v]scale=720:576,format=yuv420p,setsar=0:1[video]; [alpha]negate[neg_alpha]; [video][neg_alpha]blend=all_mode='multiply':all_opacity=1[masked_video]; [rgb][alpha2]blend=all_mode='multiply':all_opacity=1[masked_3d]; [masked_video][masked_3d]blend=all_mode='addition':all_opacity=1

Your Answer

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

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