title: Simplified screen capture: record video of only what appears within the layers of a UIView?
body: <p><a href="https://stackoverflow.com/questions/2214957/how-do-i-take-a-screen-shot-of-a-uiview">This SO answer</a> addresses how to do a screen capture of a <code>UIView</code>. We need something similar, but instead of a single image, the goal is to produce a video of everything appearing within a <code>UIView</code> over 60 seconds -- conceptually like recording only the layers of that <code>UIView</code>, ignoring other layers.</p>
  
  <p>Our video app superimposes layers on whatever the user is recording, and the ultimate goal is to produce a master video merging those layers with the original video. However, using <code>AVVideoCompositionCoreAnimationTool</code> to merge layers with the original video is very, very, very slow: exporting a 60-second video takes 10-20 seconds.</p>
  
  <p>What we found is combining two videos (i.e., only using <code>AVMutableComposition</code> without <code>AVVideoCompositionCoreAnimationTool</code>) is very fast: ~ 1 second. The hope is to create an independent video of the layers and then combine that with the original video only using <code>AVMutableComposition.</code></p>
  
  <p>An answer in Swift is ideal but not required.</p>