为什么可用的尺寸不同

时间:2012-12-19 22:54:56

标签: size android-camera android-mediarecorder

同样,我真的不知道如何用这句话来表达,所以我会解释一下。

我有一个录像机应用程序。我用

打开相机
cameraRecorder = Camera.open(1); //(this is the front facing camera)

获取相机参数和所有支持的预览尺寸

CameraParameters tmpParams = cameraRecorder.getParameters();

List<Camera.Size> tmpList = tmpParams.getSupportedPreviewSizes();

运行ICS(4.0.4)的Galaxy Tab 10.1上的预览尺寸之一是800x600

但是当我尝试在媒体播放器中设置视频大小时

mediaRecorder.setVideoSize(800,600);

我收到此错误:

12-19 17:27:55.035: E/CameraSource(110): Video dimension (800x600) is unsupported
12-19 17:27:55.035: E/StagefrightRecorder(110): cameraSource do not init
12-19 17:27:55.035: E/StagefrightRecorder(110): setupCameraSource failed. (-19)
12-19 17:27:55.035: E/StagefrightRecorder(110): setupMediaSource is failed. (-19)
12-19 17:27:55.035: E/StagefrightRecorder(110): setupMPEG4Recording is failed. (-19)
12-19 17:27:55.035: E/MediaRecorder(30119): start failed: -19

有谁知道为什么会出现这种差异(我知道其中一个支持的记录大小是1280x720,但这对我来说太大了。)

1 个答案:

答案 0 :(得分:3)

那是因为预览和录制不同。您应该使用Camera.Parameters.getSupportedVideoSizes()中指定的尺寸。

public List<Camera.Size> getSupportedVideoSizes ()
Gets the supported video frame sizes that can be used by MediaRecorder.