android mediarecorder error (MediaRecorder start failed :

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?


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()


 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");
链接地址: http://www.djcxy.com/p/5252.html

上一篇: 在Android上录制实时OpenCV处理

下一篇: android mediarecorder错误(MediaRecorder启动失败: