user11809: I want to capture a window and overlay it on another video.
This is my command:
ffmpeg -i MainVideo.avi 
-f gdigrab -framerate 25 -video_size 300x200 -i title="MyWindow" 
-filter_complex "[0]setpts=PTS-STARTPTS[b];[b][1:v]overlay=(main_w-overlay_w):main_h-overlay_h[v]"
-map "[v]" -c:v libx264 -r 25  out.mp4

background of my window is black.
How can I replace this black color with transparency?
is this possible by ffmpeg? (I think it is possible by chromakey/colorkey filters but I'm not sure, and I don't know how to use those filters)
Thanks.
UPDATE:
Suppose this is a frame of video that I want:


user1871: GDIgrab supplies a RGB feed so the colorkey filter can work here.
Try
ffmpeg -i 1.mp4 -f gdigrab -framerate 25 -video_size 300x200 -i title="MyWindow"
-filter_complex
"[1]split[m][a];
 [a]format=yuv444p,geq='if(gt(lum(X,Y),0),255,0)',hue=s=0[al];
 [m][al]alphamerge[ovr];
 [0][ovr]overlay=(main_w-overlay_w):main_h-overlay_h[v]"
-map "[v]" -c:v libx264 -r 25 out.mp4

You may have to use a value of near 0, if 0 doesn't capture all the transparent area.

11809: <p>I want to capture a window and overlay it on another video.</p>

<p>This is my command:</p>

<pre><code>ffmpeg -i MainVideo.avi 
-f gdigrab -framerate 25 -video_size 300x200 -i title="MyWindow" 
-filter_complex "[0]setpts=PTS-STARTPTS[b];[b][1:v]overlay=(main_w-overlay_w):main_h-overlay_h[v]"
-map "[v]" -c:v libx264 -r 25  out.mp4
</code></pre>

<p>background of my window is black.</p>

<p>How can I replace this black color with transparency?</p>

<p>is this possible by ffmpeg? (I think it is possible by chromakey/colorkey filters but I'm not sure, and I don't know how to use those filters)</p>

<p>Thanks.</p>

<p><strong>UPDATE:</strong></p>

<p>Suppose this is a frame of video that I want:
<a href="https://i.stack.imgur.com/zAuuX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zAuuX.png" alt="enter image description here"></a></p>
 1871: <p>GDIgrab supplies a RGB feed so the colorkey filter can work here.</p>

<p>Try</p>

<pre><code>ffmpeg -i 1.mp4 -f gdigrab -framerate 25 -video_size 300x200 -i title="MyWindow"
-filter_complex
"[1]split[m][a];
 [a]format=yuv444p,geq='if(gt(lum(X,Y),0),255,0)',hue=s=0[al];
 [m][al]alphamerge[ovr];
 [0][ovr]overlay=(main_w-overlay_w):main_h-overlay_h[v]"
-map "[v]" -c:v libx264 -r 25 out.mp4
</code></pre>

<p>You may have to use a value of near 0, if 0 doesn't capture all the transparent area.</p>
