尝试这样的事情
getBestPreviewSize () 将根据提供的宽度和高度确定可能的最佳分辨率。显然缺少主要的媒体记录器和摄像机设置详细信息,但您可以很容易地找到它们,而且您可能已经这样做了
...
Camera.size size = getBestPreviewSize(720,480, mCamera.getParameters());
mMediaRecorder.setVideoSize(size.width,size.height);
mMediaRecorder.setVideoFrameRate(15);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
...
private Camera.Size getBestPreviewSize(int width, int height, Camera.Parameters parameters) {
Camera.Size result=null;
for (Camera.Size size : parameters.getSupportedPreviewSizes()) {
if (size.width<=width && size.height<=height) {
if (result==null) {
result=size;
} else {
int resultArea=result.width*result.height;
int newArea=size.width*size.height;
if (newArea>resultArea) {
result=size;
}
}
}
}
return(result);
}