video - Android MediaRecorder Multiple Files -


I am using a MediaRecorder to record video from the camera, save it as an SD card in MP4, which Works flawlessly without any timing. I would like to limit the length of .mp4 files to 10 seconds and then automatically create a new file (i.e.: if a user records 30 seconds then I want to create three files, volume 1.MP4 (0: 00) -0: 10), Segment 2. MP4 (0: 10-0: 20), and Segment 3. MP4 (0: 20-0: 30)).

Here I set up the recorder and the output What should I do to do this during the recording?

  Private Boolean Ready Video Recorder () {this.mMediaRecorder = New MediaRecorder (); This.mcamamera.stopPreview (); This.mcamamera.unlock (); This.mMediaRecorder.setCamera (mCamera); This.mMediaRecorder.setAudioSource (MediaRecorder.AudioSource.CAMCORDER); This.mMediaRecorder.setVideoSource (MediaRecorder.VideoSource.CAMERA); This.mMediaRecorder.setOrientationHint (90); This.mMediaRecorder.setMaxDuration (this.VIDEO_CHUNK_LENGTH_MS); // 10,000 ms if (android sdkersian ()> = 8) {this.mMediaRecorder.setProfile (CamcorderProfile.get (CamcorderProfile.QUALITY_HIGH)); } Else {this.mMediaRecorder.setOutputFormat (MediaRecorder.OutputFormat.MPEG_4); This.mMediaRecorder.setAudioEncoder (MediaRecorder.AudioEncoder.DEFAULT); This.mMediaRecorder.setVideoEncoder (MediaRecorder.VideoEncoder.DEFAULT); } This.mvideoFileName = getOutputMediaFile (MEDIA_TYPE_VIDEO) .toString (); // gives an appropriate file name. Mediarecorder.setOutputFile (mVideoFileName); This.mMediaRecorder.setPreviewDisplay (mPreview.getHolder () getSurface ().); {Try this.mMediaRecorder.prepare (); } Hold (IllegalStateException e) {log d. (TAG, "IllegalStateException Readiness MediaRecorder:" + e.getMessage ()); This.releaseMediaRecorder (); return false; } Hold (IOException e) {log d. (Tag, "IOException Media Recording:" + e.getMessage ()); This.releaseMediaRecorder (); return false; } Back true; }  


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -