GithubHelp home page GithubHelp logo

getid3's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

getid3's Issues

Write aiff metadata and add cover art.

Hello, is posible to add aiff metadata and cover art?
I am trying but I am getting the message that aiff not support ID3v2.2 tags.

Can you give me a simple example?
Thanks so much.
Best.
Pablo.

Multiple genres on AAC/M4A (quicktime) files treated as one tag

Initially reported on Ampache github issue tracker
ampache/ampache#970

Determined that mutliple genres, regardless of delimiter separator, are being treated as a single tag for quicktime audio files. For example, a quicktime file tagged with genre 'Rock;Hard Rock;Metal' will display that tag availability as 'Rock;Hard Rock;Metal'.

Confirmed that this same issue does not exist for MP3s. MP3s using the same tagging convention will split the tags as expected.

Setup phpunit

We need to get some unit tests set up, phpunit is the accepted way of running these so create a phpunit.xml configuration and a tests directory and update .gitattributes to not package them

Support for extracting images

Stumbled upon this awesome php library yesterday in my quest for an on demand and properly formatted JSON mp3 parser for use with an android app that I am building - cannot believe this library is this powerful in comparison with some of the outdated and inconvenient alternatives.
I am no good at php and yet I got the data I needed within minutes of copying this library to my server.
Now, I am working on adding cache support for the extracted data and extracting the album art - but first, I would like to make sure that it is possible to do so and how (meaning, can you provide a sample of how to do this with php - do I need an array of some sort to be able to take an embedded album art and output to a file with $fopen($filename, w)).
I have looked at the browse demo file but some of that code goes right over my head...

(Speaking of cache, the my sqlite3 db keeps growing instead of caching, just checked the tables and the data is the same, just duplicated - but that is another issue)

This is what I put together in order to build that JSON:

<?php

require_once('/volume1/auto/getID3/getid3/getid3.php');
//require_once('/volume1/auto/getID3/getid3/extension.cache.sqlite3.php');

setlocale(LC_ALL, 'en_US.UTF-8');

// Where are we running on?
// if (PHP_SAPI === 'cli') {
//     $argument1 = $argv[1];
//     $argument2 = $argv[2];
// } else {
//     $argument1 = $_GET['argument1'];
//     $argument2 = $_GET['argument2'];
// }

/*
 * @param Array $types
 * @abstract Array of allowed file types
 */
$types = ['mp3'];
$ignoreDir = ['@eaDir'];

/*
 * @name getList
 * @param Array $dir
 * @param Array $types
 * @param Array $ignoreDir
 * @abstract Recursively iterates over specified directory
 *           populating array based on array of file extensions
 *           while ignoring directories specified in ignoreDir
 * @return Array $files
 */

function getList($dir, $types, $ignoreDir) {
    $it = new RecursiveDirectoryIterator($dir);
    foreach (new RecursiveIteratorIterator($it) as $file) {
        if (in_array(strtolower(array_pop(explode('.', $file))), $types)) {
            if (!in_array($it, $ignoreDir)) {
                $files[] = $file->__toString();
            }
        }
    }
    return $files;
}

/*
 * @name getDetails
 * @param Array $dir
 * @param Array $types
 * @abstract Recursively iterates over specified directory
 *           populating array with details of each file
 * @return Array $files
 */

function getDetails($types, $array) {
    foreach ($types as $type) {
        $getID3 = new getID3;                                               // Initialize getID3 engine
        //$getID3 = new getID3_cached_mysql('localhost', 'getid3', 'id3', 'id3_cache', 'getid3_cache'); // MySQL
        //$getID3 = new getID3_cached_sqlite3($table='getid3_cache', $hide=FALSE);                      // SQLite3
        $getID3->encoding = 'UTF-8';
        foreach ($array as $file) {
            if (strcasecmp($type, array_pop(explode('.', $file))) == 0) {
                $info = $getID3->analyze($file);                            // Analyse each file
                //getid3_lib::CopyTagsToComments($info);                    // Copy tags to comments
                $title = $info['tags']['id3v2']['title'][0];                // title from ID3v2
                $artist = $info['tags']['id3v2']['artist'][0];              // artist from ID3v2
                $bitrate = round($info['audio']['bitrate'] / 1000).' kbps'; // audio bitrate
                $playtime = $info['playtime_string'];                       // playtime in minutes:seconds, formatted string
                $details = array(
                    'title' => $title,
                    'artist' => $artist,
                    'size' => filesize($file),
                    'bitrate' => $bitrate,
                    'playtime' => $playtime,
                    'source' => $file,
                    'date' => date ("F d Y H:i:s", filemtime($file))
                );
            $files[$type][] = $details;
            }
        }
    }
    return array('files' => $files);
}

