Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing H264 in mdat MP4

Tags:

h.264

mp4

I have a file that only contains the mdat atom in a MP4 container. The data in the mdat contains AVC data. I know the encoding parameters for the data. The format does not appear to be in the Annex B byte stream format. I am wondering how I would go about parsing this. I have tried searching for the slice header, but have not had much luck.

Is it possible to parse the slices without the NAL's?

like image 684
Steve McFarlin Avatar asked Apr 04 '11 21:04

Steve McFarlin


2 Answers

AVC NAL units are in the following format in MDAT section: [4 bytes] = NAL length, network order; [NAL bytes] Shortly, start codes are simply replaced by lengths.

like image 94
michael Avatar answered Sep 19 '22 08:09

michael


Be careful! The NAL Length is not required to be 4! The AvcConfigurationBox ('moov/trak/mdia/minf/stbl/stsd/avc1/avcC') contains a field 'lengthSizeMinusOne' specifying the length. But the default is 4.

like image 37
Sebastian Annies Avatar answered Sep 19 '22 08:09

Sebastian Annies