PDA

View Full Version : Mp4 packet interleaving


Lele-brz
25th July 2007, 10:51
Hi all,
I'm using an mp4 container with h264 and aac, my intention is to stream this video retrieving blocks from a server.
I noticed that on large videos (duration) when reading I get some big jumps when retrieving packets for playing, I suppose this is connected to the interleaving or there are other factors to consider?

Could Matroska deal better with the interleaving of the audio - video packets?

thanks in advance

bye

mediator
25th July 2007, 20:11
the mp4 container itself doesn't restrict anything about the interleaving. So up to the used muxer and source interleaving quality might be everything: from "absolute crap" to "excellent". I guess your case is somewhere in the middle or the right middle.
Once you remultiplex the file with a proper muxer, interleaving quality will be ok.

PM me if the existing muxers (e.g. Mp4Box/YAMB) don't do the job for you.

bond
27th July 2007, 18:33
did you hint the tracks to be streamed?

froggy1
27th July 2007, 19:30
@Lele-brz

I don't know if you're on Linux, but if so, you can use mp4creator from mpeg4ip It has options for interleaving and optimizing the MP4 file layout for streaming

Lele-brz
30th July 2007, 11:06
Thanks for answering.
No, I didn't hint the track could this help, I'm not sure how to do it.
I have mp4creator even for Windows, do you mean to optimize by launching mp4creator -optimize ?
Does it change even the interleaving or just move the header at the beginning of the file?

thanks again

bye

froggy1
30th July 2007, 11:14
I don't have much experience with mp4creator but looking at its doc about -optimize it says this...

Optimize the layout of the mp4 file to interleave the data in time, hence reducing disk seeks during streaming or playback. This also arranges the mp4 file so that the media control information is at the beginning of the file. This allows HTTP streaming of the mp4 file.

so it does interleaving, how much I don't know, try and see if it works for you

bond
30th July 2007, 21:18
mp4box by default also interleaves the streams (0.5 sec) and moves the headers to the beginning

try hinting the tracks with either mp4box or mp4creator (check their webpages for help)

SeeMoreDigital
30th July 2007, 22:11
Hmmmm....

Out of interest. Have you experimented by generating .MP4 encodes with B-VOP's and the same again without B-VOP's... to see if there is any difference with playback?

Drachir
31st July 2007, 09:23
...
try hinting the tracks with either mp4box or mp4creator (check their webpages for help)

Hinting doesn't help if you plan to provide files for progressive download over http. The files will only get bigger, more to download.

I would prefare real streaming over rtp controlled via rtsp.

For more information look here: http://www.streamingmedia.com/article.asp?id=8456&page=1

Lele-brz
1st August 2007, 09:38
thanks for answering,
well I still have to run some test on large file to check the access nearly the end of file and see the audio video packet displacement.
Don't want to go too off-topic but I wanted to ask which container has the smallest header, I noticed that on large mp4 AVC with baseline encoding can get more than 1 Mb.
thanks

Lele-brz
2nd August 2007, 09:51
By the way, is there a tool that retrieve the interleaving of a given MP4?

thanks

Lele-brz
2nd August 2007, 15:11
Ok, this is my log: these are the seek performed when reading the packets, I notice that I have seek between I suppose audio and video packet of up to 2 Mb, I used MP4box with default parameter so interleaving 0.500 secs.

[3960] DecoderAgent::READ BLOCK 486 OFFSET 63612118
[3960] DecoderAgent::READ BLOCK 472 OFFSET 61838023
[3960] DecoderAgent::READ BLOCK 486 OFFSET 63612297
[3960] DecoderAgent::READ BLOCK 472 OFFSET 61844810
[3960] DecoderAgent::READ BLOCK 486 OFFSET 63612511
[3960] DecoderAgent::READ BLOCK 472 OFFSET 61849589
[3960] DecoderAgent::READ BLOCK 486 OFFSET 63612732
[3960] DecoderAgent::READ BLOCK 472 OFFSET 61852369
[3960] DecoderAgent::READ BLOCK 486 OFFSET 63665746
[3960] DecoderAgent::READ BLOCK 472 OFFSET 61855461

bond
2nd August 2007, 19:48
you can change the interleaving period used in mp4box iirc, check the docu on the gpac page