$scanDir = ('/volume1/web/.apps/nightmistful/assets/');
$to_encode = getDetails($types, getList($scanDir, $types, $ignoreDir));
echo json_encode($to_encode, JSON_PRETTY_PRINT);
exit();

Add example files to tests/files/

We need some test files that we can run our test suite against. We have one for mp3, but nothing else.
They should be small files to keep the size of the repo down

Strict Errors

I'm getting these errors after moving to a new server, I've used this library for a long without any issues. I even have ~E_Strict turned off in php.ini but to no avail!

Strict Standards: Non-static method getid3_lib::IncludeDependency() should not be called statically, assuming $this from incompatible context in /home/rsv/subdomains/mwbe/admin/includes/getid3/getid3.php on line 266

Strict Standards: Non-static method getid3_lib::BigEndian2Int() should not be called statically, assuming $this from incompatible context in /home/rsv/subdomains/mwbe/admin/includes/getid3/module.tag.id3v2.php on line 99

Strict Standards: Non-static method getid3_lib::CastAsInt() should not be called statically, assuming $this from incompatible context in /home/rsv/subdomains/mwbe/admin/includes/getid3/getid3.lib.php on line 265

Strict Standards: Non-static method getid3_lib::trunc() should not be called statically, assuming $this from incompatible context in /home/rsv/subdomains/mwbe/admin/includes/getid3/getid3.lib.php on line 65

Strict Standards: Non-static method getid3_lib::BigEndian2Int() should not be called statically, assuming $this from incompatible context in /home/rsv/subdomains/mwbe/admin/includes/getid3/module.tag.id3v2.php on line 264

Strict Standards: Non-static method getid3_lib::CastAsInt() should not be called statically, assuming $this from incompatible context in /home/rsv/subdomains/mwbe/admin/includes/getid3/getid3.lib.php on line 265

Strict Standards: Non-static method getid3_lib::trunc() should not be called statically, assuming $this from incompatible context in /home/rsv/subdomains/mwbe/admin/includes/getid3/getid3.lib.php on line 65

Strict Standards: Non-static method getid3_lib::BigEndian2Int() should not be called statically, assuming $this from incompatible context in /home/rsv/subdomains/mwbe/admin/includes/getid3/module.tag.id3v2.php on line 283

Strict Standards: Non-static method getid3_lib::CastAsInt() should not be called statically, assuming $this from incompatible context in /home/rsv/subdomains/mwbe/admin/includes/getid3/getid3.lib.php on line 265

Strict Standards: Non-static method getid3_lib::trunc() should not be called statically, assuming $this from incompatible context in /home/rsv/subdomains/mwbe/admin/includes/getid3/getid3.lib.php on line 65

Strict Standards: Non-static method getid3_lib::CastAsInt() should not be called statically, assuming $this from incompatible context in /home/rsv/subdomains/mwbe/admin/includes/getid3/module.tag.id3v2.php on line 315

Arrays not working to write

demos/demo.simple.write.php (line 48):
'popularimeter' => array('email'=>'[email protected]', 'rating'=>128, 'data'=>0),

Always throw:
WriteID3v2() failed with message(s):
[email] not specified for POPM
Frame "POPM" is NOT allowed
$this->GenerateID3v2FrameData() failed for "POPM"
$this->GenerateID3v2Tag() failed

Too for 'unique_file_identifier', never find 'ownerid'

GPS Coordinates

We are trying to use getID3 to get meta data of videos uploaded to our service. It is working great but for some reason never returns any GPS information. The output we are receiving from ExifTool is here:
https://gist.github.com/CMDann/15f02efb3d71143b3677

Most important is this information:
GPS Altitude : 236 m
GPS Altitude Ref : Above Sea Level
GPS Latitude : 49 deg 40' 22.80" N
GPS Longitude : 97 deg 6' 24.12" W
GPS Position : 49 deg 40' 22.80" N, 97 deg 6' 24.12" W

The getID3 is super long so you can view it over here: https://gist.github.com/CMDann/8a0146b0e4644c858bdb

