Android 6.0如何解决mediarecorder音频视频不同步?

时间:2017-04-07 16:25:12

标签: android samsung-mobile mediarecorder

作为标题。是否有任何示例代码可以解决Android 6.0 mediarecorder音频视频录制不同步问题?这是我的代码:

mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.HE_AAC);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
mMediaRecorder.setOutputFile(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)+"/test.mp4");
mMediaRecorder.setVideoSize(mVideoSize.getWidth(), mVideoSize.getHeight());
mMediaRecorder.setVideoFrameRate(30);
mMediaRecorder.setVideoEncodingBitRate(10000000);

WindowManager window = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
int rotation = window.getDefaultDisplay().getRotation();
int orientation = ORIENTATIONS.get(rotation);
mMediaRecorder.setOrientationHint(orientation);
mMediaRecorder.prepare();

0 个答案:

没有答案