> 2GB support

The place for "I can't figure out how to..." questions.
Post Reply
Posts: 2
Joined: Sat Apr 01, 2006 7:03 am

> 2GB support

Post by nerolabs » Tue Apr 11, 2006 12:33 am

Hello All --

I have a bunch of files I'm trying to analyze with getID3. Seems like the 2GB limit in PHP is strictly enforced in getID3.php, unless you edit the file to turn checking off for this with a configuration variable.

There are a couple resources I've found that says you can truly get php itself to support files larger than 2GB. Someone on a forum on php.net mentioned that you can recompile with CFLAGS="-D_FILE_OFFSET_BITS=64".

The second in this forum itself suggests that getID3 be given an option to just check the first 100KB or so of a file an the last 100KB or so of a file to get the information needed.

Any getID3 developers care to shed light on the issue? Just looking for the best way to support > 2GB files in my application.



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

Post by Allan Hansen » Mon May 01, 2006 12:42 pm

1. You do no need to edit getid3.php in order to disable the 2Gb check:

$getid3 = new getID3();
$getid3->option_max_2gb_check = false;

2. Integers in PHP are signed 32 bit. There is no way to get PHP to ise 64 bit integers. This means all whle numbers in PHP are within the range +-2 billion. getID3() has no (or little) problems reading first and last part of the file, but all calculations involving the filesize will be flawed. This is usually bitrate and sometimes playtime. Nothing we can do to avoid this problem.

Posts: 1
Joined: Mon Jan 15, 2007 4:05 pm
Location: Belarus

Post by macondos » Mon Jan 15, 2007 4:19 pm

Index: getid3.php
// set parameters
- $this->info['filesize'] = filesize($filename);
+ $this->info['filesize'] = sprintf("%u", filesize($filename));

Limit increase to 4 GB

Post Reply