how to record rightly 720p video in android? And how to set correctly the frame rate of video for it.
mParameters = mCameraDevice.getParameters();
mParameters.setPreviewSize(1280,
720);
mParameters.setPreviewFrameRate(30);
mMediaRecorder = new MediaRecorder();
// Unlock the camera object before passing it to media recorder.
mCameraDevice.unlock();
mMediaRecorder.setCamera(mCameraDevice);
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
//mMediaRecorder.setProfile(mProfile);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
mMediaRecorder.setMaxDuration(mMaxVideoDurationInMs);
// Set output file.
if (mStorageStatus != STORAGE_STATUS_OK) {
mMediaRecorder.setOutputFile("/dev/null");
} else {
// Try Uri in the intent first. If it doesn't exist, use our own
// instead.
createVideoPath();
mMediaRecorder.setOutputFile(mVideoFilename);
}
mMediaRecorder.setVideoSize(1280, 720);
mMediaRecorder.setVideoFrameRate(30);
mMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
I test this code in HTC HD device. It can record successfully. But when play the recorded video, the screen is just green with sound. Who can give some explain the relation between video size and video frame rate and the difference of all kinds of video(audio) source and encoder.