我使用媒体记录器录制音频文件我想减少输出文件的大小或质量如何降低低质量的输出文件大小?
这是我的代码
private MediaRecorder recorder = null;
int audioformat = Integer.parseInt(prefs.getString(Preferences.PREF_AUDIO_FORMAT, "1"));
switch (audioformat) {
case MediaRecorder.OutputFormat.THREE_GPP:
suffix = ".3gpp";
break;
case MediaRecorder.OutputFormat.MPEG_4:
suffix = ".mpg";
break;
case MediaRecorder.OutputFormat.RAW_AMR:
suffix = ".amr";
break;
}
recorder.setAudioSource(audiosource); recorder.setOutputFormat(audioformat); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
recorder.setOutputFile(recording.getAbsolutePath());
使用setProfile()
,选择质量较低的CamcorderProfile
,例如QUALITY_LOW
。