1

When I try to make the camera recorder in my program I get this error:

E/MediaRecorder﹕ start failed: -19

code is

try {
    final SurfaceView sv = (SurfaceView) findViewById(R.id.srvView);
    MediaRecorder mrec = new MediaRecorder();
    mrec.setCamera(camera);

    mrec.setAudioSource(MediaRecorder.AudioSource.MIC);
    mrec.setVideoSource(MediaRecorder.VideoSource.CAMERA);
    mrec.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    mrec.setVideoFrameRate(10);
    mrec.setVideoSize(480, 320);
    mrec.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    mrec.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);

    mrec.setPreviewDisplay(mSh.getSurface());
    mrec.setOutputFile("/mnt/sdcard/pro/andsend.avi");
    mrec.prepare();
    mrec.start();
} catch(Exception e)
{
    e.printStackTrace();
}

I try to change the sequence and change the set size, Frame Rate etc...

But, I can't find the problem.

What's the problem?

Halvor Holsten Strand
  • 19,829
  • 17
  • 83
  • 99
  • Does this answer your question? [Android MediaRecorder - "start failed: -19"](https://stackoverflow.com/questions/10496969/android-mediarecorder-start-failed-19) – Andrew T. Aug 10 '22 at 11:40

2 Answers2

1

see my answer : android-mediarecorder-start-failed-19

error code -19 comes about when there is a problem with the size of the video as set by MediaRecorder#setVideoSize()

Community
  • 1
  • 1
Adnan Abdollah Zaki
  • 4,328
  • 6
  • 52
  • 58
0
 mrec.setOutputFile("/mnt/sdcard/pro/andsend.avi");

are you sure that this folder exist? Also edit this line to

mrec.setOutputFile(Environment.getExternalStorageDirectory() + "/pro/andsend.avi");
Android Android
  • 724
  • 1
  • 7
  • 20