title: Android MediaRecorder start failed -19
body: <p>I am developing an Android Streaming Application using Live555. Therefore, I decided to record audio und video separatly to handle the streams. But unfortunatly, I got an RuntimeException when I try to start the recording.</p>
  
  <pre><code>private void startRecording() throws IOException {
      if (videoRecorder == null) {
          videoRecorder = new MediaRecorder();
          videoRecorder.setPreviewDisplay(preview.getHolder().getSurface());
          videoRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
          videoRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
          videoRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
          videoRecorder.setVideoSize(320,24);
          videoRecorder.setVideoFrameRate(25);
          videoRecorder.setOutputFile(video.getFD());
      }
  
      if (audioRecorder == null) {
          audioRecorder = new MediaRecorder();
          audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
          audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
          audioRecorder.setOutputFile(audio.getFD());
      }
  
      if (!isStreaming) {
          videoRecorder.prepare();
          videoRecorder.start(); // RuntimeException
          audioRecorder.prepare();
          audioRecorder.start();
          isStreaming = true;
  
      } else {
          stopRecording();
          isStreaming = false;
      }
  
      Thread t = new Thread(new LiveStreamer(this, video, audio));
      t.setPriority(Thread.MAX_PRIORITY);
      t.start();
  }
  </code></pre>
  
  <p>I searched on the Internet for a while, but none of the successed solutions worked for me. Here's the logcat:</p>
  
  <pre><code>    01-02 16:17:09.355: E/MediaRecorder(11256): start failed: -19
  01-02 16:17:09.355: D/AndroidRuntime(11256): Shutting down VM
  01-02 16:17:09.355: W/dalvikvm(11256): threadid=1: thread exiting with uncaught exception (group=0x41884da0)
  01-02 16:17:09.355: E/AndroidRuntime(11256): FATAL EXCEPTION: main
  01-02 16:17:09.355: E/AndroidRuntime(11256): Process: de.douglasmedia.LiveCam, PID: 11256
  01-02 16:17:09.355: E/AndroidRuntime(11256): java.lang.RuntimeException: start failed.
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at android.media.MediaRecorder.start(Native Method)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at de.douglasmedia.LiveCam.MainActivity.startRecording(MainActivity.java:139)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at de.douglasmedia.LiveCam.MainActivity.access$0(MainActivity.java:116)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at de.douglasmedia.LiveCam.MainActivity$1.onClick(MainActivity.java:66)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at android.view.View.performClick(View.java:4637)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at android.view.View$PerformClick.run(View.java:19422)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at android.os.Handler.handleCallback(Handler.java:733)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at android.os.Handler.dispatchMessage(Handler.java:95)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at android.os.Looper.loop(Looper.java:136)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at android.app.ActivityThread.main(ActivityThread.java:5586)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at java.lang.reflect.Method.invoke(Method.java:515)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
  01-02 16:17:09.355: E/AndroidRuntime(11256):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Here's the permission section of my AndroidManifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.RECORD_AUDIO" /&gt;
  &lt;uses-permission android:name="android.permission.CAMERA" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
  &lt;uses-feature android:name="android.hardware.camra" /&gt;
  </code></pre>
  
  <p>Somewhere, I have read that the problem is the video size. So, I tried it with the allowed video sizes, but got the same error. Does someone have a idea how to fix this problem? Thanks for your help!</p>