On Sep 11, 12:14 am, Ottavio Campana <
ocamp...@gmail.com> wrote:
> What's the meaning of the profile_compat and
> sampleLenFieldSizeMinusOne fields?
I'm not 100% certain because the official documentation is a bit
vague, but I found this:
http://fuzzylai.dynagrid.net/2008/02/correct-h264-sample-structure-in-mp4.html
"Usually an NALU is prefixed by the start code 0x00000001. To write it
as a sample in MP4 file format, just replace the start code with size
of the NALU(without 4-byte start code) in big endian. You also need to
specify how many bytes of the size value requires. Take libmp4v2 for
example, the last parameter in MP4AddH264VideoTrack(.., uint8_t
sampleLenFieldSizeMinusOne) indicate the number of byes minus one."
...so each sample you and to mp4v2 should be prefixed with a size code
(in big-endian, of course). I use a 4 byte size code, so
sampleLenFieldSizeMinusOne gets set to 3. This seems to work; my
files playback on just about everything. Perhaps one of the project
maintainers can clarify this, and it'd also be good to update the
documentation of that call to make this clear.