Jump to content

Recommended Posts

Hi.

 

I run a php web site that allows administrators to upload MP3 files.  The form asks for the artist, title, and date as input along with the file to upload.  I would like to modify the metadata attributes of the mp3 file that is uploaded.  (I want to change the song title, artist name, year, genre of the mp3 file.)  I am wondering how I could do this using php?  I do not want to install pear modules or anything like that, I would like to do it using just straight php code.  Can't I load the file into a binary stream and then some how modify the metadata in the binary stream and save it to a new file?

 

thanks so much,

Monarlte

Link to comment
https://forums.phpfreaks.com/topic/42240-modifying-mp3-id3-metadata/
Share on other sites

Thank you ShogunWarrior.  I really appreciate that.

 

I have worked with text-based files, but I have never worked with binary type files.  Would you be able to give me some guidance here?

 

That code that you displayed in your last message... What is it suppose to be doing?

 

How do I modify the artist name and song title in the binary data?  When you say I need to search for "TAG": how can I search for a string in a binary stream if it is not text-based?  And once I find it what do I do, is there an ending tag (something like "/TAG" or "</TAG>") so I know where the metadata information stops?

 

thanks so much,

Monarlte

There are two main ID3 versions, ID3 and ID3v2. While alot of files use v2, many still use the v1 so for backwards-compatability you should probably implement both.

 

Here is the ID3v2 spec: http://www.id3.org/id3v2.4.0-structure

 

You would need to understand and implement that to parse/edit ID3 tags.

There are two main ID3 versions, ID3 and ID3v2. While alot of files use v2, many still use the v1 so for backwards-compatability you should probably implement both.

 

Here is the ID3v2 spec: http://www.id3.org/id3v2.4.0-structure

 

You would need to understand and implement that to parse/edit ID3 tags.

That sure would be a lot of work. You really may want to reconsider using sone of the available classes that have been tried and proven, lest you risk a bug that totally trashes the mp3 files. Whatever your choice, good luck.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.