Body: <p>I'm trying to achieve complex effect with <code>ffmpeg</code>, but I seem to be failing the syntax of <code>-filter_complex</code> somewhere. </p>
  
  <p>The goal is to capture part of the screen (with UScreenCapture direct show device) where I display two images side by side (called <code>[bg]</code> and <code>[key</code>], or <code>[rgb]</code> and <code>[alpha]</code> 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 <code>[video]</code> in the filter chain). </p>
  
  <p>To compose the three together, first I blend 'multiply' the alpha with the video, turning to black everything outside the white alpha(dumped into <code>[out1]</code>), and blend 'multiply' the image background with the negative alpha (dumped into <code>[out2]</code>). To end the chain I add the two outs with blend mode addition... and dump it to a pipe</p>
  
  <p>Theoretically it should work but it keeps complaining about stream specifier 'alpha' matching no stream:</p>
  
  <pre><code>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 -
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-02T18:22:22.617Z
Comments.Text: 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.
Comments.UserDisplayName: llogan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-09T09:00:17.607Z
Comments.Text: Have you tested to see that this works?
Comments.UserDisplayName: Dr Mayhem
Tags: <ffmpeg><effects><filter><video-capture><composing>
Title: ffmpeg filter_complex problem
UserDisplayName: Nuno Estanqueiro
ThreadText: # ffmpeg filter_complex problem
  
  (Asked by: username_0 on 2014-12-02)
  
  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 -
  
  ```
  
  **Tags:** ffmpeg, effects, filter, video-capture, composing
  
  > **Comments:**
  > **username_1**: 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.  
  > **username_2**: Have you tested to see that this works?  
  
  ---
  
  ## 0 answers
  
  