我尝试使用以下代码,但与Google Play商店中的其他应用相比,我的质量非常差。有什么建议吗?
private void initRecorder(final String path) {
videoFile = path;
try {
// Solves a -9 return bug in some Android versions
camera.lock();
camera.unlock();
recorder.setCamera(camera);
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setProfile(CamcorderProfile.get(0, CamcorderProfile.QUALITY_1080P));
recorder.setPreviewDisplay(holder.getSurface());
recorder.setOutputFile(videoFile);
recorder.setMaxDuration((int) TimeUnit.HOURS.toMillis(2));
recorder.prepare();
} catch (IllegalStateException e) {
e.printStackTrace();
showDialog(NO_VIDEO);
} catch (IOException e) {
e.printStackTrace();
showDialog(NO_VIDEO);
}
catch (Exception e){
e.printStackTrace();
showDialog(NO_VIDEO);
}
}
recorder.reset();
recorder.setCamera(camera);
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
// recorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
recorder.setPreviewDisplay(holder.getSurface());
recorder.setOutputFile(videoFile);
但是当我使用recorder.start()