Nice script.. Short and concise.  Havn't tested it yet, but I like short
and concise. :)

One thing to note..   This appears to handle ID3v1 tags (which are
stored at the beginning of the file).  ID3v2 tags are stored at the end
of the MP3 and are a little trickier to deal with but they can hold a
lot more information.  Check out this:

http://nyphp.mirrors.phpclasses.org/browse/package/640.html

Havn't used it, but it's the first one I came across doing this search:
http://search.yahoo.com/search?p=php+id3v2


I'm sure you can find a ton of ID3 parsers for PHP.  Just wanted to
point out that there are at least two standards for ID3 tags and that
you should probably check into both if you want full compatibility.

-TG



> -----Original Message-----
> From: Ron Stiemer [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, November 16, 2004 9:01 PM
> To: [EMAIL PROTECTED]
> Cc: Ryan King
> Subject: Re: [PHP] mp3 parsing
> 
> 
> Hi,
> 
> maybe this wil help you...i made this some time ago...
> 
> <?php
> 
> function ShowID3( $mp3, $path )
> {
>       $file    = $path . $mp3;
>     $value   = fopen( $file, "r");
>     $content = fread( $value, filesize ($file) );
>     $tag     = str_replace( "TAG","", strstr( $content, "TAG" ) );
> 
>       $title   = substr( $tag, 0, 30);
>     $band    = substr( $tag, 30, 30 );
>     $album   = substr( $tag, 60, 30 );
>     $year    = substr( $tag, 90, 4 );
>     $comment = substr( $tag, 94, 30 );
>     //$genre   = substr( $tag, 124, 1 );
> 
>       echo,
>     "<b>Titel</b>: " . $title . "<br>" .
>     "<b>Band</b>: " . $band  . "<br>" .
>     "<b>Album</b>: " . $album . "<br>" .
>     "<b>Jahr</b>: " . $year  . "<br>" .
>     "<b>Kommentar</b>: " . $comment . "<br>";
> 
>       fclose( $value );
> }
> 
> ShowID3( "test.mp3", "" );
> 
> ?>
> 
> Regards,
> Ron
> 
> Am Mittwoch, 17. November 2004 01:58 schrieb Ryan King:
> > Anyone out there have a way to read the header info out of 
> an mp3 file?
> > I'm able to parse out the id3 tags, but am having trouble 
> finding a way
> > to read the header info. The info I'm trying to get is the 
> playtime and
> > bitrate.
> >
> > thanks,
> > ryan
> 
> -- 
> 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to