Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
225 views
in Technique[技术] by (71.8m points)

mp3 - What's this "Album artist" tag iTunes uses? Any way to set it using java?

iTunes uses an ID3 tag called "Album Artist", and for one album to be actually grouped as an album in iTunes, both the Album Name and Album Artist must be the same.

As far as I'm concerned, Album Artist isn't an official ID3 tag, and from the ID3 libraries I've seen so far, none supported "Album Artist".

Preview

Does anyone know more about this strange tag, and how to set it in java (or with any command line utility).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The commenters above are correct, TPE2 ("Band/Orchestra/Accompaniment") is the ID3 tag which is usually repurposed for this. I know that at least iTunes, Windows Media Player, J River Media Center, and XBMC all use this tag, because I use it extensively in my own music collection and all of those applications have supported it seamlessly.

To edit this tag:

Graphically: you really can't go wrong with mp3tag, the only graphical editor (Windows in this case, but works fine under Wine) I've used which handles multiple files really well (leaves values alone unless you specifically change them), lets you customise which fields you have (and how they map to ID3 or FLAC tags, etc), and has other nice stuff like handling multiple image types for the APIC tag (front cover, back cover, disc image, band photo) cleanly, etc. Highly recommended.

From the command line: the id3v2 command-line tool works a treat in this case:

$ id3v2 -l foo.mp3 
[...]
id3v2 tag info for foo.mp3:
TFLT (File type): MPG/3
TIT2 (Title/songname/content description): Because Of The Blood (Single Version)
TPE1 (Lead performer(s)/Soloist(s)): Sin Fang
TPE2 (Band/orchestra/accompaniment): Sin Fang
[...]

$ id3v2 --TPE2 "Spice Girls" foo.mp3

$ id3v2 -l foo.mp3 | grep TPE2
TPE2 (Band/orchestra/accompaniment): Spice Girls

(this tool is available by default in the Ubuntu repos, sudo apt-get install id3v2)

From Java:

Use something like the javamusictag project. I haven't used this in a while but something like:

MP3File file = new MP3File(new java.io.File("foo.mp3"));
((FrameBodyTPE2) file.getID3v2Tag().getFrame("TPE2").getBody()).setText("Backstreet Boys");
file.save();

is pretty close (or at least, close enough to get you started).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...