Video recording

All your problems with Audio, Video and Images.

Video recording

Postby cassiere82 » Thu Aug 06, 2009 10:51 am

Hi all,

I'm trying to develop an application which records audio and video on a file. As far as I use only audio recording, it is good. When I try to add the video part, I get an error on the prepare() method.

Below you can find an excerpt of the code...

private void setStreaming() throws IOException {
// Creating a MediaRecorder object
mr = new MediaRecorder();
mr.setCamera(Camera.open());
// Configuring audio/video source (MIC and camera)
mr.setAudioSource(MediaRecorder.AudioSource.MIC);
//mr.setCamera(Camera.open());
mr.setVideoSource(MediaRecorder.VideoSource.DEFAULT);

// Configuring the output format
mr.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
// Configuring audio/video codecs
mr.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mr.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
// Setting the output file
if (audiofile == null) {
File sampleDir = Environment.getExternalStorageDirectory();
try
{
audiofile = File.createTempFile("moca", ".mp4", sampleDir);
}
catch (IOException e)
{
Log.e("ERROR","sdcard access error");
return;
}
}
mr.setOutputFile(audiofile.getAbsolutePath());
// the recorder is ready to register

mr.prepare();
mr.start();
}


In the first version, I tried it without the mr.setCamera(Camera.open()); instruction, but then I got an error in the logcat

E/CameraInput( 554): Camera is not available

then I tried to add the instruction, but I got another error

D/CameraService( 554): Connect E from ICameraClient 0x2d198
D/CameraService( 554): new client (0x2d198) attempting to connect - rejected


Any suggestions??
Thks
Bye
cassiere82
Freshman
Freshman
 
Posts: 3
Joined: Tue Aug 04, 2009 3:20 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 14 guests