0

它正在运行和录制视频 3 到 4 分钟。稍后它会停止视频录制。在日志文件中显示。媒体服务器死机,相机死机,错误 100。

录像机、CamcorderProfile 设置有问题。

我正在使用 Android 模拟器和 Nexus 7 AVD,

视频设置如下:

private void StartVideoRecording(Camera videoCamera){

videoRecorder = new MediaRecorder();
videoRecorder.setCamera(videoCamera);               
videoRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);

videoRecorder.setOutputFormat(cameraProfile.fileFormat); // look at ARTPWriter.cpp     //   videoRecorder.setOutputFormat(1); // look at ARTPWriter.cpp

videoRecorder.setVideoEncoder(cameraProfile.videoCodec);

videoRecorder.setVideoFrameRate(cameraProfile.videoFrameRate);
videoRecorder.setVideoSize(cameraProfile.videoFrameWidth, cameraProfile.videoFrameHeight);
videoRecorder.setVideoEncodingBitRate(cameraProfile.videoBitRate);

videoRecorder.setOutputFile("/mnt/sdcard/.Y3KVideo"); // File not used, but is needed for prepare to succeed.

videoRecorder.setPreviewDisplay(cameraViewSurfaceHolder.getSurface());
videoRecorder.setOrientationHint(90);

try {
    videoRecorder.prepare();
} catch (IllegalStateException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
videoRecorder.start();  
}

CamcorderProflie 设置:

private void configureCameraProfile() {
    cameraProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
    cameraProfile.videoCodec = MediaRecorder.VideoEncoder.H264;
    // cameraProfile.fileFormat = MediaRecorder.OutputFormat.THREE_GPP;
    cameraProfile.fileFormat = 7; // RTP
    cameraProfile.videoFrameWidth = 176; // QCIF PAL
    cameraProfile.videoFrameHeight = 144;
    cameraProfile.videoBitRate = 128000;
    cameraProfile.videoFrameRate = 15;  //15

    Log.i(TAG, " bitrate=" + cameraProfile.videoBitRate + ",width=" + cameraProfile.videoFrameWidth + ",height=" + cameraProfile.videoFrameHeight);

}
4

1 回答 1

0

媒体记录器可以在模拟器中工作。

但是您提供的设置是错误的。

请验证此链接

http://developer.android.com/reference/android/media/MediaRecorder.html

并相应地配置设置。

于 2014-07-05T09:41:30.740 回答