if it helps. Is there any way to get this information from getID3?

wrong encoding windows-1251

Hi
I have wrong encoding windows-1251
My code:
...
$getid3 = new getID3;
$getid3->encoding = 'UTF-8';
$fileinfo = $getid3->Analyze(Yii::getPathOfAlias('webroot').$file);
....
if( !empty($fileinfo['tags']['id3v1']['title']) ){
$audio->name = $fileinfo['tags']['id3v1']['title'][0];
}
...

fileinfo['tags']['id3v1']['title'][0] return string - "Ãîëàÿ" , but the correct result 'Голая'

I did that small fix in file getid3.lib.php:

...
public static function detect_encoding($string) {
static $list = array('ASCII', 'utf-8', 'windows-1251');
foreach ($list as $item) {
if (strcmp(@iconv($item, $item, $string), $string) == 0)
return $item;
}
return null;
}

public static function iconv_fallback($in_charset, $out_charset, $string) {

    if ($in_charset == $out_charset) {
        return $string;
    }

   // windows-1251 encoding
    if(self::detect_encoding($string) == 'windows-1251') {
        $converted_string = mb_convert_encoding($string, "utf-8", "windows-1251");
        return $converted_string;
    }

    // iconv() availble
    if (function_exists('iconv')) {
    if ($converted_string = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) {
        switch ($out_charset) {
            case 'ISO-8859-1':
                $converted_string = rtrim($converted_string, "\x00");
                break;
        }
        return $converted_string;
    }

    // iconv() may sometimes fail with "illegal character in input string" error message
    // and return an empty string, but returning the unconverted string is more useful
    return $string;
}

....

}

Specified key was too long; max key length is 1000 bytes

I ship getid3 with a Joomla extension, and have found that where users have a multi-byte default character set like UTF8 in MySQL, the create_table() in extension.cache.mysql.php blows up with "Specified key was too long; max key length is 1000 bytes", because the VARCHAR(500) filename field index winds up being too long, as each character is 3 bytes.

I've kind of hacked around it by adding "CHARACTER SET latin1" to the CREATE TABLE, although I'm not sure if this is a valid fix, as I'm really not sure what different OS's do with multibyte characters in filenames.

open_base_dir restriction

Can you consider changing this line to:

$tempdir = sys_get_temp_dir();

My php install has an open_base_dir restriction in effect and generating album art using getID3 floods my command line with warnings - an example is provided here.

Wrong mimetype for m4v files (video/quicktime)

The issue was first opened in:
ampache/ampache#909

The wrong mime-type is assigned to m4v files.
In the database table "video" it is "video/quicktime" which is not correct. Should be "video/mp4".
And not every browser supports quicktime as container.

During the scan following method is called:
GetFileFormat in getId3.php

The method iterates over a set of fileformat objects, that have a defined pattern field, which are checked with the header of the file(if it matches). Unfortunately it also matches with m4v files.

For quick time the entry is the following:
// QT - audio/video - Quicktime
'quicktime' => array(
'pattern' => '^.{4}(cmov|free|ftyp|mdat|moov|pnot|skip|wide)',
'group' => 'audio-video',
'module' => 'quicktime',
'mime_type' => 'video/quicktime',
)

Roadmap for 2.0?

Wanted to know if there's a roadmap for 2.0? Would like to contribute, but not sure where to start or what exactly is needed. Thanks 😄

Typo in composer.json

"name": "jamesheinrich/getid3", but it should be "name": "james-heinrich/getid3",

Composer support

This package does not currently have Composer support. There are a few forks that add such support. However, for including in my project, I prefer the main version to have the Composer support I need.

If I create a pull request that adds such support, can I expect it to be merged (assuming the PR done properly)?

Ensure all classes can be autoloaded

This has mostly been completed, although the Module\AudioVideo\Matroska class still uses some old dynamically generated class names.

We should create a document listing the old class names and their new ones as part of the upgrade guide

Setup travis-ci

