View Full Version : MP4 header size
Lele-brz
24th August 2007, 19:52
Hi all,
I use mp4box to multiplex a video h264 and aac as audio.
I was wondering if there's a way to reduce the header size, because I stream the file and when playing I always need to download the entire header and this is proportional to the lenght of the video.
thanks for any help
bye
bond
26th August 2007, 14:51
this sounds strange, the header should be rather small. are you sure the header is at the beginning of the file (it should when muxing with mp4box)?
Lele-brz
27th August 2007, 09:14
Thanks for answering,
yes I have it at the beginning since I use the default values of mp4box.
What I've seen is that when I open the file with ffmpeg I have to have all the header before start to play, and the header size increases with the lentgh of the video.
So on a 2h video my header is around 2 Mb.
Is there a way to reduce it ?
thanks again
bye
bond
27th August 2007, 20:43
not using b-frames or variable framerate should reduce it, also not using tags might help
are you sure that you dont simply need to use hint tracks or something similar?
mediator
27th August 2007, 20:45
For a quick-start of playback you have to use Movie Fragments (tables are spread over the file). afaik the mp4box commandline option that can be used for that is '-frag'.
But unfortunately this may not be supported by some splitters/players. Besides fragments, there is nothing that the ISO-standard offers to significantly speed up initial loading.
SeeMoreDigital
27th August 2007, 21:41
For a quick-start of playback you have to use Movie Fragments (tables are spread over the file). afaik the mp4box commandline option that can be used for that is '-frag'.
But unfortunately this may not be supported by some splitters/players. Besides fragments, there is nothing that the ISO-standard offers to significantly speed up initial loading.This is interesting. I have noticed some hardware players take far longer to open files with B-VOP's than without B-VOP's.
I will re-mux some of my .MP4 files and report back....
mediator
28th August 2007, 10:31
Of course, you can save the "Composition Time To Sample (ctts)" table when not using B-Frames. But it impacts encoding (->not only the container).
SeeMoreDigital
28th August 2007, 10:56
I de-muxed the streams in a couple of my (MPEG-4.2) .MP4 encodes with B-VOPs and re-muxed then with YAMB with '-frag' in the command-line box and sadly, they would not play at all in any of my hardware players.... Bummer!
Lele-brz
29th August 2007, 10:14
Yes, I did the same test some time ago, using the frag option.
I was told that only Osmo4 player supports this, what I'm wondering is if it's not a problem during the decoding.
You don't have any problem if you play the entire file, but if you split it and send through the net there's a big overhead before start playing.
Calculating the size of the video it's quite strange that I need a big header to permorm the seeks.
Drachir
29th August 2007, 12:44
Yes, I did the same test some time ago, using the frag option.
I was told that only Osmo4 player supports this, ...
If I remember right, the latest version of the http://www.3ivx.com Filter Suite should support fragmented ISO Media files too. (Never tested it)
You can find in ISO/IEC 14496-12 (ISO Base Media File Format) this:
A.8 Fragmented movie files
This section introduces a technique that may be used in ISO files, where the construction of a single Movie
Box in a movie is burdensome. This can arise in at least the following cases:
...
HTTP fast-start. If the movie is of reasonable size (in terms of the Movie Box, if not time), the Movie
Box can take an uncomfortable period to download before fast-start happens.
I think this is the only solution for your problem, if you don't want to use a streaming server like DSS and stream via rtp.
Stux
3rd September 2007, 08:28
If I remember right, the latest version of the http://www.3ivx.com Filter Suite should support fragmented ISO Media files too. (Never tested it)
We've had to disable this in the current release due to compliancy problems with the current implementation of movie fragments.
Another approach, is to use Header Compression. Unfortunately header compression is not supported in the MP4 specification, but only in MOV, pitty as it can reduce a 10MB header to a fraction of its size... 10:1 compression is not unheard of.
Variable Framerate encoding will also increase header size. Different muxers can also impact on header size.
Lele-brz
3rd September 2007, 17:04
And can mybe MAtroska be a better container keepinh h264 + aac.
Better considering the reduced header size and good seeking....
thanks
Lele-brz
15th October 2007, 10:33
Hi,
not sure this is the right place to ask.
I'm trying to understand what's in the header of a mp4 (h264 + aac). I use mp4box for multiplexing and x264 for encoding.
What I noticed is that when I try to open the file for decoding it requires lots of data to start even decoding the first packet.
I'm using FFMpeg library and on some large videos (aroun 1h 30 min ) this header is around 1.5 Mb.
Another thing I noticed is that if I use a higher profile when encoding with x264 this header size increases.
Is there some tool to check what inside this header?
thanks for any tips on that.
Bye
fsinapsi
15th October 2007, 11:39
I'm trying to understand what's in the header of a mp4 (h264 + aac).
you need to read ISO/IEC 14496-12 (and 14, 1...).
You can download 14496-12 from:
http://standards.iso.org/ittf/PubliclyAvailableStandards/
The structure of a MP4 file is explained in Table 1 ("Box types, structure, and cross reference").
For example, here is the structure of a typical MP4 muxed by Mp4Box:
http://img90.imageshack.us/img90/8116/mp4structureqk6.png
Lele-brz
15th October 2007, 12:18
hi,
thanks for the answer,
I will take a look at the standard, which is exactly the file to get there?
According to you is that normal that to start decoding the decoder needs so large amount of data. Is this because the decoder saves in memory all the possible displacements to use for seeking? No idea about that :-)
The only thing I noted is that it becomes larger if the duration of the video increases. Probably there's a way to compress it.
p.s: I'm using avinaptic and it's great !!!
fsinapsi
15th October 2007, 14:10
I will take a look at the standard, which is exactly the file to get there?
this file (http://standards.iso.org/ittf/PubliclyAvailableStandards/c038539_ISO_IEC_14496-12_2004(E).zip)
According to you is that normal that to start decoding the decoder needs so large amount of data. Is this because the decoder saves in memory all the possible displacements to use for seeking?
maybe...
avinaptic saves all the possibile displacements (and the size of each frame), too.
The only thing I noted is that it becomes larger if the duration of the video increases.
that's normal: larger duration implies larger "stbl" box (sample table box)
Probably there's a way to compress it.
maybe...
Lele-brz
15th October 2007, 15:21
thanks again,
I'll read all the standard.
I thought there was a way to reduce it cause I'm "streaming" the file block by block, and this header will add some overhead when starting playing a video.
So I was wondering if there was some kind of fast start like in the MOV, or a way to reduce this.
But probably, since I tried with other muxers, this is really part of an mp4 file and there's no way to reduce it.
Also it seems to depend on the profile, an high h264 profile when then multiplexed has a larger header than the same encoding with a baseline.
thanks again
ciao
Lele-brz
17th October 2007, 13:17
Hi all,
I'm using an mp4 (h264+aac) for streaming in a progressive download.
I noticed that there's a huge header, for instance 1,5 Mb for a video with length 1h 30 min.
I would like to reduce it, since I even found that when decoding it some part are not even read (let's say around 500k).
I'm using x264 + Mp4Box.
Is there a way to reduce this overhead?
thanks for any tips on that
bye
Lele-brz
17th October 2007, 18:17
Hi,
x Frank:
So you've never found a reduced header on the mp4 you analyzed?
Or some suggestion to have it as small as possible.
What I think is that there must be a way to avoid it, since when opening a x264 generated .h264 file VLC player can play and perform seeks on that.
Or maybe is the header already in the h264?
I tried to multiplex using a Matroska container and I had the same header size....
Any ideas?
Lele-brz
20th October 2007, 14:45
Hi,
I read recenlty the thread here about Progressive Download.
What is according to you the best way to encode a video (encoded with x264) for streaming it using a progressive download ?
What I'd like to reduce is the overhead before start decoding, so the time needed to download the header and metadata.
Does it depend on the container used?
Can Matroska reduce this overhead or maybe something like "QuickTime Fast-Start movie playback" ?
I'm not in the case where I want to hint the track since I'm not using a streaming server, I read somwhere about "timecodes", can they help?
thanks in advance for any help
bond
20th October 2007, 21:03
Lele-brz, stop posting tons of threads regarding your mp4 header streaming issue
i merged your posts into this single thread, keep it like this. you wont get more answers by asking over and over again
striked
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.