问题描述
我想视频录制功能添加到Android中使用MediaRecorder我的应用程序,但由此产生的视频看起来腐败的绿线(音频是罚款)。下面code是我用来初始化MediaRecorder对象:
I'm trying to add video recording capability to my app using MediaRecorder in Android, but the resulting video looks corrupt with green lines (audio is fine). The following code is what I use to initialize the MediaRecorder object:
mMediaRecorder = new MediaRecorder();
mCamera.unlock();
mMediaRecorder.setCamera(mCamera);
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mMediaRecorder.setOutputFile(Utility.CAPTURE_VIDEO_FILENAME);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
mMediaRecorder.setMaxDuration(60000);
mMediaRecorder.setVideoFrameRate(20);
mMediaRecorder.setMaxFileSize(5000000);
mMediaRecorder.setVideoSize(352, 288);
mMediaRecorder.setPreviewDisplay(mPreview.mHolder.getSurface());
mMediaRecorder.prepare();
mMediaRecorder.start();
我已经看了建议here和此处,但他们似乎并没有帮助我的事业。然而,我认为,它可能有一些做不正确的视频大小。所以我的问题是:有没有什么好的办法使用API 7级时获得兼容的视频尺寸?据我可以告诉我可以用CamcorderProfile如果我在API 8级,但没有在7。
I've already looked at the suggestions here and here, but they don't seem to help my cause. I do think, however, that it might have something to do with incorrect video size. So my question is this: is there any good way to get compatible video sizes when using API level 7? As far as I can tell I can use CamcorderProfile if I'm in API level 8, but nothing in 7.
推荐答案
检查code为setRecordingHint(真);
Check your code for the setRecordingHint(true);
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setRecordingHint(boolean)
此参数的设置会导致此故障的绿色在视频上少数设备。
The setting of this parameter cause this green glitches in the video on few devices.
这篇关于Android的MediaRecorder生产与绿线花屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!