MediaRecorder를 이용해서 AMR 파일을 녹음하려는데 녹음할 때와 녹음된 파일을 MedaiPlayer로 재생할 때 시간이 틀린 이유를 모르겠네요.


녹음할 때는 얼마나 녹음이 되었는지 알 수가 없어서 일단 Handler로 1초마다 Log를 찍도록 했구요
MediaRecorder는 아래와 같이 구현 했습니다.
        audio = new MediaRecorder();
        audio.setAudioSource(MediaRecorder.AudioSource.MIC);
        audio.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
        audio.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        audio.setOutputFile(file.getAbsolutePath());

        try {
         audio.prepare();
        } catch(IOException exception) {
            setError(INTERNAL_ERROR);
            audio.reset();
            audio.release();
            audio = null;
            return;
        }
        audio.start();


MediaPlayer는 File Duration을 확인 할 수 있더라구요.
그래서 MedaiPlayer를 정의하고 Log를 찍어 봤습니다.
        mp = new MediaPlayer();
        
       try {
         mp.setDataSource(file.getAbsolutePath());
         Log.d("AudioTest", "Audio Duration : " + mp.getDuration());
         mp.setOnCompletionListener(this);
         mp.setOnErrorListener(this);
         mp.prepare();
         mp.start();
        } catch (IllegalArgumentException e) {
            setError(INTERNAL_ERROR);
            mp = null;
            return;
        } catch (IOException e) {
            setError(SDCARD_ACCESS_ERROR);
            mp = null;
            return;
        }

문제는 MediaRecorder로 녹음은 할 때 Handler는 3~4초 밖에 동작하지 않았는데
MediaPlayer로 재생할 때 Duration는 무려 6~8초로 두 배정도 차이가 나더라구요.

왜 그런걸 까요?