Log in

View Full Version : mdat in mp4 file


tokeiro
11th January 2006, 14:09
Hi all.
i'm trying to do an aplication that capture rtp packet of a streaming server and make an mp4 file.the samples on the rtp packets are encoded in h264.
My problem its how to store the samples on mdat box.i have an mp4 file encoded in h264 and i stream it.then i analyse the rtp packets and there's some information that are on mp4 file that isn't send over packet and i know that information stored on file isn't hint track information.
Ex:
00 00 00 00 6D 64 61 74 00 00 00 0C 06 00 07 8A ; ....mdat.......Š
BA 95 00 00 03 00 40 80 ; º•....@€
and on the first rtp packet payload has only 06 00 07 8A BA 95 00 00 03 00 40 80.
what's 00 00 00 0c?? its the size??it makes sinse??

Best regards

Rui Silva

Kolich
11th January 2006, 14:28
00 00 00 00 6D 64 61 74 00 00 00 0C 06 00 07 8A ; ....mdat.......Š
BA 95 00 00 03 00 40 80 ; º•....@€


00 00 00 00 is size of the mdat atom (it could not be 0). all bytes, after 6D 64 61 74 ("mdat") is media data, and should be sent to decoder.

tokeiro
11th January 2006, 16:04
you're wright.i past the wrong lines :)

00 0E 6B 6B 6D 64 61 74 00 00 00 08 77 69 64 65 ; ..kkmdat....wide
00 00 00 00 6D 64 61 74 00 00 00 0C 06 00 07 8A ; ....mdat.......Š
BA 95 00 00 03 00 40 ; º•....@

but i dont know what's 00 00 00 0C next to second "mdat", and why i it'n not send on the rtp packets.
best regards

Kolich
11th January 2006, 16:26
http://www.rfcsearch.org/rfcview/RFC/3984.html
check this article.

i think, they are removed, because it's startcodes.

mediator
12th January 2006, 20:50
It is not only writing the data to the mdat. Writing a compliant MPEG-4 file means alot more. ISO 14496-1/-12/-14 and the said RFC will help you understand. You should try to understand the high level things on how AVC frames can look like and the stuff from the RFC. Then probably search for your preferred MP4 writing library. It will do the job to write mdat for you.

bond
12th January 2006, 21:29
http://standards.iso.org/ittf/PubliclyAvailableStandards/c041828_ISO_IEC_14496-12_2005(E).zip

tokeiro
14th January 2006, 00:40
Thank's for your help.
Bond i've already that document and and don't find information about how the sample are organized on "mdat" box,what are the bytes behind the sample information.
Could you help me?
Mediator where can i find iso 14496-14?i dont find information on 14496-1,-12 about how samples are stored on mdat box!
thanks again!

bond
14th January 2006, 00:51
for how avc is stored in mp4 look at this:
http://www.itscj.ipsj.or.jp/sc29/open/29view/29n5245t.doc

anaxamander
14th January 2006, 20:43
00 00 00 00 is size of the mdat atom (it could not be 0).

It could be - the specification says that if 0, it stretches to EOF. If 1 it's 64 bit.

tokeiro
19th January 2006, 22:37
Hi again.
Thanks for your help but i still dont know what to sote on mdat box.
Is there any open source project that capture rtp packets encoded on h264 and make mp4 file with these packets??
Best regards

Rui Silva