Once we have unit testing configured (#28) then we can setup continuous integration using travis-ci to ensure our changes are tested against all php versions we support

Methods to clean a given file

Hi,

I have a bunch of files encoded by iTunes, which are poorly encoded. Besides the incorrect frame that was worked around some time ago in getID3, there are also a lot of other issues such as two COMM entries with the same language (eng) and the same description ("").

Then, any attempt to update tags on these files results in an error because they are invalid (just ignore the beginning of the lines, the part after the arrow is the errors from getID3):

2016-06-23 13:56:48 [phyks] (vainfo) -> Failed to write tags! ID3v2: Skipping "RECORDING_TIME" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "FILE" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "BITRATE" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "RATE" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "MODE" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "MIME" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "ALBUMARTIST" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "MB_TRACKID" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "MB_ALBUMID" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "MB_ARTISTID" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "MB_ALBUMARTISTID" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "TRACK" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "REPLAYGAIN_TRACK_GAIN" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "REPLAYGAIN_TRACK_PEAK" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "REPLAYGAIN_ALBUM_GAIN" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> ID3v2: Skipping "REPLAYGAIN_ALBUM_PEAK" because cannot match it to a known ID3v2 frame type 
2016-06-23 13:56:48 [phyks] (vainfo) -> WriteID3v2() failed with message(s):<pre><ul><li>Only one COMM tag allowed with the same Language + Description (eng + )</li><li>Frame &quot;COMM&quot; is NOT allowed</li><li>$this-&gt;GenerateID3v2FrameData() failed for &quot;COMM&quot;</li><li>$this-&gt;GenerateID3v2Tag() failed</li></ul></pre>

Skipped frames look ok, but the last fail is due to this COMM issue.

I could consider fixing them manually, one by one, but I think it would be really cool to have some "cleanup" method directly built-in getID3, which would mutualize efforts and most likely be safer than anything I could hack myself.

For instance, if I edit the tags of the songs using VLC, I do not have any issue and VLC manages to somehow rebuild a valid tag structure (or at least overcome invalid frames).

I can think of two solutions to this:

  • Either provide a boolean argument to be able to ignore errors and still write the (invalid) file, in the writer.
  • Or provide a cleanup function to be able to clean the file (and could optionally be called from the writer, issuing a warning accordingly).

This is actually linked to an issue encountered with tag edition in Ampache (see ampache/ampache#1271). As Ampache is used by people with various technical background, it would be better to be able to clean files or ignore errors, rather than having to ask people to fix the files by themselves.

Thanks a lot!

Declaration of getID3_cached_sqlite3

hi, how do i fix this bug?

Declaration of getID3_cached_sqlite3::analyze() should be compatible with getID3::analyze($filename, $filesize = NULL, $original_filename = '') in extension.cache.sqlite3.php on line 265

i think here is the cause

public function analyze($filename) {
...
$analysis = parent::analyze($filename);
...
}

Move global constants to class constants

We have a load of constants that are relevant to particular classes, but are created into the global namespace, these should be added to the classes they relate to

Working with temp files

The following functions in PHP fail to provide the correct result with files created using tempnam(…) function

  • is_readable
  • is_writeable

Imagine a file is being read into a tempfile from the internet, getID3 will fail to process it.

PHP 5.5.30

PHP version requirement for 1.9.8?

There's nothing noting it that I can see in the changelog or the getID3 homepage, but version 1.9.8 now appears to require PHP 5.3 or higher.

Is that intended?

(Unrelated note: the homepage seems to be off by a year on the release date of 1.9.8)

Remove support for deprecated/removed php features

The minimum php version we will support is 5.4, so anything that was removed by then should not be used/considered inside getID3.

We should also look to avoid any deprecated features, the obvious one is the mysql cache which uses the mysql_ functions, but there are a few others. We could provide an interface to allow developers to create their own cache handlers

This will likely need multiple issues to follow once we've identified all the features that need updating

Japanese tags

I upload mp3 files with Japanese tags and get '???' in the fields. How to fix it?

BOM showing as text in TXXX tag description

I have some files encoded in UTF-16 and if I check the frame headers of the TXXX tags, the encoding byte is set to 01.

encoding

But when getid3 reads the TXXX tags, it shows the bom before the text description. I don't think it's the tagger - tried both mp3tag and picard. Here it is in mp3tag showing the charset and the extended tags:

charset

mp3tag

and here is the output from demo.basic.php:

bom1

Then if I look at the same file in mp3diag it shows the bom on the text value which is what I thought getid3 was doing at first:

mp3diags

Confusing. Any ideas?

GetID3 and Php 7

Hi,

GetID3 uses a lot the "list()" function, but its behavior has changed in php7. Don't check for other changes, but do you plan to update getId3 1.x?

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

Files with UTF-16 TIT2 (and others) have invalid bytes before name

I have some files that have utf-16 titles. When looking at them in demo.browse, the values get prefixed with invalid characters. These show up as ? chars in my browser, but looking at the returned data, they are not valid utf-16 either. For instance, for one file, the comments_html section contains:

album   array (1)   0   string (22)     &#2089536;[correct subsequent characters for album]

This is for a number of different files, and other tools process the tags correctly.

Let me know if you need more info, or what else I can do to help track down what's wrong. I'm on version 1.9.10-20150914

Release 1.9.8

Since there are quite some bug fixes in, after the previous release, how about making a new one?

getID3 replaces "gs://" with "gs:/" in Google Cloud Storage filenames leading file not found errors

Hi,

I was trying to integrate getID3 in a google app engine project, I am currently working on. We use google cloud storage for storing audio files. The PHP runtime on appengine has the Google Cloud Storage stream wrapper built in, thus allowing use of standard PHP file system functions to access the objects using the 'gs://' stream.

However getID3 replaces the two forward slashes in 'gs://' with a single slash thus making the file path invalid and eventually failing (since it could not find the file).

I am using (if it is relevant by any chance)

  • getID3 v1.9.9
  • PHP 5.5 running on Google app engine

Thanks

No meta from m4a files

Scanning through the moov array I am not seeing any artist or title information being retrieved from these files, nor do they show up in comments or tags.

They do show up in other players, like VLC here.
VLC media info

Download m4a file from MediaFire

Note that moov udta meta has a 4149 size, but no sub atoms.

Array
(
    [GETID3_VERSION] => 1.9.11-201512241248
    [filesize] => 13771853
    [filepath] => /var/music/Techno/Len Faki
    [filename] => Len Faki - Death by House.m4a
    [filenamepath] => /var/music/Techno/Len Faki/Len Faki - Death by House.m4a
    [avdataoffset] => 80021
    [avdataend] => 13771853
    [fileformat] => mp4
    [audio] => Array
        (
            [dataformat] => mp4
            [codec] => ISO/IEC 14496-3 AAC
            [sample_rate] => 44100
            [channels] => 2
            [bits_per_sample] => 16
            [lossless] => 
            [channelmode] => stereo
            [bitrate] => 253589.07610741
            [compression_ratio] => 0.17969747456591
            [streams] => Array
                (
                    [0] => Array
                        (
                            [dataformat] => mp4
                            [codec] => ISO/IEC 14496-3 AAC
                            [sample_rate] => 44100
                            [channels] => 2
                            [bits_per_sample] => 16
                            [lossless] => 
                            [channelmode] => stereo
                            [bitrate] => 253589.07610741
                            [compression_ratio] => 0.17969747456591
                        )

                )

        )

    [video] => Array
        (
            [resolution_x] => 0
            [resolution_y] => 0
            [frame_rate] => 43.06640625
            [dataformat] => quicktime
        )

    [comments] => Array
        (
            [language] => Array
                (
                    [0] => Undetermined
                )

        )

    [encoding] => UTF-8
    [mime_type] => audio/mp4
    [quicktime] => Array
        (
            [hinting] => 
            [controller] => standard
            [ftyp] => Array
                (
                    [hierarchy] => ftyp
                    [name] => ftyp
                    [size] => 32
                    [offset] => 0
                    [signature] => M4A 
                    [unknown_1] => 0
                    [fourcc] => M4A 
                )

            [moov] => Array
                (
                    [hierarchy] => moov
                    [name] => moov
                    [size] => 79981
                    [offset] => 32
                    [subatoms] => Array
                        (
                            [0] => Array
                                (
                                    [hierarchy] => moov mvhd
                                    [name] => mvhd
                                    [size] => 108
                                    [offset] => 40
                                    [version] => 0
                                    [flags_raw] => 0
                                    [creation_time] => 3535552270
                                    [modify_time] => 3535552270
                                    [time_scale] => 44100
                                    [duration] => 19048448
                                    [preferred_rate] => 1
                                    [preferred_volume] => 1
                                    [reserved] => 
                                    [matrix_a] => 1
                                    [matrix_b] => 0
                                    [matrix_u] => 0
                                    [matrix_c] => 0
                                    [matrix_d] => 1
                                    [matrix_v] => 0
                                    [matrix_x] => 0
                                    [matrix_y] => 0
                                    [matrix_w] => 1
                                    [preview_time] => 0
                                    [preview_duration] => 0
                                    [poster_time] => 0
                                    [selection_time] => 0
                                    [selection_duration] => 0
                                    [current_time] => 0
                                    [next_track_id] => 2
                                    [creation_time_unix] => 1452707470
                                    [modify_time_unix] => 1452707470
                                )

                            [1] => Array
                                (
                                    [hierarchy] => moov trak
                                    [name] => trak
                                    [size] => 75708
                                    [offset] => 148
                                    [subatoms] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [hierarchy] => moov trak tkhd
                                                    [name] => tkhd
                                                    [size] => 92
                                                    [offset] => 156
                                                    [version] => 0
                                                    [flags_raw] => 15
                                                    [creation_time] => 3512359584
                                                    [modify_time] => 3535552270
                                                    [trackid] => 1
                                                    [reserved1] => 0
                                                    [duration] => 19048448
                                                    [reserved2] => 0
                                                    [layer] => 0
                                                    [alternate_group] => 0
                                                    [volume] => 1
                                                    [reserved3] => 0
                                                    [matrix_a] => 1
                                                    [matrix_b] => 0
                                                    [matrix_u] => 0
                                                    [matrix_c] => 0
                                                    [matrix_d] => 1
                                                    [matrix_v] => 0
                                                    [matrix_x] => 0
                                                    [matrix_y] => 0
                                                    [matrix_w] => 1
                                                    [width] => 0
                                                    [height] => 0
                                                    [flags] => Array
                                                        (
                                                            [enabled] => 1
                                                            [in_movie] => 1
                                                            [in_preview] => 1
                                                            [in_poster] => 1
                                                        )

                                                    [creation_time_unix] => 1429514784
                                                    [modify_time_unix] => 1452707470
                                                )

                                            [1] => Array
                                                (
                                                    [hierarchy] => moov trak mdia
                                                    [name] => mdia
                                                    [size] => 75608
                                                    [offset] => 248
                                                    [subatoms] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [hierarchy] => moov trak mdia mdhd
                                                                    [name] => mdhd
                                                                    [size] => 32
                                                                    [offset] => 256
                                                                    [version] => 0
                                                                    [flags_raw] => 0
                                                                    [creation_time] => 3512359584
                                                                    [modify_time] => 3535552270
                                                                    [time_scale] => 44100
                                                                    [duration] => 19048448
                                                                    [language_id] => 21956
                                                                    [quality] => 0
                                                                    [creation_time_unix] => 1429514784
                                                                    [modify_time_unix] => 1452707470
                                                                    [playtime_seconds] => 431.93759637188
                                                                    [language] => Undetermined
                                                                )

                                                            [1] => Array
                                                                (
                                                                    [hierarchy] => moov trak mdia hdlr
                                                                    [name] => hdlr
                                                                    [size] => 33
                                                                    [offset] => 288
                                                                    [version] => 0
                                                                    [flags_raw] => 0
                                                                    [component_type] => 
                                                                    [component_subtype] => soun
                                                                    [component_manufacturer] => 
                                                                    [component_flags_raw] => 0
                                                                    [component_flags_mask] => 0
                                                                    [component_name] => 
                                                                )

                                                            [2] => Array
                                                                (
                                                                    [hierarchy] => moov trak mdia minf
                                                                    [name] => minf
                                                                    [size] => 75535
                                                                    [offset] => 321
                                                                    [subatoms] => Array
                                                                        (
                                                                            [0] => Array
                                                                                (
                                                                                    [hierarchy] => moov trak mdia minf smhd
                                                                                    [name] => smhd
                                                                                    [size] => 16
                                                                                    [offset] => 329
                                                                                    [version] => 0
                                                                                    [flags_raw] => 0
                                                                                    [balance] => 0
                                                                                    [reserved] => 0
                                                                                )

                                                                            [1] => Array
                                                                                (
                                                                                    [hierarchy] => moov trak mdia minf dinf
                                                                                    [name] => dinf
                                                                                    [size] => 36
                                                                                    [offset] => 345
                                                                                    [subatoms] => Array
                                                                                        (
                                                                                            [0] => Array
                                                                                                (
                                                                                                    [hierarchy] => moov trak mdia minf dinf dref
                                                                                                    [name] => dref
                                                                                                    [size] => 28
                                                                                                    [offset] => 353
                                                                                                    [version] => 0
                                                                                                    [flags_raw] => 0
                                                                                                    [number_entries] => 1
                                                                                                    [data_references] => Array
                                                                                                        (
                                                                                                            [0] => Array
                                                                                                                (
                                                                                                                    [size] => 12
                                                                                                                    [type] => url 
                                                                                                                    [version] => 0
                                                                                                                    [flags_raw] => 1
                                                                                                                    [data] => 
                                                                                                                    [flags] => Array
                                                                                                                        (
                                                                                                                            [self_reference] => 1
                                                                                                                        )

                                                                                                                )

                                                                                                        )

                                                                                                )

                                                                                        )

                                                                                )

                                                                            [2] => Array
                                                                                (
                                                                                    [hierarchy] => moov trak mdia minf stbl
                                                                                    [name] => stbl
                                                                                    [size] => 75475
                                                                                    [offset] => 381
                                                                                    [subatoms] => Array
                                                                                        (
                                                                                            [0] => Array
                                                                                                (
                                                                                                    [hierarchy] => moov trak mdia minf stbl stsd
                                                                                                    [name] => stsd
                                                                                                    [size] => 91
                                                                                                    [offset] => 389
                                                                                                    [version] => 0
                                                                                                    [flags_raw] => 0
                                                                                                    [number_entries] => 1
                                                                                                    [sample_description_table] => Array
                                                                                                        (
                                                                                                            [0] => Array
                                                                                                                (
                                                                                                                    [size] => 75
                                                                                                                    [data_format] => mp4a
                                                                                                                    [reserved] => 0
                                                                                                                    [reference_index] => 1
                                                                                                                    [encoder_version] => 0
                                                                                                                    [encoder_revision] => 0
                                                                                                                    [encoder_vendor] => 
                                                                                                                    [audio_channels] => 2
                                                                                                                    [audio_bit_depth] => 16
                                                                                                                    [audio_compression_id] => 0
                                                                                                                    [audio_packet_size] => 0
                                                                                                                    [audio_sample_rate] => 44100
                                                                                                                    [temporal_quality] => 131088
                                                                                                                    [spatial_quality] => 0
                                                                                                                    [width] => 44100
                                                                                                                    [height] => 0
                                                                                                                    [resolution_x] => 25971.392379761
                                                                                                                    [resolution_y] => 0
                                                                                                                    [data_size] => 51970049
                                                                                                                    [frame_count] => 4
                                                                                                                    [compressor_name] => �@�
                                                                                                                    [pixel_depth] => 0
                                                                                                                    [color_table_id] => 0
                                                                                                                )
                                                                                                        )

                                                                                                )

                                                                                            [1] => Array
                                                                                                (
                                                                                                    [hierarchy] => moov trak mdia minf stbl stts
                                                                                                    [name] => stts
                                                                                                    [size] => 24
                                                                                                    [offset] => 480
                                                                                                    [version] => 0
                                                                                                    [flags_raw] => 0
                                                                                                    [number_entries] => 1
                                                                                                    [time_to_sample_table] => Array
                                                                                                        (
                                                                                                            [0] => Array
                                                                                                                (
                                                                                                                    [sample_count] => 18602
                                                                                                                    [sample_duration] => 1024
                                                                                                                )

                                                                                                        )

                                                                                                )

                                                                                            [2] => Array
                                                                                                (
                                                                                                    [hierarchy] => moov trak mdia minf stbl stsc
                                                                                                    [name] => stsc
                                                                                                    [size] => 52
                                                                                                    [offset] => 504
                                                                                                )

                                                                                            [3] => Array
                                                                                                (
                                                                                                    [hierarchy] => moov trak mdia minf stbl stsz
                                                                                                    [name] => stsz
                                                                                                    [size] => 74428
                                                                                                    [offset] => 556
                                                                                                )
                                                                                            [4] => Array
                                                                                                (
                                                                                                    [hierarchy] => moov trak mdia minf stbl stco
                                                                                                    [name] => stco
                                                                                                    [size] => 872
                                                                                                    [offset] => 74984
                                                                                                )

                                                                                        )

                                                                                )

                                                                        )

                                                                )

                                                        )

                                                )

                                        )

                                )

                            [2] => Array
                                (
                                    [hierarchy] => moov udta
                                    [name] => udta
                                    [size] => 4157
                                    [offset] => 75856
                                    [subatoms] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [hierarchy] => moov udta meta
                                                    [name] => meta
                                                    [size] => 4149
                                                    [offset] => 75864
                                                    [version] => 0
                                                    [flags_raw] => 0
                                                    [subatoms] => 
                                                )

                                        )

                                )
                            [3] => Array
                                (
                                    [hierarchy] => moov mdat
                                    [name] => mdat
                                    [size] => 13691840
                                    [offset] => 80013
                                )

                        )

                )

            [time_scale] => 44100
            [display_scale] => 1
            [video] => Array
                (
                    [resolution_x] => 0
                    [resolution_y] => 0
                )

            [audio] => Array
                (
                    [codec] => mp4
                    [sample_rate] => 44100
                    [channels] => 2
                    [bit_depth] => 16
                )

            [stts_framecount] => Array
                (
                    [0] => 18602
                )

            [mdat] => Array
                (
                    [hierarchy] => mdat
                    [name] => mdat
                    [size] => 13691840
                    [offset] => 80013
                )

            [encoding] => UTF-8
        )

    [playtime_seconds] => 431.93759637188
    [bitrate] => 253589.07610741
    [playtime_string] => 7:12
)

