我正在使用自定义媒体录制器类录制并录制视频某些设备工作正常但有些设备创建0长度视频。我不知道什么是MediaRecording配置问题。
Camera mcamera
mCamera.unlock();
mrec.setCamera(mCamera);
mrec.setPreviewDisplay(surfaceHolder.getSurface());
mrec.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mrec.setAudioSource(MediaRecorder.AudioSource.MIC);
if (cameraID != -1) {
mrec.setProfile(CamcorderProfile.get(cameraID,
CamcorderProfile.QUALITY_HIGH));
} else {
mrec.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
}
mrec.setPreviewDisplay(surfaceHolder.getSurface());
mrec.setOutputFile(filename);
Plz提前帮助谢谢。
我也检查了hasprofile方式
CamcorderProfile profile = null;
if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_1080P))
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_1080P);
else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_720P))
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_720P);
else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_480P))
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_480P);
else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_HIGH))
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
if (cameraID != -1) {
mrec.setProfile(profile);
}
但这样在问题startunlock中遇到问题就失败了。
答案 0 :(得分:0)
我很确定你必须将这些行换成:
mrec.setOutputFile(filename);
mrec.setPreviewDisplay(surfaceHolder.getSurface());
现在,它会起作用吗?让我知道!