问题
Except http://us3.php.net/manual/en/book.ktaglib.php and http://getid3.sourceforge.net/ does anyone know of any other way to work from PHP with tags on audio files?
I need to read and write them, and KTagLib seems a little too much for the job, and also don't really get the documentation, and getID3 seems to only write ID3v1 tags.
回答1:
There are also other ID3 functions in PHP just for reading: http://php.oregonstate.edu/manual/en/book.id3.php
You should try stable version of getID3(), there is this comment for beta:
v2.0.0-b5 can write only some tag formats:
ID3v1
APEtag
FLAC
Ogg
Vorbis
Lyrics3
In stable, they should be supported (if the don't lie):
Tag formats:
ID3v1 (v1.0 & v1.1)
ID3v2 (v2.2, v2.3 & v2.4)
APE tags (v1 & v2)
(Ogg) VorbisComment
Lyrics3 (v1 & v2)
回答2:
with ktaglib:
$tag = new KTaglib_MPEG_File('test.mp3')->getID3v2Tag()->getFrameList();
echo "Album: " . $tag["TIT2"];
echo "Album: " . $tag["TALB"];
echo "Artist: " . $tag["TPE1"];
回答3:
If you can't use the php module for the id3 tags (sometimes you can't install modules on some hostings), you can use this function:
http://www.barattalo.it/2010/02/22/reading-mp3-informations-with-php-id3-tags/
回答4:
At the moment, to write vorbis tags to an ogg/vorbis file, GetId3 requires vorbiscomment installed on the server.
来源:https://stackoverflow.com/questions/1345562/mp3-and-ogg-tags-in-php