There is a alternate way, how i am doing the same, may help you:
For taking picture:
init camera and set onPictureTaken method.
Camera camera = Camera.open();
if(camera != null)
{
camera.takePicture(null, null, jpeg);
}
now implement Camera.PictureCallback with name "jpeg", in which you will get captured image in JPEG format
set desired image format in onSurfaceChanged method
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h)
{
if (holder != null && camera != null)
{
camera.stopPreview();
Camera.Parameters parameters = camera.getParameters();
parameters.setPictureFormat(PixelFormat.JPEG);
camera.setParameters(parameters);
camera.setPreviewDisplay(holder);
camera.startPreview();
}
}
For Recording video
init camera.
Camera camera = Camera.open();
init Media recorder and set desired video format on recorder
if ( camera != null)
{
try{
camera.stopPreview();
MediaRecorder recorder = new MediaRecorder();
recorder.setCamera(camera);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.prepare();
}
Source: for Take picture, for Record video