如何从MediaRecorder类获取音频帧缓冲区

时间:2018-10-12 08:32:33

标签: android mediarecorder

开始录制后,有什么方法可以获取音频缓冲区,就像使用AudioRecorder类而不是MediaRecoredr类一样。

我正在像下面那样使用MediaRecorder

MediaRecorder recorder = new MediaRecorder();
    recorder.setCamera(mCamera);
    recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    recorder.setVideoEncodingBitRate(bitRate);
    recorder.setVideoSize(screenSize.get(videoResolutionIndex).getWidth(),
            screenSize.get(videoResolutionIndex).getHeight());
    recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
    recorder.setAudioSamplingRate(audioSamplingRate);
    recorder.setOutputFile(videoPath);
    recorder.setOrientationHint(currentViewOrientation);

    try {
        recorder.prepare();
    } catch (IOException e) {
        System.out.println("prepare IOException:" + e);
    }

    recorder.start();

谢谢。

0 个答案:

没有答案