0
這似乎是一個愚蠢的問題,我一直在這一整晚都在努力,無法從我的手機上錄製一個webm視頻。在android mediarecorder設置或camprofile調整中錄製Webm格式?
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.WEBM);
//mMediaRecorder.setOutputFormat(outFormat);
//CamcorderProfile camPro = CamcorderProfile.get(CamcorderProfile.QUALITY_TIME_LAPSE_480P);
//camPro.fileFormat = MediaRecorder.OutputFormat.WEBM;
//camPro.videoFrameRate = 30;
mMediaRecorder.setCaptureRate(30f);
//camPro.videoFrameWidth = 360;
//camPro.videoFrameHeight = 640;
//camPro.videoBitRate = 2000000;
//camPro.audioCodec = MediaRecorder.AudioEncoder.VORBIS;
mMediaRecorder.setVideoSize(640,360);
mMediaRecorder.setVideoEncodingBitRate(2000000);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.VORBIS);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.VP8);
//camPro.videoCodec = MediaRecorder.VideoEncoder.VP8;
mMediaRecorder.setVideoFrameRate(30);
//mMediaRecorder.setProfile(camPro);
我已經評論了攝像機配置文件行,因爲我認爲只有一個必須使用。我還看到一個說法,說API級別21是必需的,所以我在我的棒棒糖5.0.2的摩托車G上。
我得到的錯誤是攝像機死了錯誤100. 有時媒體recorder.prepare()發生,但然後media recorder.start()拋出一個錯誤。 我很困惑應該做些什麼。一旦我沒有錯誤。但我只有6.19KB的文件無法播放。