title: FFMPEG: Overlaying one video on another one, and making black pixels transparent
body: <p>I'm trying to use <strong>FFMPEG</strong> to create a video with one video overlayed on top another.  </p>
  
  <p>I have 2 MP4s.  I need to make all <strong>BLACK pixels</strong> in the <strong>overlay</strong> video <strong>transparent</strong> so that I can see the main video underneath it.</p>
  
  <p>I found two ways to overlay one video on another:</p>
  
  <p>First, the following positions the overlay in the center, and therefore, hides that portion of the main video beneath it:</p>
  
  <pre><code>    ffmpeg -i 1.mp4 -vf "movie=2.mp4 [a]; [in][a] overlay=352:0 [b]" combined.mp4 -y
  </code></pre>
  
  <p>And, this one, places the overlay video on the left, but it's opacity is set to 50% so at least other one beneath it is visible:</p>
  
  <pre><code>ffmpeg -i 1.mp4 -i 2.mp4 -filter_complex "[0:v]setpts=PTS-STARTPTS[top]; [1:v]setpts=PTS-STARTPTS, format=yuva420p,colorchannelmixer=aa=0.5[bottom]; [top][bottom]overlay=shortest=0" -acodec libvo_aacenc -vcodec libx264 out.mp4 -y
  </code></pre>
  
  <p>My goal is simply to make all black pixels in the overlay (2.mp4) completely transparent. How can this be done.</p>