Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
10th April 2011, 12:45 | #1 | Link |
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 |
11th April 2011, 07:58 | #2 | Link |
Spinner of yarns
Join Date: May 2009
Posts: 164
|
If you start to play a movie from the very head, it can be done with movie fragments feature.
[ftyp][moov+mdat]-[moof+mdat]-[moof+mdat]- ... Basically, data offsets and timelines are provided by each movie fragment (moof box), however what codec is used in the streams is answered by stsd box in moov box, so you need parse at least this moov box at the first. Movie fragments feature is implemented by GPAC and Bento4 AFAIK. Ffmpeg and libav support only reading side, so you can't use them as movie fragment writer. GPAC supports aggressively movie fragments (I don't know this is buggy or not now. The last time I saw, the implementation is buggy around media duration). They are adding gradually DASH (Dynamic Adaptive Streaming over HTTP) feature. The discussion of DASH have been continued to publish by MPEG. Well, I am also working implementation of movie fragments feature for my project, this will be push soon.
__________________
僕と契約して、L-SMASH developerになってよ! L-SMASH | L-SMASH Works | Opus-in-ISOBMFF specification and reference software |
Thread Tools | Search this Thread |
Display Modes | |
|
|