HelloCW
HelloCW

Reputation: 2295

How can I set VideoEncodingBitRate in android?

I have set mMediaRecorder.setVideoSize.

I hope to get high, medium and low video quality effect via setVideoEncodingBitRate(). What value should I set for high, medium and low quality when I invoke the function setVideoEncodingBitRate() ?

Is recorder.setVideoEncodingBitRate(3000000) high quality? How can the value 3000000 be calculated?

And I don't want to use CamcorderProfile.

BTW, I have read the document How to set the MediaRecorder to get the best video quality effect?

Upvotes: 4

Views: 2005

Answers (1)

Rajan Bhavsar
Rajan Bhavsar

Reputation: 1857

Without profiles:

recorder.setVideoSize(640, 480);
recorder.setVideoFrameRate(16); //might be auto-determined due to lighting

recorder.setVideoEncodingBitRate(3000000);

recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);// MPEG_4_SP

recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

Or if you want to use existing profiles

CamcorderProfile cpHigh = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
recorder.setProfile(cpHigh);

Please note that you cannot have both options together as you will get errors or your prepare will not work

As not all the Android API and/or devices support the same values you will either have to query the maximum values per device or find something that works everywhere.

Upvotes: 2

Related Questions