I'm trying to write an app that uploads videos from Android phones as they are being recorded by reading from .mp4 file and uploading the bytes as they are written to the file. The problem is that, as far as I can tell, the moov atom and some other assorted data do not seem to be written to file until the video recording has finished and the video file has been closed. Is there any way to process the video file and add these metadata on the server-side assuming either
- The full video file has been uploaded (but without the moov atom or any other data that does not get written on the first pass)
- Only part of the video has been uploaded (e.g. the first 10 seconds) and I want to convert this into a valid mp4 file containing the uploaded segment of video.
I've seen links like http://www.mattakis.com/blog/kisg/20090708/broadcasting-video-with-android-without-writing-to-the-file-system but they gloss over the problem by simply stating
So the received stream will have to be fixed up after the recording is finished, or the raw video / audio frames have to be processed by the server.
without explaining exactly how to go about doing that.