Log in

View Full Version : Generate MP4 header


davidvsmp4
17th February 2010, 23:38
Hello. I'm working on video converting script. What I'm trying to achieve is ability to start downloading converted MP4 video (x264+aac) before converting is complete.

However when I try to redirect output of ffmeg or mencoder to STDOUT I got "muxer doesn't support non seekable output".

So the question is: how to generate MP4 header knowing source video properties (duration, number of frames, dimensions, etc)? What tools can be used to create such a header and append converted streams to it?

Dark Shikari
17th February 2010, 23:53
You can't do that. The header includes an index, which cannot be written until the rest of the file is written.

davidvsmp4
18th February 2010, 17:25
Thanks for the answer. Please excuse my lack of knowledge but is it possible to generate index in advance? I mean *if resulted video will have the same number of frames as source one, same frame rate, and I-frame will be every N-th frame (no B-frames)?

Dark Shikari
18th February 2010, 17:47
Thanks for the answer. Please excuse my lack of knowledge but is it possible to generate index in advance? I mean *if resulted video will have the same number of frames as source one, same frame rate, and I-frame will be every N-th frame (no B-frames)?No, because the purpose of the index is to list the size of every frame and its position in the file.