android视频录制

MediaRecorder recorder = new MediaRecorder

recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); //从照相机采集视频

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);

recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);

recorder.setVideoSize(320, 240);

recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);//设置视频编码方式

recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

File videoFile = new File(Environment.getExternalStorageDirectory(),System.currentTimeMillis() + ".3gp");

recorder.setOutputFile(videoFile.getAbsolutePath());

recorder.setPreviewDisplay(surfaceView.getHolder().getSurface());

recorder.prepare();//预期准备

recorder.start();//开始刻录

 

recorder.stop();

你可能感兴趣的:(android,File)