title: Compensate For AVLayerVideoGravityResizeAspectFill Height Difference
body: <p>I have a nested video like this:
  <a href="http://postimg.org/image/qsjdokxan/" rel="nofollow">Live camera feed</a></p>
  
  <p>When the user takes a photo, the image is offset along the y axis
  <a href="http://postimg.org/image/wnwyepgpz/" rel="nofollow">Captured Still image</a></p>
  
  <p>I do want to capture the WHOLE image and let the user scroll up and down. They can do this currently but I want the starting scroll of the image to be centered to match the camera feed preview. So if they take a picture, the image matches the frame that the video feed was showing.</p>
  
  <p>The problem is, because the aspect on the camera is set to AVLayerVideoGravityResizeAspectFill it's doing some 'cropping' to fit the image into the live preview. Since the height is much bigger than the width, there are top and bottom parts that are captured in the image that are NOT showing up in the live feed (naturally).</p>
  
  <p>What I don't know, however, is how much the top is being cropped so I can offset the previewed image to match this.</p>
  
  <p>So my question is: Do you know how to calculate how much is being cropped from the top of a camera with its aspect ratio set to AVLayerVideoGravityResizeAspectFill? (Objective-C and Swift answers welcome!)</p>