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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
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
Old 11th April 2011, 07:58   #2  |  Link
VFR maniac
Spinner of yarns
 
VFR maniac's Avatar
 
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
VFR maniac is offline   Reply With Quote
Old 11th April 2011, 08:48   #3  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 4,627
Quote:
Originally Posted by VFR maniac View Post
Well, I am also working implementation of movie fragments feature for my project, this will be push soon.
You mean L-SMASH? Are there any plans on making a standalone cli version (like mp4box for GPAC)? The last time I looked I only saw the patched x264cli.
sneaker_ger is offline   Reply With Quote
Old 11th April 2011, 11:31   #4  |  Link
evered
Registered User
 
Join Date: Apr 2011
Posts: 2
Thanks for the answer!
Seems interesting - I'll try it.
Does anyone know if iPhone can play a fragmented mp4?
Thanks
evered is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.