AudioRecord 文件大小有点大

AudioRecord file size is a little large

我正在为此苦苦挣扎,我更改了比特率以减小录音文件大小,我的应用程序正确地将音频文件发布到服务器,但我想最小化文件大小,这是我的录音代码

 private void startRecording() throws IOException {

        String state = android.os.Environment.getExternalStorageState();
        if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) {
            throw new IOException("No SD mounted.  It is" + state
                    + ".");

        }

        mRecorder = new MediaRecorder();
        mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        mRecorder.setAudioSamplingRate(44100);
        mRecorder.setAudioEncodingBitRate(44100);
        mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);


        File path = new File(Environment.getExternalStorageDirectory()
                .getPath());

        if (!path.exists() && !path.mkdirs()) {
            throw new IOException("The file directory is invalid.");
        }else{

            try {
                archivo = File.createTempFile("audio", ".3gp", path);
            } catch (IOException e) {
            }

        }

        mRecorder.setOutputFile(archivo.getAbsolutePath());
        mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);


        try {
            mRecorder.prepare();
        } catch (IOException e) {
            Log.e(LOG_TAG, "prepare() failed");
        }

        mRecorder.start();


    }

I am getting like 336 kb for 1 minute recording right now, I want to decrease it to around 100 - 200 kb per minute without loosing too much quality

您可以尝试一些事情。

1) 使用 AMR(自适应多速率)进行更高压缩:

recorder.setAudioEncoder(mRecorder.AudioEncoder.AMR_NB);

A​​MR Wideband 和AMR Narrowband 是设备用于电话呼叫的编码方法。可能没有您需要的质量。

2) 使用单声道 1 声道:

mRecorder.setAudioChannels (1)

// Sets the number of audio channels for recording. Call this method before 
// prepare().
// Usually it is either 1 (mono) or 2 (stereo).