Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
370 views
in Technique[技术] by (71.8m points)

java - How to set the MediaRecorder to get the best video quality effect?

Guys can someone tell me how should I set the parameters in the MediaRecorder in order to get the best video recording effect possible through coding without considering the physical limitation of the phone? Or is there any effect of the view small distortion caused by my coding of the MediaRecorder?

If some of you might be guessing of the unclear parameters I'm actually setting some of the parameters using preferences. What are the parameters I miss which might help to improve the video encoding process Ex: framerate

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Depending on the API level you may want to use existing profiles or not.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...