I have found so far that MPEG_4 and THREE_GPP work as formats. OGG does not work at all. THREE_GPP fails with AMR_WB (wide band). "Does not work" / "fails" means my app crashes in the start() function from the code fragment below, as shown by LogCat from the Studio.
private fun startRecording() {
recorder = MediaRecorder().apply {
setAudioSource(MediaRecorder.AudioSource.MIC)
setOutputFormat(MediaRecorder.OutputFormat.MPEG_4) //OGG fails
setOutputFile(fileName)
setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT) // VORBIS fails with format OGG
try {
prepare()
} catch (e: IOException) {
Log.e(LOG_TAG, "prepare() failed")
}
start() // failures occur here
}
}
Any recommendations would be appreciated. Please note the speech in the audio stream will need to be converted to text on the Android device.
I have found so far that MPEG_4 and THREE_GPP work as formats. OGG does not work at all. THREE_GPP fails with AMR_WB (wide band). "Does not work" / "fails" means my app crashes in the start() function from the code fragment below, as shown by LogCat from the Studio.
private fun startRecording() {
recorder = MediaRecorder().apply {
setAudioSource(MediaRecorder.AudioSource.MIC)
setOutputFormat(MediaRecorder.OutputFormat.MPEG_4) //OGG fails
setOutputFile(fileName)
setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT) // VORBIS fails with format OGG
try {
prepare()
} catch (e: IOException) {
Log.e(LOG_TAG, "prepare() failed")
}
start() // failures occur here
}
}
Any recommendations would be appreciated. Please note the speech in the audio stream will need to be converted to text on the Android device.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.