Answers.Body: <p>Instead of always using <code>[1:v]</code>, you would use the output of the previous one e.g. <code>[ckout1]</code></p>
  <p>My guess, you want this:</p>
  <pre><code>ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex '[1:v]colorkey=0x6AA999:0.1:0.2[ckout1];[ckout1]colorkey=0x4D827A:0.1:0.2[ckout2];[0:v][ckout2]overlay[out2]' -map '[out2]' output.mp4
  </code></pre>
  <p>(Maybe the inputs switched around)</p>
  <p>The overlay you are using is from <a href="https://ffmpeg.org/ffmpeg-filters.html#colorkey" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg-filters.html#colorkey</a>? My guess is, that you misunderstood, what the overlay does in the example there. The example describes overlaying 2 opaque videos on top of each other, where the upper video receives transparency first.<br />
  What you are doing is overlay the transparent version of input2 onto input1 and then colorkeying input2 again and putting that also on top of input1 and the first colorkey.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-07T22:45:33.357Z
Answers.Text: I tried with this filter, but it seems like it only applies the second colorkey
  `-filter_complex '[1:v]colorkey=0x016733:0.1:0.25:[ckout1];[ckout1]colorkey=0x32AB57:0.1:0.2:[ckout];[0:v][ckout]overlay[out]' -map '[out]' -map 1:a:?`
Answers.UserDisplayName: Kjeld Flarup
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-06T11:33:46.290Z
Answers.LastActivityDate: 2020-07-19T14:12:44.793Z
Answers.LastEditDate: 2020-07-19T14:12:44.793Z
Answers.UserDisplayName: Pingger Shikkoken
Answers.Body: <p>I've been looking for the same question, and saw you almost had it and thanks to that I've found my own answer.</p>
  <pre><code> What would go in place of input1_c3 and input2_c3? 
  </code></pre>
  <p>TOP (or A) and BOTTOM (or B) will have the values you're looking for.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-04-04T00:36:54.487Z
Answers.LastActivityDate: 2022-04-04T00:36:54.487Z
Answers.UserDisplayName: Anonymous
Body: <p>I tried creating two separate colorkey filters (as these seem to work better than chromakey filters) like this:</p>
  
  <pre><code>ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex '[1:v]colorkey=0x6AA999:0.1:0.2[ckout1];[0:v][ckout1]overlay[out1];[1:v]colorkey=0x4D827A:0.1:0.2[ckout2];[out1][ckout2]overlay[out2]' -map '[out2]' output.mp4
  </code></pre>
  
  <p>But this does not seem to filter on both keys.  In thinking about why, I think the issue is that both filters are creating transparency in the pixels that match that key, but then the overlay is combining the pixels that weren't filtered out from both keys, so I'm really only getting transparency for pixels which match BOTH filters, instead of those which match either.</p>
  
  <p>I also looked at the <code>blend</code> filter, with the idea that perhaps I could do something like this in the filter complex:</p>
  
  <pre><code>'[0:v]colorkey='$KEY1':0.1:0.2[ckout1];[0:v]colorkey='$KEY2':0.1:0.2[ckout2];[ckout1][ckout2]blend=c3_expr=min(input1_c3,input2_c3)[out2]' -map '[out2]'
  </code></pre>
  
  <p>The idea being that I would take the minimum alpha value (opacity) of each input source for each pixel and make that the alpha value for the output for that pixel.  I am <em>assuming</em> (it's not clear from the text) that the "c3" channel is referring to the alpha channel, but I don't see how to get the alpha value from each input.  What would go in place of <code>input1_c3</code> and <code>input2_c3</code>?  </p>
  
  <p>Or is there another way to do this that is better?</p>
  
Tags: <video><ffmpeg><video-editor><chromakey>
Title: How to apply multiple chroma keys in ffmpeg?
UserDisplayName: Michael
ThreadText: # How to apply multiple chroma keys in ffmpeg?
  
  (Asked by: username_0 on 2020-06-05)
  
  I tried creating two separate colorkey filters (as these seem to work better than chromakey filters) like this:
  
  ```
  ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex '[1:v]colorkey=0x6AA999:0.1:0.2[ckout1];[0:v][ckout1]overlay[out1];[1:v]colorkey=0x4D827A:0.1:0.2[ckout2];[out1][ckout2]overlay[out2]' -map '[out2]' output.mp4
  
  ```
  
  But this does not seem to filter on both keys. In thinking about why, I think the issue is that both filters are creating transparency in the pixels that match that key, but then the overlay is combining the pixels that weren't filtered out from both keys, so I'm really only getting transparency for pixels which match BOTH filters, instead of those which match either.
  
  I also looked at the `blend` filter, with the idea that perhaps I could do something like this in the filter complex:
  
  ```
  '[0:v]colorkey='$KEY1':0.1:0.2[ckout1];[0:v]colorkey='$KEY2':0.1:0.2[ckout2];[ckout1][ckout2]blend=c3_expr=min(input1_c3,input2_c3)[out2]' -map '[out2]'
  
  ```
  
  The idea being that I would take the minimum alpha value (opacity) of each input source for each pixel and make that the alpha value for the output for that pixel. I am *assuming* (it's not clear from the text) that the "c3" channel is referring to the alpha channel, but I don't see how to get the alpha value from each input. What would go in place of `input1_c3` and `input2_c3`?
  
  Or is there another way to do this that is better?
  
  **Tags:** video, ffmpeg, video-editor, chromakey
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-06-06. Score: 1
  
  Instead of always using `[1:v]`, you would use the output of the previous one e.g. `[ckout1]`
  
  My guess, you want this:
  
  ```
  ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex '[1:v]colorkey=0x6AA999:0.1:0.2[ckout1];[ckout1]colorkey=0x4D827A:0.1:0.2[ckout2];[0:v][ckout2]overlay[out2]' -map '[out2]' output.mp4
  
  ```
  
  (Maybe the inputs switched around)
  
  The overlay you are using is from <https://ffmpeg.org/ffmpeg-filters.html#colorkey>? My guess is, that you misunderstood, what the overlay does in the example there. The example describes overlaying 2 opaque videos on top of each other, where the upper video receives transparency first.  
  What you are doing is overlay the transparent version of input2 onto input1 and then colorkeying input2 again and putting that also on top of input1 and the first colorkey.
  
  > **Comments:**
  > **username_2**: I tried with this filter, but it seems like it only applies the second colorkey `-filter_complex '[1:v]colorkey=0x016733:0.1:0.25:[ckout1];[ckout1]colorkey=0x32AB57:0.1:0.2:[ckout];[0:v][ckout]overlay[out]' -map '[out]' -map 1:a:?`  
  
  ---
  
  ### Answer by username_3 on 2022-04-04. Score: 0
  
  I've been looking for the same question, and saw you almost had it and thanks to that I've found my own answer.
  
  ```
   What would go in place of input1_c3 and input2_c3? 
  
  ```
  
  TOP (or A) and BOTTOM (or B) will have the values you're looking for.
  
  
  ---
  
  