1

我在我的代码中实现了一个录像机,它几乎可以在除 HTC One X 之外的所有设备上完美运行。视频记录卡住了(第一个图像没有改变),当我试图打开文件时,我m 收到弹窗“无法播放视频,抱歉无法播放此视频”

这是我的设置

mMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());

    // Use the same frame rate for both, since internally
    // if the frame rate is too large, it can cause camera to become
    // unstable. We need to fix the MediaRecorder to disable the support
    // of setting frame rate for now.
    mMediaRecorder.setVideoFrameRate(mProfile.videoFrameRate);

    //mMediaRecorder.setVideoSize(mVideoWidth, mVideoHeight);
    mMediaRecorder.setVideoSize(640,480); // Works On Note(not on HTC One X)


    mMediaRecorder.setVideoEncodingBitRate(MAXIMAL_PERMITTED_VIDEO_ENCODING_BITRATE);
    // mMediaRecorder.setVideoEncoder(mProfile.videoCodec);
    mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
    // mMediaRecorder.setAudioEncoder(mProfile.audioCodec);
    mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);

谢谢

4

1 回答 1

0

我从这个问题中改编了一些代码How can I capture a video recording on Android? 要录制视频,请将其设置为 640x480,它在我的 AT&T One X 上运行良好: https ://raw.github.com/lnanek/Misc/master/HtcOneXVideoRecord/src/com/htc/sample/videorecord/RecordVideo.java

所以不是 640x480 本身不起作用。您设置的比特率的值是多少?您是否考虑过改用配置文件,这些配置文件是在支持的组合中构建的?例如,您将设置:

mRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH)

这会将分辨率、比特率等设置为有效的值。高品质录音、低品质录音等有各种常数。

于 2012-10-08T02:33:22.453 回答