Parsing MP4 variants within Quicktime MOV containers

What features would you like to see in future versions of getID3() ?
Post Reply
filmo
User
Posts: 22
Joined: Fri Dec 08, 2006 7:16 pm
Location: Los Angeles

Parsing MP4 variants within Quicktime MOV containers

Post by filmo » Sun Jan 13, 2008 7:41 pm

would love to see better support for reading video information on MOV files containing:

Apple MPEG4 within a MOV container.
H.264 within a MOV container.

Is there a generic 'module' template that we can use as developer as a guideline for building a module. I've looked at a couple of the already developed modules, but it's be great if there was a highly documented one that spelled out the steps necessary for building a module.

Allan Hansen
getID3() v2 developer
Posts: 445
Joined: Sun May 04, 2003 2:22 pm
Location: Holmegaard, Denmark

Post by Allan Hansen » Sun Jan 13, 2008 9:20 pm

Take a look at the audio.mpc module. The mpc module is very simple and the module is the closest thing to a template.

James Heinrich
getID3() v1 developer
Posts: 1457
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Post by James Heinrich » Sun Jan 13, 2008 10:38 pm

If you have them available, I'd be interested in some small sample files as you describe (mpeg4/h264 in mov).

filmo
User
Posts: 22
Joined: Fri Dec 08, 2006 7:16 pm
Location: Los Angeles

I'll post some small samples soon

Post by filmo » Mon Jan 14, 2008 5:40 pm

I'll create some 240x180 quicktime files with H.264 and Apple MPEG4 contained within each separate file. Probably about 30 seconds long each in order to keep the size down.

If they're small enough, I can email them to you otherwise I can post to our server and provide you with a download link.

James Heinrich
getID3() v1 developer
Posts: 1457
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Post by James Heinrich » Tue Jan 15, 2008 1:51 am

That would be perfect. If it's not too much trouble, I prefer a download link from your server. But if they're <= 1MB then emailing them is OK too. Thanks.

filmo
User
Posts: 22
Joined: Fri Dec 08, 2006 7:16 pm
Location: Los Angeles

Links to Quicktime and MP4 video clips.

Post by filmo » Tue Jan 15, 2008 7:11 pm

Hi here's a set of links:

Raw MP4 files:
http://www.ridiculousprods.com/gas/320x ... G4_AAC.mp4
Encoded using Apple MPEG 4, AAC for audio (stereo 44.1khz), 320x240 (letterboxed), 12 fps

http://www.ridiculousprods.com/gas/320x240_H264_AAC.mp4
Encoded using H.264, AAC for audio (stereo 44.1khz), 320x240 (letterboxed), 29.97 fps

Here are the Quicktime Container Versions:
http://www.ridiculousprods.com/gas/320x ... G4_AAC.mov
Encoded using Apple MPEG 4, AAC for audio (stereo 44.1khz), 320x180 (16:9), 12 fps

http://www.ridiculousprods.com/gas/320x180_H264_AAC.mov
Encoded using H.264, AAC for audio (stereo 44.1khz), 320x180 (16:9), 12 fps

iPod Video
http://www.ridiculousprods.com/gas/ipod.m4v
Encoded using H.264, AAC for audio (stereo 44.1khz), 640x360 (16:9). It plays at 30 fps, but Quicktime 'read' the fps at 1.35 when opened in Quicktime 7.3.1


My grok that helped somewhat in the current module.audio-video.quicktime.php was to add this change in several places. It seems like some Quicktime files contain an almost infinite loop of subatoms, particularly if they're large. This code helped to avoid 'out-of-memory' conditions and slow performance. I don't fully understand the subatoms, so it's certainly just a hack.

Code: Select all

					
case 'stsd': // Sample Table Sample Description atom
    $atomstructure['version']        = getid3_lib::BigEndian2Int(substr($atomdata,  0, 1));
    $atomstructure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atomdata,  1, 3)); // hardcoded: 0x0000
    $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata,  4, 4));
    
    // limit recurrsion into subatoms - phil glau
    if ($atomstructure['number_entries'] > 10) {
        $atomstructure['number_entries'] = 10;
    }
    // end of modification by phil glau
    
    $stsdEntriesDataOffset = 8;

Using these 4 files, the module.audio-video.quicktime.php correctly reports the length, audio sample rate, and bit rate for the MOV files.

For the MP4 files however I get inconsistent results. The Apple MPEG 4 file doesn't provide useful results at all. The H.264 one gives the correct file length, but fails to identify the frequency rate of the audio.

I suspect processing for ".mp4" files is handled by module.audio-video.mpeg.php instead of the quicktime module. I've not made any changes to this one.

Perhaps the sample rates, lengths, and audio frequencies are stored in a separate location in Quicktime Containers versus a raw MP4 file, but I don't know.

I've not tried getID3 on the iPod video but that seems to be a popular format as well, so I've included it.

Post Reply