Change camera recording codec programmatically in Android

  • Replies:4
  • Forum posts: 1

Dec 13, 2021, 9:33:13 PM via Website

I'm using the following code to record the camera in Android. How can I change the default codec (the default is H264) here?

Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the file
  • Forum posts: 1,467

Dec 14, 2021, 10:32:26 AM via Website

I think you may check the official documents about MediaRecorder class and MediaRecorder.VideoEncoder class.

Download size < 0.08 MB. But also Ad-free, Pure & Accurate enough.
The minimalist app is available on Google Play
Your 5-star is appreciated. Blog:

  • Forum posts: 5

Dec 14, 2021, 11:55:21 AM via Website

Ok, Thank you for this information, I will check.

  • Forum posts: 13

Dec 15, 2021, 9:49:01 AM via Website

Directly controlling a device camera requires a lot more code than requesting pictures or videos from existing camera applications. However, if you want to build a specialized camera application or something fully integrated into your app UI, this lesson shows you how.

  • Forum posts: 38

Dec 16, 2021, 10:58:16 AM via Website

Did you solve your problem?