Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9117863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:59:51+00:00 2026-06-17T04:59:51+00:00

I’m writing a camera app and am having an issue with the S3. Whenever

  • 0

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:

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)

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 development guidelines for video recording. 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.

Before I've started recording

After I start recording

Here’s my code for preparing and starting the MediaRecorder object:

@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 < 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();
    }
}

Edit: So this has something to do with the CamcorderProfile being set. I change it to CamcorderProfile.QUALITY_LOW and it worked fine. So how can I have high resolution video without garbled output?

Edit2: So with CamcorderProfile.QUALITY_LOW set, I get no errors using the video recorder. However, the output video looks very similar the garbled screenshot posted above. So what gives?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:59:53+00:00Added an answer on June 17, 2026 at 4:59 am

    I had a similar problem, and finally figured out it was due to sharing the preview surface between the camera and the media recorder (I’m not sure this is actually the underlying cause, but from the API calls it appears that way).

    I’m assuming you have already opened the camera and attached a preview display to it, if so try inserting the following lines at the top of your prepareRecorder method:

    Camera camera = getCamera();
    camera.stopPreview();
    camera.lock();
    camera.release();
    
    camera = Camera.open();
    camera.unlock();
    

    You might also need to reassign the camera local to the field hidden behind getCamera(), unfortunately I can’t tell how you’ve implemented it with the given code snippet.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I am writing an app with both english and french support. The app requests
I am writing an app for my school newspaper, which is run completely online
I am trying to understand how to use SyndicationItem to display feed which is
Specifically, suppose I start with the string string =hello \'i am \' me And
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.