[MEncoder-users] moov atom at the begining...

Nitin Jain nitinj1981 at gmail.com
Wed Jul 16 20:27:05 CEST 2008


On Wed, Jul 16, 2008 at 2:06 AM, Hradec <hradec at hradec.com> wrote:
> HI there...
>
> I was wondering if theres any way to tell ffmpeg to write the moov atom
> at the begining of a mp4 instead of at the end.
>
> I want to be able to encode avi files to mp4 and get a stream-ready
> file. I know about qt-faststart, but I really need to be able to get the
> file straight out of ffmpeg.
>
> My idea is to actually make ffmpeg write the encoded video to a pipe and
> use a script in parallel reading that pipe and sending it trough a
> socket directly to a player. Basically "re-encoding" a file in realtime
> for streaming. But the problem is that I need the moov atom at the
> begining of the file so the player can start playing it right away.
>
> If someone know where I can find more info about the moov atom (maybe
> how it is constructed, what type of info is in it) I could maybe try to
> create a "standard" atom that my script would automatically send to the
> player before start sending the data...
>

Well... I don't know how ffmpeg works, but I've some experience with
mp4/3gp writers and parsers as such.... only thing is that it's been a
3 years gap now, so my knowledge is a bit rusty! :)
Firstly, saying "want to be able to encode avi files to mp4" is a bit
misleading... avi and mp4 are merely file-formats or containers... the
encoding decides how your audio & video bits are going to look like!
;)
Anyhow, so broadly put: the 'moov' atom is basically the container
that possesses all your meta-data... i.e. recursively a series of
boxes such as 'stsz', 'stco' etc. etc. which give you all the
information about the video/audio framesizes, the chunking (as in, how
many frames per chunk), timing details, encoders used etc. etc.
And so, if my logical understanding is good, generation of a 'moov'
atom *at the most* can happen only at a small delay relative to the
media-encoding processes, but certainly not *along* the
capture+encoding of the frame... unless, literally everything about
your media is pre-determined, and so, you can prepare some sort of a
default 'moov' box.... but I don't find that a really possible
scenario...
For further details about creating an mp4 file, you should try getting
the file format specification...

cheers,
nitin



More information about the MEncoder-users mailing list