2011-09-09 5 views
2

어떻게 오디오 파일을 .m4a 형식으로 녹음 할 수 있습니까? 당신이 당신의 예에서 출력 형식을 설정할 경우오디오 파일을 .m4a 형식으로 녹음하려면 어떻게해야합니까?

public void startRecording() throws IOException { 

    recorder = new MediaRecorder(); 

    path = "/sdcard/pithysongs_" + System.currentTimeMillis() + ".m4a"; 

    String state = android.os.Environment.getExternalStorageState(); 

    if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) { 
     throw new IOException("SD Card is not mounted. It is " + state 
       + "."); 
    } 

    recorder.setAudioSource(MediaRecorder.AudioSource.MIC); 
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); 
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); 
    recorder.setOutputFile(path); 
    recorder.prepare(); 
    recorder.start(); 
    } 

덕분에 ..

다음

답변

6

입니다 : 내가 아래의 코드를 사용하고

recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); 

here는 목록입니다 다음을 포함하는 사용 가능한 출력 형식 :

AMR_WB AMR WB file format 
DEFAULT  
MPEG_4 MPEG4 media file format 
RAW_AMR  AMR NB file format 
THREE_GPP 3GPP media file format 
,210

이곳은 MPEG-4 오디오 (M4A)를 지원 그래서 당신이 선택해야하는 가정 과 같은 지원되는 형식에 대한 more informationMediaRecorder.OutputFormat.MPEG_4

관련 문제