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