Johann
Johann

Reputation: 29877

Android: Modifying recorded video quality

I'm using MediaRecorder to record a video. It isn't clear to me what parameters I should be using to change the quality of the image, assuming the size of the video remains constant. For example, I want to always create a 640x480 mp4 video. What parameters can I adjust to increase or decrease the quality?

Upvotes: 4

Views: 6153

Answers (3)

chandrubalan
chandrubalan

Reputation: 1

You have to increase video encoding bit rate to increase the video quality using setVideoEncodingBitRate() in MediaRecorder.

mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);

mRecorder.setVideoEncodingBitRate(4000000);`

Upvotes: 0

Raja Asthana
Raja Asthana

Reputation: 2100

You can try using

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

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

For setting high quality and low quality parameter see here

Upvotes: 6

SubbaReddy PolamReddy
SubbaReddy PolamReddy

Reputation: 2113

try this one u can solve problem

mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT); 
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);

String path = Environment.getExternalStorageDirectory() + "/file.mp4";
mediaRecorder.setOutputFile(path);

Upvotes: 0

Related Questions