http://blog.163.com/chongyang198799@126/blog/static/7124702820149923539326/
/***********原来的写法************/
//next codes is right for 2.3 and 4.0
mMediaRecorder=new MediaRecorder();
//设置视频源
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
//设置音频源
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
//设置文件输出格式
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
//设置视频编码方式
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
//相机参数配置类
// CamcorderProfile cProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
// mMediaRecorder.setProfile(cProfile);
//设置视频编码帧率
mMediaRecorder.setVideoEncodingBitRate(5*1920*1080);
//设置音频编码方式
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
//设置视频高和宽,注意文档的说明:
Must be called after setVideoSource().
//设置录制的视频帧率,注意文档的说明:
mMediaRecorder.setVideoFrameRate(30);
//设置输出路径
mMediaRecorder.setOutputFile("/sdcard/Document/data/"+ currentTemp + "/"
+ currentXml + "/"+System.currentTimeMillis()+".mp4");
//设置预览画面
mMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
mSurfaceHolder.setFixedSize(640,480);//最高只能设置640x480
mMediaRecorder.setVideoSize(640,480);//最高只能设置640x480
//设置视频的最大持续时间
mMediaRecorder.setMaxDuration(30000);
/***********调整后的写法************/
//next codes is right for 2.3 and 4.0
mMediaRecorder=new MediaRecorder();
//设置视频源
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
//设置音频源
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
//相机参数配置类
CamcorderProfile cProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
mMediaRecorder.setProfile(cProfile);
//设置录制的视频帧率,注意文档的说明:
mMediaRecorder.setVideoFrameRate(30);
//设置输出路径
mMediaRecorder.setOutputFile("/sdcard/Document/data/"+ currentTemp + "/"
+ currentXml + "/"+System.currentTimeMillis()+".mp4");
//设置预览画面
mMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
/************************/
说明,上面一个写法录像的时候就是模糊的,下面的那个写法就是清晰的,下面的写法设置了相机参数,不用再像上面那样设置分辨率之类的。大家可以试一下,我也没弄懂什么原因。