how to merge two video with transparency
<p>I have successfully merge video-1 and video-2, over each other with video-2 being transparent using <strong>AVFoundation framework</strong> but after merging below video(video-1) is not displayed only video-2 is visible but when I use below code</p>

<pre><code>AVMutableVideoCompositionLayerInstruction *SecondlayerInstruction =[AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:secondTrack];
[SecondlayerInstruction setOpacity:0.6 atTime:kCMTimeZero];
</code></pre>

<p>its set opacity on video-2 layer.But here actual problem is, there are some content over video-2 layer which is not transparent and here after applying opacity over video-2 layer it also apply over that content which is not transparent.<br>
I am adding two image here which describe both scenario after set opacity using <code>AVMutableVideoCompositionLayerInstruction</code></p>

<p><a href="https://i.stack.imgur.com/RVW61.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RVW61.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/ci2Fh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ci2Fh.png" alt="enter image description here"></a></p>

<ul>
<li>as in image after merging transparent area is black and when I set opacity over second layer whole the video-2 goes transparent now but the content also become transparent.</li>
<li>but my question is that how to play transparent video over another video after merging.I already checked video-2 is transparent as it proper play in android platform.</li>
</ul>

<p><strong>Edited-1 :</strong> I also try to set a background color on <code>myVideoCompositionInstruction</code>which also not helped. taking reference from this old question<a href="https://stackoverflow.com/q/6678743/3384769"> link</a></p>

<p><strong>Edited-2 :</strong> In AVVideoComposition.h, I found</p>

<blockquote>
  <p>Indicates the background color of the composition. Solid BGRA colors
  only are supported; patterns and other color refs that are not
  supported will be ignored. If the background color is not specified
  the video compositor will use a default backgroundColor of opaque
  black. If the rendered pixel buffer does not have alpha, the alpha
  value of the backgroundColor will be ignored.</p>
</blockquote>

<p>What it means, I didn't get it.can any one help?</p>