在setVideoSize上使用mediarecorder冻结app

时间:2012-07-22 05:38:39

标签: android mediarecorder

我的平板电脑acer a500与android 4.0。

我可以录制视频(目标尺寸:176x144):

_recorder = new MediaRecorder();
camera.unlock();
_recorder.setCamera(camera);
_recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
_recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
_recorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
_recorder.setOutputFile(outputPath);
_recorder.setPreviewDisplay(surface);
_recorder.prepare();

但我希望改变录制视频的大小。

有下一个支持的尺寸:

front
previewSize support size: width = 176 height = 144 aspect = 1,222222
previewSize support size: width = 320 height = 240 aspect = 1,333333
previewSize support size: width = 352 height = 288 aspect = 1,222222
previewSize support size: width = 640 height = 480 aspect = 1,333333
previewSize support size: width = 672 height = 378 aspect = 1,777778
previewSize support size: width = 720 height = 576 aspect = 1,250000
previewSize support size: width = 800 height = 600 aspect = 1,333333
previewSize support size: width = 1280 height = 720 aspect = 1,777778

videSizes support size: width = 176 height = 144 aspect = 1,222222
videoSizes support size: width = 320 height = 240 aspect = 1,333333
videoSizes support size: width = 352 height = 288 aspect = 1,222222
videoSizes support size: width = 640 height = 480 aspect = 1,333333
videoSizes support size: width = 720 height = 576 aspect = 1,250000
videoSizes support size: width = 1280 height = 720 aspect = 1,777778

back

previewSize support size: width = 176 height = 144 aspect = 1,222222
previewSize support size: width = 320 height = 240 aspect = 1,333333
previewSize support size: width = 352 height = 288 aspect = 1,222222
previewSize support size: width = 640 height = 480 aspect = 1,333333
previewSize support size: width = 672 height = 378 aspect = 1,777778
previewSize support size: width = 720 height = 576 aspect = 1,250000
previewSize support size: width = 800 height = 600 aspect = 1,333333
previewSize support size: width = 1280 height = 720 aspect = 1,777778
previewSize support size: width = 1920 height = 1080 aspect = 1,777778

videoSizes support size: width = 176 height = 144 aspect = 1,222222
videoSizes support size: width = 320 height = 240 aspect = 1,333333
videoSizes support size: width = 352 height = 288 aspect = 1,222222
videoSizes support size: width = 640 height = 480 aspect = 1,333333
videoSizes support size: width = 720 height = 576 aspect = 1,250000
videoSizes support size: width = 1280 height = 720 aspect = 1,777778

在_recorder.setOutputFormat之后设置_recorder.setVideoSize(640,480)并且有问题。视频开始写(我看文件3 kb)和应用程序冻结。我尝试不同的尺寸。但只能使用两个:176x144和352x288。

在冻结时,我看到长堆:http://bit.ly/Oa5O0D

请帮助我,知道解决方案。

1 个答案:

答案 0 :(得分:3)

我找到了解决方案:问题将是,因为我使用了视频编码器VideoEncoder.Default。对于宏基默认是h263。如果在MPEG_4_SP或H264上进行更改,则可以使用任何分辨率稳定工作。它仍然需要在没有3.x的设备上进行验证。