3
我想,當我得到
準備沒能捕捉視頻和採用Android MediaRecorder
。但它編碼:的Android MediaRecorder準備失敗-17
這裏是我的代碼:
mediaRecorder = new MediaRecorder();
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediaRecorder.setOutputFile("/sdcard/test.mp4");
mediaRecorder.setVideoFrameRate(20);
mediaRecorder.setVideoSize(176, 144);
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
mediaRecorder.setPreviewDisplay(surfaceHolder.getSurface());
mediaRecorder.prepare();
當我將VideoEncoder設置爲H263並將Outputformat設置爲THREE_GPP時,我沒有得到此例外。
這是完整的堆棧跟蹤。
E/mm-camera 7x-vfe( 68): Received VFE start ACK!!! This is a user preview start.
D/QualcommCameraHardware( 68): startPreview X
E/AuthorDriver( 68): Command 13 completed with error -17
E/MediaRecorder(6406): prepare failed: -17
W/System.err(6406): java.io.IOException: prepare failed.
W/System.err(6406): at android.media.MediaRecorder._prepare(Native Method)
W/System.err(6406): at android.media.MediaRecorder.prepare(MediaRecorder.java:509)
W/System.err(6406): at org.video.VideoStreamSender.prepare(VideoStreamSender.java:50)
W/System.err(6406): at org.video.VideoPreview.surfaceCreated(VideoPreview.java:50)
W/System.err(6406): at android.view.SurfaceView.updateWindow(SurfaceView.java:540)
W/System.err(6406): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:339)
W/System.err(6406): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
W/System.err(6406): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
W/System.err(6406): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
W/System.err(6406): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
W/System.err(6406): at android.view.View.draw(View.java:6742)
W/System.err(6406): at android.widget.FrameLayout.draw(FrameLayout.java:352)
W/System.err(6406): at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
W/System.err(6406): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
W/System.err(6406): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
W/System.err(6406): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
W/System.err(6406): at android.view.View.draw(View.java:6742)
W/System.err(6406): at android.widget.FrameLayout.draw(FrameLayout.java:352)
W/System.err(6406): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1872)
W/System.err(6406): at android.view.ViewRoot.draw(ViewRoot.java:1422)
W/System.err(6406): at android.view.ViewRoot.performTraversals(ViewRoot.java:1167)
W/System.err(6406): at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
W/System.err(6406): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(6406): at android.os.Looper.loop(Looper.java:143)
W/System.err(6406): at android.app.ActivityThread.main(ActivityThread.java:4914)
W/System.err(6406): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(6406): at java.lang.reflect.Method.invoke(Method.java:521)
W/System.err(6406): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
W/System.err(6406): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
W/System.err(6406): at dalvik.system.NativeStart.main(Native Method)
I/CameraService( 68): [Camera KPI] 1st preview frame
你可以提供更大的堆棧跟蹤,最好通過編輯你的問題? – pkk