title: UIImagePickerController: Getting image capture from video
body: <p>I'm trying to extract a frame from a video as an image.  The video is recorded using UIImagePickerController.</p>
  
  <p>When the video has been recorded I get its URL and load it using AVURLAsset.  Then I create a AVAssetReader and AVAssetReaderTrackOutput to get the individual frames.</p>
  
  <p>When I get the frames as CMSampleBufferRef's I pass them to Apple's imageFromSampleBuffer method which should return a UIImage.  This method worked fine when I was getting frames using an AVCaptureSession but when I use a video recorded via UIImagePickerController then this line returns 0x0:</p>
  
  <pre><code>CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); 
  </code></pre>
  
  <p>Where sampleBuffer is the CMSampleBufferRed that I pass.</p>
  
  <p>I checked the value of sampleBuffer via the debugger and it looked ok (wasn't 0x0).  Is there any reason why CMSampleBufferGetImageBuffer would return 0x0?</p>
  
  <p>Or alternatively is there another way to extract a single video frame from a MOV file and save it as a UIImage?</p>
  
  <p>Thanks.</p>