Note that there are some explanatory texts on larger screens.

plurals
  1. POVideo display is garbled when recording on Galaxy S3
    primarykey
    data
    text
    <p>I'm writing a camera app and am having an issue with the S3. Whenever I start recording, the display goes to garbage (see screenshots below). Then, when I stop recording I get an exception:</p> <pre><code>10-02 13:36:31.647: E/MediaRecorder(24283): stop failed: -1007 10-02 13:36:31.647: D/AndroidRuntime(24283): Shutting down VM 10-02 13:36:31.647: W/dalvikvm(24283): threadid=1: thread exiting with uncaught exception (group=0x40c49a68) 10-02 13:36:31.647: E/AndroidRuntime(24283): FATAL EXCEPTION: main 10-02 13:36:31.647: E/AndroidRuntime(24283): java.lang.RuntimeException: stop failed. 10-02 13:36:31.647: E/AndroidRuntime(24283): at android.media.MediaRecorder.native_stop(Native Method) 10-02 13:36:31.647: E/AndroidRuntime(24283): at android.media.MediaRecorder.stop(MediaRecorder.java:742) 10-02 13:36:31.647: E/AndroidRuntime(24283): at com.myapp.android.ui.camera.NewCameraActivity.stopRecording(NewCameraActivity.java:178) 10-02 13:36:31.647: E/AndroidRuntime(24283): at com.myapp.android.ui.camera.NewCameraActivity.toggleRecording(NewCameraActivity.java:189) 10-02 13:36:31.647: E/AndroidRuntime(24283): at com.myapp.android.ui.camera.NewCameraActivity.onClick(NewCameraActivity.java:97) 10-02 13:36:31.647: E/AndroidRuntime(24283): at android.view.View.performClick(View.java:3565) 10-02 13:36:31.647: E/AndroidRuntime(24283): at android.view.View$PerformClick.run(View.java:14165) 10-02 13:36:31.647: E/AndroidRuntime(24283): at android.os.Handler.handleCallback(Handler.java:605) 10-02 13:36:31.647: E/AndroidRuntime(24283): at android.os.Handler.dispatchMessage(Handler.java:92) 10-02 13:36:31.647: E/AndroidRuntime(24283): at android.os.Looper.loop(Looper.java:137) 10-02 13:36:31.647: E/AndroidRuntime(24283): at android.app.ActivityThread.main(ActivityThread.java:4514) 10-02 13:36:31.647: E/AndroidRuntime(24283): at java.lang.reflect.Method.invokeNative(Native Method) 10-02 13:36:31.647: E/AndroidRuntime(24283): at java.lang.reflect.Method.invoke(Method.java:511) 10-02 13:36:31.647: E/AndroidRuntime(24283): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980) 10-02 13:36:31.647: E/AndroidRuntime(24283): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) 10-02 13:36:31.647: E/AndroidRuntime(24283): at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>I've tested my app on the Galaxy Nexus (4.1), Galaxy S2, Nexus S, and Galaxy Tab 10.1. All of them work fine. I've followed <a href="http://developer.android.com/guide/topics/media/camera.html#capture-video" rel="nofollow noreferrer">development guidelines for video recording</a>. I don't understand why this device is so different from the others. Here's what I'm seeing on the device. First picture is before I start recording. Second picture is what happens once I start recording.</p> <p><img src="https://i.stack.imgur.com/j85WU.jpg" alt="Before I&#39;ve started recording"></p> <p><img src="https://i.stack.imgur.com/0KtjJ.jpg" alt="After I start recording"></p> <p>Here's my code for preparing and starting the <code>MediaRecorder</code> object:</p> <pre><code>@Override public void onClick( View v ) { switch (v.getId()) { case R.id.camera_action_ImageView: int mode = getMode(); if ( mode == MODE_PHOTO ) { focusThenTakePicture(); } else if ( mode == MODE_VIDEO ) { toggleRecording(); } break; } } private void startRecording() { if ( prepareRecorder() ) { getRecorder().start(); setRecording( true ); } } @TargetApi( 9 ) private boolean prepareRecorder() { Camera camera = getCamera(); camera.unlock(); MediaRecorder recorder = new MediaRecorder(); setRecorder( recorder ); recorder.setCamera( camera ); recorder.setAudioSource( MediaRecorder.AudioSource.CAMCORDER ); recorder.setVideoSource( MediaRecorder.VideoSource.CAMERA ); CamcorderProfile profile; if ( Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.GINGERBREAD ) { profile = CamcorderProfile.get( CamcorderProfile.QUALITY_HIGH ); } else { profile = CamcorderProfile.get( getCameraId(), CamcorderProfile.QUALITY_HIGH ); } recorder.setProfile( profile ); File outputFile = LocalMediaUtil.getOutputMediaFile( LocalMediaUtil.MEDIA_TYPE_VIDEO ); setRecorderOutputFile( outputFile ); recorder.setOutputFile( outputFile.toString() ); recorder.setPreviewDisplay( getPreview().getHolder().getSurface() ); try { recorder.prepare(); } catch (Exception e) { camera.lock(); setRecorder( null ); return false; } return true; } private void stopRecording() { MediaRecorder recorder = getRecorder(); recorder.stop(); releaseRecorder(); setRecording( false ); LocalMediaUtil.scanMedia( this, getRecorderOutputFile().toString(), 90 ); setRecorderOutputFile( null ); } private void toggleRecording() { if ( isRecording() ) { stopRecording(); } else { startRecording(); } } private void releaseRecorder() { MediaRecorder recorder = getRecorder(); if ( recorder != null ) { recorder.reset(); recorder.release(); setRecorder( null ); getCamera().lock(); } } </code></pre> <p><strong>Edit:</strong> So this has something to do with the <code>CamcorderProfile</code> being set. I change it to <code>CamcorderProfile.QUALITY_LOW</code> and it worked fine. So how can I have high resolution video without garbled output?</p> <p><strong>Edit2:</strong> So with <code>CamcorderProfile.QUALITY_LOW</code> set, I get no errors using the video recorder. However, the output video looks very similar the garbled screenshot posted above. So what gives?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload