View Single Post
Old 10th April 2011, 12:45   #1  |  Link
evered
Registered User
 
Join Date: Apr 2011
Posts: 2
Starting to play mp4 before end of encoding

Hi,

I am writing a server software that creates an mp4 file (using ffmpeg libraries) and starts downloading it immediately to the player, before the encoder finishes the encoding.The intention is that the player will be able to start playing before the encoding ends. When I did this with an flv file, it worked fine. Now that I'm doing it with an mp4 file, it didn't work...

It seems that an mp4 file cannot be played until the encoder has finished encoding.
If I understand correctly, there are several problems:

1. The moov chunk should be in the beginning of the file - this can be fixed.
2. Every chunk should have its size in the beginning of the chunk, including the mdat chunk. So the total size of encoded packets should be known before I start delivering them.
3. The moov chunk contains offsets and sizes of all the packets in the stream (stsz, stco chunks) which should also be available before delivering the encoded data.

Is there a way to create a valid mp4 which can start playing before the encoding ends?
If so – is it possible with ffmpeg or any other public software?

Thanks and regards
evered is offline   Reply With Quote