wrong break

getid3lib.php line 285

{
                throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits ('.strlen($byteword).') in self::BigEndian2Int()');
                break;
            }

break is incorrect, since we are in level 1 - could be removed, because of the exception.

UTF-8 encoding of metadata

Hi,
I'm looking at your module. It looks very convenient and usefull.
Did you consider UTF-8 encoding of metadata ?
Like IPTC tags and EXIF can be utf encoded strings for images.

Just an example. The copyright information can of course contain ©MyName, but when I look with getID3-master/demos/demo.browse.php at an image having this copyright Notice in the IPTC it is shown as ?MyName, so the copyright character is not ok any more.

invalid foreach() arguement

full text of the error message:

WARNING: Invalid argument supplied for foreach() in D:\test_sites\master\zp-core\zp-extensions\class-video\getid3\module.audio-video.quicktime.php on line 207 getid3_quicktime->QuicktimeParseAtom called from getid3_quicktime->QuicktimeParseContainerAtom (module.audio-video.quicktime.php [1421]) from getid3_quicktime->QuicktimeParseAtom (module.audio-video.quicktime.php [1382]) from getid3_quicktime->QuicktimeParseContainerAtom (module.audio-video.quicktime.php [1421]) from getid3_quicktime->QuicktimeParseAtom (module.audio-video.quicktime.php [199]) from getid3_quicktime->QuicktimeParseContainerAtom (module.audio-video.quicktime.php [1421]) from getid3_quicktime->QuicktimeParseAtom (module.audio-video.quicktime.php [199]) from getid3_quicktime->Analyze (module.audio-video.quicktime.php [118]) from getID3->analyze (getid3.php [428])

