How to add a MOOV atom in a mp4 video file

Ravinder  picture Ravinder · Jul 17, 2012 · Viewed 74.4k times · Source

I am working on live device to server streaming in android. I am able to send data in bytes on server but when i play that file during recording on server VLC say that MOOV atom not found. After a lot of workaround i found that MOOV atom of a mp4 file generates in the end. But i have to play that file on server while recording means live. I go through the source code of SPYDROID and SIPDROID but non of them is working. I tried to add move atom on serverside using FFMPEG but didn't get any success. Any one have any idea how can i achieve this. Thanx in advance.

Answer

Sebastian Annies picture Sebastian Annies · Jul 19, 2012

You got a problem. The 'moov' box is a kind of table of contents. If not all content is there you can't have a complete table of contents. Ouch!

If you want to stick with MP4 and if you are writing the file by yourself you could write the file as so called fragmented MP4 file. A fragmented MP4 file contains multiple self-contained small pieces of the video - each with its own table of contents. It would enable you to play the file before the complete recording has finished.

If you don't need to stick with MP4 an option would be to write the raw h264 stream to the server. Then you don't have that kind of table of content. VLC can play raw h264 streams.