Research on the segmented saving of Android recorded video

Source: Internet
Author: User

Recording video needs to be saved in a segmented form, which can be considered from the system source code, and read the following codes:

    • Framework/av/media/libstagefright/mpeg4writer.cpp
    • Package/apps/camera/src/com/android/camera/actor/videoactor.java

Mainly from the MPEG4Writer.cpp in the kmax32bitfilesize and start, such as, modify a single file maximum capacity of 56M (0x3800000), found to use the system camera recording, the threshold will be reached after the "maximum size", and automatically stop, Save the video you've already recorded.

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

The videoactor is then traced to the processing. One idea is to stop the recording immediately after the file is saved.

    public void Stopvideorecordingasync () {//Tchip ZJ//For snapshot stopobjecttracking ();        Mstopvideorecording = true; LOG.D (TAG, "Stopvideorecordingasync () mmediarecorderrecording=" + mmediarecorderrecording + ", mRecorderBu Sy= "+ Mrecorderbusy +", isvideoprocessing () "+ isvideoprocessing () +", Mstopvideorecordi        ng = "+ mstopvideorecording);        Mvideocontext.getzoommanager (). changezoomforquality ();        Mvideocontext.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 (mstoppingAction! = Stop_return_unvalid && Mcallfromonpause! = True) {//Mvideocontext.showprogress (Mvideocon Text.getresources (). getString (r.string.saving));            Tchip ZJ: Remove Save UI} Mvideosavingtask = new Savingtask ();        Mvideosavingtask.start ();            } else {mrecorderbusy = false;            Releaserecorder ();            if (mstoppingaction = = stop_return_unvalid) {Doreturntocaller (false); }        }    }

Eat first, tomorrow to see the implementation of the feasibility and effect (whether or not missing seconds).

Research on the segmented saving of Android recorded video

Related Article

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.