tag311 - Get/Set ID3 Version 1.1 Tags

tag311 lists, creates, and modifies the ID3v1 tags commonly found in MP3 files. For many years, I used id3edit, id3convert (an example program found in id3lib), and some shell scripts to maintain MP3 tags under Linux. However, I also wanted a simple command-line program that combined these capabilities and that would run under Windows and Linux. Hence, tag311. The single-letter abbreviations for the field-setting options and the long listing format were borrowed from id3edit. The "-strip 2" option replaced the need for id3convert and the "-set parts" option eliminated the need for the shell scripts.

Listing Tags

Without any options, tag311 lists the ID3 tags in one or more MP3 files. The default listing format for ID3v1 tags is "-brief"; the "-long" option produces an id3edit-compatible listing. Normally, tag311 only notes the presence of an ID3v2 tag; the "-dump" option will generate an ASCII dump of the tag.

Editing Tags

To add new or modify existing ID3v1 tags. specify one or more of the field options ("-song", "-artist", "-album", "-comment", "-year", or "-genre") before the list of MP3 files. In the case of an existing tag, only the specified fields are updated in the tag.

The genre field can be specified by numerical value or name. The "-plus" option will generate a full list of the defined genre numbers and names. The "-match text" option only lists the genres whose names contain text.

tag311 can generate certain ID3v1 fields from MP3 file names that consist of the track number, the artist, and the song title, separated by hyphens. The "-set parts" option specifies which fields are in the file name(s) and in which order they appear. For example, "-set tsa" will extract and set the track number, song title, and artist from "07 - Help - Beatles.mp3". The "-copy file" option loads the ID3v1 tag from a file. The field-setting options can then be applied to the tag and the tag stored in one or more other files.


To strip the ID3v2 tag from an MP3 file, specify "-strip 2" before the list of files. The original files are modified, so interrupting tag311 in the middle of stripping a tag may corrupt the MP3 file.

The "-trim" option trims trailing blanks from text fields in ID3v1 tags. Yes, I'm obsessive!


% tag311 [-help]
         [-brief] [-dump] [-long]
         [-match text] [-plus]
         [-copy file]
         [-field separator] [-set parts]
         [-clean] [-strip version] [-trim]
         [-song title]
         [-artist artist]
         [-b album] [-album album]
         [-comment text]
         [-year year]
         [-track number]
         [-genre genre]


displays help information.
specifies the output format (brief, long) when listing tags; the default is brief.
generates a hexadecimal/ASCII dump of a file's ID3v2 tag.
-match text
writes to standard output a list of the genres that contain the specified text. (Basically the equivalent of piping the output of "-plus" through "grep text".)
writes to standard output a list of all of the defined genres.
-copy file
loads the fields from a file's ID3v1 tag for the purpose of storing them in files that follow on the command line. Individual fields can be overridden using the various field options prior to specifying the destination files.
-field separator
specifies the field separator for the "-set parts" option below. The default separator is " - ".
-set parts
causes tag311 to set certain fields in a file's ID3v1 tag using information embedded in the file's name. The argument is a string containing the ordered single-letter abbreviations for the hyphen-separated fields in the file's name: "t" for the track number, "s" for the song title, "a" for the artist, "c" for a comment, and "y" for the year. For example, specify "-set ts" if the file names are of the form: "track - song.mp3". The default field separator is " - ", although a different divider can be specified with the "-field separator" option. (File names are not always composed of convenient hyphen-separated fields; in these cases, I usually use chafn to change the file names into a form usable by tag311.)
is shorthand for "-strip 2 -trim".
-strip version
strips the specified version (1 or 2) of ID3 tag from the files.
trims trailing blanks from the text fields in ID3v1 tags.
-song title
-artist artist
-b album
-album album
-comment text
-year year
-track number
-genre genre
are used to set fields in the ID3v1 tags of the files that follow on the command line.
specifies the file(s) to be accessed.

Alex Measday  /  E-mail