11

I use the Intent MediaStore.ACTION_VIDEO_CAPTURE video recording method.

By default, the recorded video is stored as a .3gp file. I want to record and store the video as a .mp4 file.

Is this possible?.

Joshua Pinter
  • 45,245
  • 23
  • 243
  • 245
Karthi
  • 13,624
  • 10
  • 53
  • 76

2 Answers2

7

Yes

Set the MediaRecorder's OutputFormat to MPEG_4, like so:

recorder = new MediaRecorder(); 
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);

This other SO answer describes it perfectly, as well.

Community
  • 1
  • 1
Joshua Pinter
  • 45,245
  • 23
  • 243
  • 245
  • This is assuming you're using the MediaRecorder directly. Karthi seems to be using an Intent. – Drazen Bjelovuk May 09 '14 at 14:14
  • 2
    @JoshBjelovuk You're right, Josh. To use the `OutputFormat` you'll need to work with the `MediaRecorder()` directly. Using an `Intent`, could you not just pass the `.mp4` file extension in the `putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(temp_file_with_mp4_extension));`? – Joshua Pinter May 09 '14 at 18:55
  • Does the MediaRecorder infer the video format from the file extension? I was unaware of this. – Drazen Bjelovuk May 09 '14 at 19:11
3

Yes, you can have an mp4 output format, mp4 is just a container : see this to know what kind of data streams you can store in it.

MPEG_4  MPEG4 media file format

Also refer to this

Community
  • 1
  • 1
Reno
  • 33,594
  • 11
  • 89
  • 102