I'm am capturing a video from the Android camera. However, I would like to set the frame rate to 1 frame per second.
If I add the setVideoFrameRate(1)
, then the video cannot be recorded properly. If I don't set this value, recording works correctly.
This is my code...
mediaRecorder = new MediaRecorder();
mediaRecorder.setCamera(camera);
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediaRecorder.setOutputFile(GetOutputMediaFileDir(VIDEO_TYPE,intVideoIndex));
mediaRecorder.setVideoSize(640,480);
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
// mediaRecorder.setCaptureRate(1);
mediaRecorder.setVideoFrameRate(1);
mediaRecorder.setMaxDuration(10000);
mediaRecorder.setOnInfoListener(this);
mediaRecorder.setPreviewDisplay(surfaceView.getHolder().getSurface());
mediaRecorder.prepare();
mediaRecorder.start();
Basically I need to reduce the size of video since I have to send it on a phone which may be using 3G network. The longest video will be 1 minute so it will take a long time to send the video.
Could someone please help me with this problem.
20 - 24 frames per second is the absolute minimum for a video to maintain any sort of quality. 1 Frame per second is not supported because it would be more of a slideshow. Also, the sound associated with the video would not be able to sync correctly.