Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a MOOV atom in a mp4 video file

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 moov atom on serverside using FFMPEG but didn't get any success. Anyone has an idea on how can I achieve this?

like image 459
Ravinder Avatar asked Jul 17 '12 13:07

Ravinder


People also ask

How do I fix MOOV atom not found MP4?

Method 1: Download the video again from the source If possible, download the video file again from the source, be it from the Internet, CD/DVD, Android, or other devices. Get your video again and this time, make sure the file is properly and completely downloaded or transferred without any interruption.

What is MOOV atom in MP4?

The moov atom that is a part of the metadata for mp4 and m4v files is also known as the index of the file because it contains all of the information about the file that is read by any video players. Video encoders will often automatically move the metadata to the front of video files to make them web ready.

What does it mean when it says MOOV atom not found?

"Moov Atom Not Found" error occurs in a video when you record it with the recording device off suddenly. The reason for this error is that the Moov atom is present at the end of the video. When the recorder is accidentally turned off, the Moov atom becomes missing.

What is MP4 atom?

Structure of MP4 Files The media data contains audio or video and metadata indicate flags for random access, timestamps, etc. The structures in MP4 are typically referred to as atoms or boxes. The minimum size of an atom is 8 bytes(the first 4 bytes specify size and the next 4 bytes specify type).


2 Answers

There is a tool untrunc which claims to repair unfinished (truncated) mp4, m4v, mov, 3gp video. I haven't tested it myself but it may be worth a try.

like image 166
k3a Avatar answered Oct 04 '22 19:10

k3a


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.

like image 20
Sebastian Annies Avatar answered Oct 04 '22 20:10

Sebastian Annies