Please see my comment to the question, where I already tried to explain to you the essence of things. Due to the complicated character of the problem, I certainly cannot give you the whole solution; I only can tell you what to start with:
you have to start with finding out what you are dealing with. "MP4" does not tell anything certain on what it is.
But this step is pretty easy. The best tool to find is FFmpeg or libavcodec utility. More exactly, this is one of the provided utilities: ffProbe.exe. There is analogous utility based on libav build. Please see:
http://en.wikipedia.org/wiki/Ffmpeg[
^],
http://ffmpeg.org/[
^],
http://en.wikipedia.org/wiki/Libavcodec[
^],
http://libav.org/[
^].
Media Player Classic (for Windows, a must-have player, in my opinion) also copes with this problem pretty well:
http://en.wikipedia.org/wiki/Media_Player_Classic[
^],
http://mpc-hc.org/[
^].
After you find out what is it, you will need to find out the documentation of the file format of the respective container, and then the documentation on the streams used, as well as and muxing. And only then you can consider solving your problem itself. The difficulty of it depends on what it is.
See also:
http://en.wikipedia.org/wiki/Digital_container_format[
^],
http://en.wikipedia.org/wiki/Codec[
^],
http://en.wikipedia.org/wiki/MPEG-4[
^],
http://en.wikipedia.org/wiki/Demultiplexer_%28media_file%29[
^].
[EDIT]
By the way, as FFMpeg and libav are available in source code, you can read the code and find out how to work with nearly all formats and standards. That approach can solve any problems with those headers, like yours. However, I cannot say it will be easy.
—SA