title: AVFoundation: Capturing Video fails after ~30 mins
body: <p>I'm using AVAssetWriter with a AVAssetWriterInputPixelBufferAdaptor to capture video from an AVCaptureSession. I'm writing the file to the App's Caches directory. After I'm done I save the video to the camera roll.</p>
  
  <p>Now here's the problem:
  Things work fine for short capture sessions from 10 to 20 mins. After about 30 mins I get this error when calling [assetWriter finishWriting]:</p>
  
  <pre><code>Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" 
  UserInfo=0x1a1d30 {NSLocalizedFailureReason=An unknown error occurred (268451843), 
  NSUnderlyingError=0x1936e0 "The operation couldn’t be completed. (OSStatus error 
  268451843.)", NSLocalizedDescription=The operation could not be completed}
  </code></pre>
  
  <p>Another interesting thing is, it actually does save the video to the camera roll, but after a certain point the video seems to be corrupt. VLC shows the length of the video to be 1 hour, but only plays the first 30min. and then cuts black.</p>
  
  <p>I am clueless why its doing that.</p>
  
  <p>I'm on iOS 5.0, iPhone 4S, recording with 30 FPS, 1920x1080 and using AVFileTypeMPEG4.</p>
  
  <p>Any ideas?</p>