64 bit support for large files

The place for "I can't figure out how to..." questions.
Post Reply
jlegate
User
Posts: 3
Joined: Fri Aug 24, 2007 5:07 am
Location: SF

64 bit support for large files

Post by jlegate » Fri Aug 24, 2007 5:12 am

Using 1.7.7, I've got a 25GB .mov file, and when getid3 starts reading through the atoms, it reads the mdat atom size as 1 byte. Anyone have any ideas? Should I upgrade to 2?

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

Post by Allan Hansen » Fri Aug 24, 2007 5:42 am

PHP does not support 64 bit integers. Very nasty limit, but nothing we can do about it.

jlegate
User
Posts: 3
Joined: Fri Aug 24, 2007 5:07 am
Location: SF

gmp maybe?

Post by jlegate » Fri Aug 24, 2007 6:08 am

Would there be a desire to maybe implement gmp to handle stuff like that? I know that I actually have a real need for it, since this file is the first of its kind in a long slew of them I'll be handling with getID3 (which I love, btw).

I'd be willing to putz around with it a bit if the desire is truly there. It looks like the QT reference says that if the atom size is 1, then the 64 bits after the atom type is the extended size (also big endian).

I'll try some things here...

jlegate
User
Posts: 3
Joined: Fri Aug 24, 2007 5:07 am
Location: SF

some success

Post by jlegate » Fri Aug 24, 2007 6:18 am

Just for giggles, I tried something and it worked, and was able to parse the file properly. By adding the following in getid3_quicktime() after
$atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4));

if($atomsize == 1) {
$high_byte = fread($fd, 4);
$low_byte = fread($fd, 4);
$atomsize = ((float) getid3_lib::BigEndian2Int($high_byte) << 32) + ((float) getid3_lib::BigEndian2Int($low_byte));
}

It now fseek()'s properly, and gets the whole of the data.

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

Post by James Heinrich » Tue Oct 16, 2007 12:37 pm

I have added some experimental support for files > 2GB for v1.7.8b3
Most files should be mostly-parseable, at least for data that exists in the first 2GB of the file. ID3v1 and other data that exists at the end of large files will be inaccessible. Quicktime movies that are hinted (metadata at the head of the file rather than the end) should parse reasonably well, but >2GB files that are not hinted will just be detected as Quicktime with no other metadata (resolution, bitrate, playtime, etc).

Post Reply