0

Following is the code I use to record audio through MIC in .opus format. I'm always getting the error MediaRecorder: start failed: -38. But this will work fine if change the output format and audio encoder to any others like THREE_GPP,MPEG_4 with AAC or AMR. Since I need opus file type I cannot use any other audio formats. Since android has official support on opus over (Android 5.0+) device this should working. Correct me if i'm doing something wrong here.

    mRecorder = new MediaRecorder();
    mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        mRecorder.setOutputFormat(MediaRecorder.OutputFormat.WEBM);
    mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.VORBIS);
    mRecorder.setOutputFile(fileName);
    mRecorder.prepare();
    mRecorder.start();
LvN
  • 701
  • 1
  • 6
  • 22
  • The problem is: MediaRecorder.OutputFormat.WEBM MediaRecorder.AudioEncoder.VORBIS The codec inside Android is only to decode, not to encode. – Aiuspaktyn Feb 07 '19 at 15:27
  • Possible duplicate: https://stackoverflow.com/questions/23971817/mediarecorder-start-failed-38 – verybadalloc May 16 '19 at 22:22

0 Answers0