Invalid argument supplied for foreach - Line 1229

Using version 1.9.7-20130705 of getID3 we're getting the following error occasionally:

PHP Warning: Invalid argument supplied for foreach() in /path/to/getid3/getid3.lib.php on line 1229 (I changed the path shown in the error).

Unfortunately we haven't got a test file to give as it came from a user, just showed up in our error log on a busy system.. so there's no easy way of finding the user/file which caused it. I just know it was either a WAV or MP3 file.

Any ideas?

Cyrillics detect fix

Hello, guys! I'm from russian-speaking country and I must notice, that the "ID3v1 encoding detection hack" in the getid3.php line 1246 does not work.

This code looks through all the tags, looking for one which contains only cyrillics:

if (preg_match('#^[\\x80-\\xFF]+$#', $value))

But no one of them match because of..... spaces :-) Cause 0x80...0xFF covers only the alphabet and does not cover special chars, see: http://vk.cc/5ua21p

So, if we rewrite it like this '#^[\\x00-\\x40\\xA8\\B8\\x80-\\xFF]+$#' we'll make the world better.

beforeafter

Actually I can't say it will fix 100% tracks, cause it's not uncommon to name a group or track with latin includings. Like The Very Best Of (cyrillic_artist_name), or foreign artist with only the song name translated, or special remarks like "Luciano Pavarotti - Вернись в Сорренто (remastered)". And so on.

Test .mp3 set: https://yadi.sk/d/1DZiwg8ru8h4M

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.