title: MediaRecorder fails even when matching Video Size and Preview Size aspect ratios
body: <p>According to the <a href="http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getPreferredPreviewSizeForVideo()" rel="nofollow">Camera.Parameters#getPreferredSizeForVideoPreview</a> documentation:</p>
  
  <blockquote>
    <p>we recommend to choose a preview size that has the same aspect ratio as the resolution of video to be recorded</p>
  </blockquote>
  
  <p>I have found that, on certain devices (Galaxy S3), that selecting a video recording size with a different aspect ratio does indeed cause problems recording video (<a href="http://forums.crackberry.com/attachments/bb10-android-app-sideloading-f279/188638d1375513127t-snapchat-works-great-img_00000007.png" rel="nofollow">green/purple videos</a>). </p>
  
  <p>When I follow the documentation's advice and stick to the same aspect ratio, it mostly works, but on some devices (Nexus S / Android 4.0.4), calls to <code>MediaRecorder.start()</code> fail with the message:</p>
  
  <pre><code>E/MediaRecorder﹕ start failed: -19
  </code></pre>
  
  <p>On other devices (HTCEVOV4G / Android 4.0.3) calls to <code>MediaRecorder.stop</code> fail with the message:</p>
  
  <pre><code>E/MediaRecorder﹕ stop failed: -1007
  </code></pre>
  
  <p>I do find, however, that if I call <code>MediaRecorder#setVideoSize</code> with the exact same dimensions as the camera's preview size, the video recording works.</p>