I use GPUImage to preview. and want to record the original video from camera.
The problem is, once I start recording, the preview will stop.
Preview in GPUImage,
mGPUImage.setUpCamera(camera, orientation, flipHorizontal, false);
it works fine.
Once I start recording, the preview will stop and can't recover even I stoped recording. and has no any exception. and I noticed that GPUImageRenderer.onPreviewFrame isn't called when preview stopped.
private void startRecordVideo(String videoFile) {
if (true) {
// return;
}
if (camera == null) {
Log.e(TAG, "startRecordVideo, camera is not open. file: " + videoFile );
return;
}
if (mRecorder == null) {
mRecorder = new MediaRecorder();
}
try {
mRecorder.reset();
camera.unlock();
mRecorder.setCamera(camera);
mRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
// Set output file format
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
mRecorder.setVideoSize(640, 480);
mRecorder.setVideoFrameRate(30);
mRecorder.setVideoEncodingBitRate(Double.valueOf(1.8 * 1024 * 1024).intValue());
mRecorder.setOrientationHint(90);
mRecorder.setMaxDuration(30 * 1000);
// mRecorder.setPreviewDisplay(cameraSurfaceView);
Log.d(TAG, "record: path " + videoFile);
mRecorder.setOutputFile(videoFile);
mRecorder.prepare();
mRecorder.start();
} catch (Exception e) {
e.printStackTrace();
}
}
I use GPUImage to preview. and want to record the original video from camera.
The problem is, once I start recording, the preview will stop.
Preview in GPUImage,
mGPUImage.setUpCamera(camera, orientation, flipHorizontal, false);
it works fine.
Once I start recording, the preview will stop and can't recover even I stoped recording. and has no any exception. and I noticed that GPUImageRenderer.onPreviewFrame isn't called when preview stopped.