android camera2 api - 一起录制视频声音和麦克风
android camera2 api - recording video sound and mic together
我正在尝试通过 camera2 api 在观看视频时自拍。
我要录视频配乐,用MIC音源录surface
我如何创建两个轨道,第一个用于呈现给用户的视频,第二个用于 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();
}
在 android mediaRecorder 中,您不能同时录制两个 AudioSources。
here is the MediaRecorder.AudioSource guide
您的解决方案是使用第二个 AudioSource 重新渲染视频。
尝试 this answer with FFmpeg
我正在尝试通过 camera2 api 在观看视频时自拍。 我要录视频配乐,用MIC音源录surface
我如何创建两个轨道,第一个用于呈现给用户的视频,第二个用于 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();
}
在 android mediaRecorder 中,您不能同时录制两个 AudioSources。 here is the MediaRecorder.AudioSource guide
您的解决方案是使用第二个 AudioSource 重新渲染视频。 尝试 this answer with FFmpeg