Ittai Oren
Ittai Oren

Reputation: 53

android camera2 api - recording video sound and mic together

I'm trying to record my self via camera2 api while watching a video. I want to record the video soundtrack and record the surface with the MIC audio source.

How can i create two tracks, first for the video thats presented to the user and second for the mediaRecorder AudioSource.MIC

private void setupMediaRecorder() throws  IOException{
    mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
    mMediaRecorder.setAudioChannels(2);
    mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
    mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
    mMediaRecorder.prepare();
}

Upvotes: 1

Views: 1151

Answers (1)

Ittai Oren
Ittai Oren

Reputation: 542

In android mediaRecorder you can not record two AudioSources together. here is the MediaRecorder.AudioSource guide

Your solution is to re-render the video agin with the second AudioSource. try this answer with FFmpeg

Upvotes: 1

Related Questions