Change camera recording codec programmatically in Android

  • Replies:3
Tina J
  • 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
Reply
James Watson
  • Forum posts: 1,584

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

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

https://developer.android.com/reference/android/media/MediaRecorder.html

Download size < 0.15 MB. But also accurate enough, ad-free & free.
The minimalist app available on Play Store: https://goo.gl/ws42fN
Blog: https://okblackcafe.blogspot.com Your 5-star is appreciated.

Helpful?
Reply
Design Alpha
  • Forum posts: 5

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

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

Helpful?
Reply
Robinson Anderson
  • Forum posts: 8

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.

Helpful?
Reply