【问题标题】:Media recorder reduce output file size媒体记录器减少输出文件大小
【发布时间】:2016-04-07 08:29:53
【问题描述】:

我使用媒体录音机录制音频文件 我想减少输出文件的大小或质量 如何减少低质量的输出文件大小?

这是我的代码

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());

【问题讨论】:

标签: android mediarecorder


【解决方案1】:

Use setProfile(),选择质量较低的CamcorderProfile,如QUALITY_LOW

【讨论】:

  • 我试试这个 recorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_LOW));但输出文件大小为 0,0 kb
  • 错在哪里?
猜你喜欢
  • 2021-07-01
  • 1970-01-01
  • 2017-05-05
  • 2016-02-14
  • 2013-07-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多