Skip to content

Instantly share code, notes, and snippets.

@guinetik
Created July 21, 2013 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guinetik/6050146 to your computer and use it in GitHub Desktop.
Save guinetik/6050146 to your computer and use it in GitHub Desktop.
ffmpeg record audio
while (isAudioRecording) {
bufferReadResult = audioRecord.read(audioData, 0, audioData.length);
if (bufferReadResult == 1024 && isRecorderStart) {
Buffer[] realAudioData1024 = new Buffer[bufferReadResult];
System.arraycopy(audioData, 0, realAudioData1024, 0, bufferReadResult);
recorder.record(yuvIplimage);
recorder.record(realAudioData1024);
Log.d(LOG_TAG, "recorder.record(): bufferReadResult == 1024");
} else if (bufferReadResult == 2048 && isRecorderStart) {
Buffer[] realAudioData2048_1 = new Buffer[1024];
Buffer[] realAudioData2048_2 = new Buffer[1024];
System.arraycopy(audioData, 0, realAudioData2048_1, 0, 1024);
System.arraycopy(audioData, 1024, realAudioData2048_2, 0, 1024);
for (int i = 0; i < 2; i++) {
if (i == 0) {
recorder.record(yuvIplimage);
recorder.record(realAudioData2048_1);
} else if (i == 1) {
recorder.record(yuvIplimage);
recorder.record(realAudioData2048_2);
}
}
Log.d(LOG_TAG, "recorder.record(): bufferReadResult == 2048");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment