Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set "Album Artist" of a song programmatically or through command line (linux)

There are various command line tools available for editing metadata of audio files. But none of them can edit "Album artist" tag of the audio file. Is there any command line tool or perl module to do the same ? Thanks

like image 982
mac Avatar asked Apr 25 '12 20:04

mac


2 Answers

mid3v2 comes with the mutagen library and is the best command-line tool for this purpose that I know of. When called with the -f argument, the TPE2 tag is listed as supported.

like image 132
daxim Avatar answered Nov 02 '22 04:11

daxim


MP3::Tag support it.

#!/usr/bin/perl

use MP3::Tag;

$mp3 = MP3::Tag->new($filename);
$mp3->new_tag("ID3v2");
$mp3->{ID3v2}->add_frame("TALB", "Album title");
$mp3->{ID3v2}->add_frame("TPE2", "Album artist");
$mp3->{ID3v2}->write_tag;
$mp3->close();

or

#!/usr/bin/perl

use MP3::Tag;

$mp3 = MP3::Tag->new($filename);
$mp3->select_id3v2_frame_by_descr('TPE2', 'album artist'); # Edit in memory
$mp3->update_tags(); # commit
$mp3->close();
like image 36
askovpen Avatar answered Nov 02 '22 04:11

askovpen