Thursday, January 8, 2009

MP4Box - Out Of Memory

It wasn't this easy to find out.  It all started from when I was trying to convert my son's favorite dinosaur DVD's to h264 files.  I have a script, that calls for ffmpeg, feeding in parameters, and have the h264 files generated to the directories I want, then run MP4Box to hint them.  There were a dozen of them.  Encoding h264 isn't anything for the impatient.  So I left it running.  Day after day, there were some new h264 file created.  Then all done, finally.  But I found 2 largest VOB files (4.4 GB and 4.3 GB) ended up to be converted to mp4 files of 68 bytes each.  Bummer!

Of course I first thought it was ffmpeg, that it might have overflow problem.  Long story short, it was not.  I suddenly remembered that there was MP4Box hinting invoked at the end of the script.  Then I broke it into 2 steps, or course, ffmpeg got me a good unhinted mp4 file.  While I tried to run MP4Box on it, it gave me 

[iso file] Read Box "..A." failed (Out Of Memory)

I was using MP4Box from gpac 0.4.4.  Upgrading to gpac 0.4.5 fixed it.  What was unbelievable was 0.4.5 wasn't out until Dec 2008.  And until then, no one had such problem?  MP4Box isn't anything new to world.  Neither is DVD.  How come the fix isn't out until a month ago?  Weird.

A little side story on this.  When I first upgraded it, I did not see the upgrade fixing the problem.  What happened was that I made a build with the new source code, and ran the new MP4Box locally.  It did not work because it was pulling the libgpac.so from system directory, which was still the older version, because I did not "make install" the new version yet.  Seeing it not working, I was so pumped up to fix it myself.  So I loaded up ddd debugger.  That was where I found out it was using the libgpac.so of the older version.  So that took me no time.  Just that I did not get to have the sense of accomplishment.  But I am happy it is working now.

1 comment:

Zazza said...

Greetings,
I'm having the same problem trying to demux a ~8GB .mp4 for extracting the video track.
I've used 0.4.5 (devel and not) and 0.4.6 devel but instantly or later I get the "out of memory" error.
Could you eventually provide me your compiled version? Thanks.