1
我通過錄製音頻MediaRecorder和問題是:用AAC編碼器錄音?
當我使用AMR_NB編碼器,getDuration()返回正確的值,但是,當我使用 AAC編碼器另一方面它給增加getDuration值(即,如果我記錄5秒的音頻它給出40秒和播放40秒)
代碼來記錄音頻文件
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
recorder.setOutputFile(filePath);
recorder.prepare();
recorder.start();
代碼播放錄音:
mp.setDataSource(audioPath);
mp.prepare();
Log.e("duration of record"," " +mp.getDuration());
mp.start();
plaese提供一些指導.. 感謝..
它看起來像記錄的文件是40秒。將其傳輸到PC並查看實際持續時間。 – Reno
如何在沒有MediaRecorder的情況下做到這一點?假設我已經有了原始輸入流。 – 4ntoine