Android : Is it possible to broadcast a video MediaRecorder and save to local (sdcard) at the same time?

on Wednesday, October 8, 2014


I want to broadcast my camera by socket and save to sdcard the same video at the same time.


For instance



pfd = ParcelFileDescriptor.fromSocket(new Socket("http:/example.com",7777));
mMediaRecorder = new MediaRecorder();
mMediaRecorder.setCamera(mCamera);
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
// mMediaRecorder.setOutputFile(Environment.getExternalStorageDirectory().getPath() + "/video.mp4");
mMediaRecorder.setOutputFile(pfd.getFileDescriptor());
mMediaRecorder.setVideoFrameRate(30);
mMediaRecorder.setVideoSize(mPreviewSize.width, mPreviewSize.height);
mMediaRecorder.setPreviewDisplay(_.mSurfaceHolder.getSurface());


I can setup only one output stream. Is it possible to broadcast and save videofile at the same time?


0 comments:

Post a Comment