title: Android Mediarecorder: Getting 3GP instead of MPEG4
body: <p>I want to record video only in android with MPEG4 format. I want the container and codec to be MPEG4. So here is what I have done for that.</p>
  
  <pre><code>Thread video = new Thread(new Runnable() {
      public void run() {
          videoRecorder = new MediaRecorder();
          videoRecorder.setPreviewDisplay(surfaceView.getHolder().getSurface());
          videoRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
          videoRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
          videoRecorder.setVideoEncodingBitRate(56 * 8 * 1024);
          videoRecorder.setVideoSize(176, 144);
          videoRecorder.setVideoFrameRate(12);
          videoRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
          videoRecorder.setOutputFile("/sdcard/video.m4e");
          try {
              videoRecorder.prepare();
          } catch (IllegalStateException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
          videoRecorder.start();
      }
  });
  video.start();
  </code></pre>
  
  <p>Now, after recording, I got the video recorded into <code>video.m4e</code> file. But when I check its information, I got the following:</p>
  
  <p><img src="https://i.stack.imgur.com/zlJbo.png" alt="enter image description here"></p>
  
  <p>At the same time I used the following to record audio:</p>
  
  <pre><code>Thread audio = new Thread(new Runnable() {              
      public void run() {
          audioRecorder = new MediaRecorder();
          audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
          audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
          audioRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
          audioRecorder.setOutputFile("/sdcard/audio.amr");
          try {
              audioRecorder.prepare();
          } catch (IllegalStateException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
          audioRecorder.start();
      }
  });
  audio.start();
  </code></pre>
  
  <p>and I got the container format and codec as AMR as I intended:</p>
  
  <p><img src="https://i.stack.imgur.com/Hbgqr.png" alt="enter image description here"></p>
  
  <p>So, what causes <code>MediaRecorder</code> to record video in 3GP format? I haven't specified 3GP anywhere in my program. I am testing this code on my Samsung Galaxy tab running Android 2.2</p>