Exploration of segmented storage of Android recorded videos

Source: Internet
Author: User

Exploration of segmented storage of Android recorded videos

The recorded video needs to be saved in multiple parts. You can read the following code from the system source code:

Framework/av/media/libstagefright/MPEG4Writer. cpp package/apps/Camera/src/com/android/camera/actor/VideoActor. java

Mainly from MPEG4Writer. starting with kMax32BitFileSize and in cpp, modify the maximum size of a single file to 56 MB (0x3800000, when the threshold value is reached, the system prompts "the maximum size has been reached" and stops automatically to save the recorded video.

static const int64_t kMax32BitFileSize = 0x3800000;//0x00ffffffffLL; // 2^32-1 : max FAT32static const int64_t kMax32BitDuration = 0x007fffffffLL;

Then we track the processing of VideoActor. One idea is to restart the video immediately after the file is saved when the video is stopped.

Public void stopVideoRecordingAsync () {// TChip ZJ // for snapshot stopObjectTracking (); mStopVideoRecording = true; Log. d (TAG, "stopVideoRecordingAsync () encoding =" + mMediaRecorderRecording + ", mRecorderBusy =" + mRecorderBusy + ", isVideoProcessing ()" + isVideoProcessing () + ", mStopVideoRecording = "+ mStopVideoRecording); mVideoContext. getZoomManager (). changeZoomForQuality (); m VideoContext. setSwipingEnabled (true); mHandler. removeMessages (UPDATE_RECORD_TIME); mVideoContext. getShutterManager (). setVideoShutterMask (false); if (isVideoProcessing () {return;} if (mRecorderBusy) {// return for recorder is busy. return;} mRecorderBusy = true; mRecordingView. hide (); if (mMediaRecorderRecording) {mVideoContext. getShutterManager (). setVideoShutterEnabled (false); if (mStoppingA Ction! = STOP_RETURN_UNVALID & mCallFromOnPause! = True) {// mVideoContext. showProgress (mVideoContext. getResources (). getString (R. string. saving); // TChip ZJ: remove the Save UI} mVideoSavingTask = new SavingTask (); mVideoSavingTask. start () ;}else {mRecorderBusy = false; releaseRecorder (); if (mStoppingAction = STOP_RETURN_UNVALID) {doReturnToCaller (false );}}}

After dinner, we will see the feasibility and effect of the Implementation tomorrow (whether to miss the second ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.