Video display is garbled when recording on Galaxy S3

让人想犯罪 __ 提交于 2019-12-04 07:31:01

I had a similar problem, and finally figured out it was due to sharing the preview surface between the camera and the media recorder (I'm not sure this is actually the underlying cause, but from the API calls it appears that way).

I'm assuming you have already opened the camera and attached a preview display to it, if so try inserting the following lines at the top of your prepareRecorder method:

Camera camera = getCamera();
camera.stopPreview();
camera.lock();
camera.release();

camera = Camera.open();
camera.unlock();

You might also need to reassign the camera local to the field hidden behind getCamera(), unfortunately I can't tell how you've implemented it with the given code snippet.

Hope this helps.

I had a similar problem with an Samsung Note. My problem was that the preview was set in a resolution, and the recording was set in another bigger resolution (resolution which was not supported by my phone), and this is why it looked like that. You should try:

recorder.setVideoSize(320, 240);

If it works, then it means your initial resolution was not supported/

This is because preview resolution and Mediarecorder resolutions are different (and they can be different depending on the device, but on some devices it seems to cause an issue).

Check the Android camera app, it does not stop the preview and then start recording (you can check this by keeping the flash on, if you stop the preview and then start recording the flash will turn off and then on again, whereas in the Android camera app that does not happen).

The "accepted" answer here only works because the camera releases the preview surface and mediarecorder can then adjust the resolution to one of the mediarecorder resolutions, but it is not technically correct.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!