如何在Python或PHP中移除mp3文件的ID3版权标签?
我有一堆比较旧的mp3文件,这些文件没有版权问题。不过,我获取这些文件的地方在版权标签里填上了他们自己网站的链接。
我在想有没有简单的方法可以通过编程来去掉这些标签?虽然有一个winamp的插件可以让我对每首歌进行处理,但这样做不太方便。
补充一下:版权信息是ID3标签的一部分吗?
谢谢,
-Roozbeh
7 个回答
2
你可以直接使用VLC播放器。点击工具,然后选择媒体信息。
3
你可以使用getID3这个库。
下面是一个例子:
<?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);
}
?>