3~4Mintsの走行&録画動画です。その後、ビデオ録画を停止します。ログファイルに表示されます。メディア サーバーの停止、カメラの停止、エラー 100。
videorecorder、CamcorderProfile の設定に問題があります。
Android Emulator と 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);
}