簡體   English   中英

如何從python或php中的mp3的ID3中刪除版權標簽?

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

我有一堆很老的mp3文件,沒有任何版權。 然而,我從他們那里獲得的地方已經用自己的網站網址填充了版權標簽。

我想知道是否有一種簡單的方法可以通過編程方式刪除這些標簽? 有一個winamp添加允許我為每首歌做這個,但這不是很可行。

編輯:版權是ID3標簽的一部分嗎?

謝謝,-Roozbeh

對於Python,有mutagen庫和工具,它非常易於使用。

但是,如果您不打算以編程方式實際執行此操作,則在Windows上會有免費軟件應用程序MP3Tag ,我可以衷心推薦。 它會進行批量轉換等等。

您可以使用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);
}

?>

你可以使用VLC播放器。 單擊工具 - >媒體信息

是的這是有效的! 只需下載最新版本的VLC媒體播放器即可。 打開其中的mp3文件。 右鍵單擊文件>選擇“信息”>編輯出版商和版權信息>點擊下面的“保存元數據”。 你完成了。 :)

我的解決方案,改變你想要的路徑:

import os
import shutil
from mutagen.mp3 import MP3
for root, dirs, files in os.walk(path):
    for file in files:
        if file.endswith('.mp3'):
            f = os.path.join(root, file)
            try:
                mp3 = MP3(f)
                mp3.delete()
                mp3.save()
                print('ok')
            except:
                print('no ID3 tag')
print('Done')

有一些像Amarok這樣的開源工具可以讓你對ID3標簽進行批量更改。

看看: http//amarok.kde.org/

不需要任何PHP代碼只需重現mp3文件,即刻錄和翻錄或縮小大小和時間制作新文件,您可以在其中指定自己的眾多選項

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM