这是我处理它的方式.
boolean settingsSound = sharedPrefSettings.getBoolean("settingsSound", true);
if (!settingsSound) {
mediarecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediarecorder.setVideoFrameRate(profile.videoFrameRate);
mediarecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight);
mediarecorder.setVideoEncodingBitRate(profile.videoBitRate);
mediarecorder.setVideoEncoder(profile.videoCodec);
} else{
mediarecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
mediarecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediarecorder.setVideoFrameRate(profile.videoFrameRate);
mediarecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight);
mediarecorder.setVideoEncodingBitRate(profile.videoBitRate);
mediarecorder.setAudioEncodingBitRate(profile.audioBitRate);
mediarecorder.setAudioChannels(profile.audioChannels);
mediarecorder.setAudioSamplingRate(profile.audioSampleRate);
mediarecorder.setVideoEncoder(profile.videoCodec);
mediarecorder.setAudioEncoder(profile.audioCodec);
}
只是不要设置audiosource.我得到这样的个人资料
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_1080P);
因为没有声音可以设置CamcorderProfile,你需要逐个设置每个值.
希望这会有所帮助:)