Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove the copyright tag from ID3 of mp3s in python or php?

Tags:

python

php

id3

I have a bunch of mp3 files that are pretty old and don't have any copy rights. Yet, the place I got them from has filled the copy right tags with its own website url.

I was wondering if there's an easy way to remove these tags programmatically? There's a winamp add on that allows me to do this for each song, but that's not very feasible.

Edit: Is copyright part of the ID3 tags?

Thanks, -Roozbeh

like image 317
Roozbeh15 Avatar asked Oct 28 '25 22:10

Roozbeh15


2 Answers

For Python, there's the mutagen library and tool, which is very easy to use.

However if you're not looking to actually do this programmatically, on Windows there's the freeware app MP3Tag, which I can heartily recommend. It'll do batch transformations and lots more.

like image 53
AKX Avatar answered Oct 30 '25 11:10

AKX


You can use getID3 library.

Here is the example:

<?php

$TaggingFormat = 'UTF-8';

require_once('../getid3/getid3.php');
// Initialize getID3 engine
$getID3 = new getID3;
$getID3->setOption(array('encoding'=>$TaggingFormat));

require_once('../getid3/write.php');
// Initialize getID3 tag-writing module
$tagwriter = new getid3_writetags;
//$tagwriter->filename = '/path/to/file.mp3';
$tagwriter->filename = 'd:/file.mp3';
                                                            $tagwriter->filename       = 'P:/webroot/_dev/getID3/testfiles/_writing/2011-02-02/test.mp3';
//$tagwriter->tagformats = array('id3v1', 'id3v2.3');
$tagwriter->tagformats = array('id3v2.3');

// set various options (optional)
$tagwriter->overwrite_tags = true;
                                                            $tagwriter->overwrite_tags = false;
$tagwriter->tag_encoding   = $TaggingFormat;
$tagwriter->remove_other_tags = true;

// populate data array
$TagData = array(
    'title'   => array('My Song'),
    'artist'  => array('The Artist'),
    'album'   => array('Greatest Hits'),
    'year'    => array('2004'),
    'genre'   => array('Rock'),
    'comment' => array('excellent!'),
    'track'   => array('04/16'),
);
$tagwriter->tag_data = $TagData;

// write tags
if ($tagwriter->WriteTags()) {
    echo 'Successfully wrote tags<br>';
    if (!empty($tagwriter->warnings)) {
        echo 'There were some warnings:<br>'.implode('<br><br>', $tagwriter->warnings);
    }
} else {
    echo 'Failed to write tags!<br>'.implode('<br><br>', $tagwriter->errors);
}

?>
like image 34
Fedya Skitsko Avatar answered Oct 30 '25 13:10

Fedya Skitsko