prepare() fails when trying to record video

by Magnus » Fri, 04 Sep 2009 22:38:30 GMT


Sponsored Links
 i, tried to make a simple camcorder application based on the
VideoCamera in the default apps. My main problem is that the prepare()
call always fail.
I am pretty sure I set all the settings in the MediaRecorder correctly
and in the right order.
..
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
recorder.setOutputFile("/sdcard/video_test.mp4");
..
when surface is created i do:
recorder.setPreviewDisplay(holder.getSurface());
if (recorder != null) {
try {
recorder.prepare();
} catch (IllegalStateException e) {
Log.e("IllegalStateException", e.toString(), e);
} catch (IOException e) {
Log.e("IOException", e.toString(), e);
}
}

However, the prepare always fail. When I view logcat I see the
following error:
E/MediaRecorder( 222): prepare failed: -2147483648

E/IOException( 223): java.io.IOException: prepare failed.
E/IOException( 223): java.io.IOException: prepare failed.
E/IOException( 223): at android.media.MediaRecorder._prepare(Native
Method)
E/IOException( 223): at android.media.MediaRecorder.prepare
(MediaRecorder.java:375)
E/IOException( 223): at
com.mycompany.CamcorderPreview.surfaceCreated(CamcorderPreview.java:
41)
E/IOException( 223): at android.view.SurfaceView.updateWindow
(SurfaceView.java:352)
E/IOException( 223): at android.view.SurfaceView.dispatchDraw
(SurfaceView.java:259)
E/IOException( 223): at android.view.ViewGroup.drawChild
(ViewGroup.java:1484)
E/IOException( 223): at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1228)
E/IOException( 223): at android.view.ViewGroup.drawChild
(ViewGroup.java:1484)
E/IOException( 223): at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1228)
E/IOException( 223): at android.view.View.draw(View.java:5841)
E/IOException( 223): at android.widget.FrameLayout.draw
(FrameLayout.java:352)
E/IOException( 223): at android.view.ViewGroup.drawChild
(ViewGroup.java:1486)
E/IOException( 223): at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1228)
E/IOException( 223): at android.view.View.draw(View.java:5841)
E/IOException( 223): at android.widget.FrameLayout.draw
(FrameLayout.java:352)
E/IOException( 223): at com.android.internal.policy.impl.PhoneWindow
$DecorView.draw(PhoneWindow.java:1847)
E/IOException( 223): at android.view.ViewRoot.draw(ViewRoot.java:
1217)
E/IOException( 223): at android.view.ViewRoot.performTraversals
(ViewRoot.java:1030)
E/IOException( 223): at android.view.ViewRoot.handleMessage
(ViewRoot.java:1482)
E/IOException( 223): at android.os.Handler.dispatchMessage
(Handler.java:99)
E/IOException( 223): at android.os.Looper.loop(Looper.java:123)
E/IOException( 223): at android.app.ActivityThread.main
(ActivityThread.java:3948)
E/IOException( 223): at java.lang.reflect.Method.invokeNative
(Native Method)
E/IOException( 223): at java.lang.reflect.Method.invoke(Method.java:
521)
E/IOException( 223): at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/IOException( 223): at com.android.inte



Other Threads

1. how to test bluetooth handset/handsfree without phone module

Hi,

I'm going to test the bluetooth handset/handsfree on my platform, but
I don't have the phone module. Any one did such kind of test? Thanks a
lot in advance!
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Strange GestureDetector side effect when used in a subclass of FrameLayout?

Hi,

It looks like a bug in the VelocityTracker. Can you please file it at
b.android.com? Thanks






-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~

3. Unused java hardware acceleration on the G1 (was Android game developers desperately need optimised game engine example code ...)

4. Test FrameWork

5. Unused java hardware acceleration on the G1 (was Android game developers desperately need optimised game engine example code ...)

6. Managing Views programmatically

7. Trying to get Market & other Google apps to work on emulator