Open 101zayed opened 8 years ago
After some trial and error, I found out the problem is the mute function. I commented it because I thought i dont really need it and it fixed it. Below is the culprit. Happy coding
if (muteAudioEffect != null) {
capture.addAudioEffect(muteAudioEffect);
}
Hi, all. Hope helpful.
CameraCaptureActivity.java
private void configureMediaStreamFormat() {
org.m4m.VideoFormat videoFormat = new VideoFormatAndroid("video/avc", encodedResolution.width(), encodedResolution.height());
videoFormat.setVideoBitRateInKBytes(3000);
videoFormat.setVideoFrameRate(25);
videoFormat.setVideoIFrameInterval(1);
capture.setTargetVideoFormat(videoFormat);
if (recordAudio) {
org.m4m.AudioFormat audioFormat = new AudioFormatAndroid("audio/mp4a-latm", 44100, 1);
capture.setTargetAudioFormat(audioFormat);
//if (muteAudioEffect != null) {
// capture.addAudioEffect(muteAudioEffect);
//}
}
}
I compiled the samples application and I tried Capturing --> Camera Capturing in the samples application and it recorded the video just fine with audio. The only issue is that the audio plays I think 3x the speed and video too. When I put the video on the laptop and open it using VLC, the video plays with audio just fine but the audio is produced with static on intervals of 0.5 secs. When I open it using windows media player, the video and audio are in sync but still plays too fast.
I tried changing configureMediaStreamFormat() settings but it never works other than what is set originally.
What I found out later on is that if i disable audio recording in the application and record video only, the playback speed is normal. With "Record Audio" enabled the video and audio becomes 2x or 3x the speed.
It seems the problem is with audio recording. Any ideas?
Device: Samsung note 5 and Samsung s5