vorbiscommentedit 1.4

vorbiscommentedit 1.4 (download link) is a program to edit the tags of Ogg and FLAC files with a text editor. (See also the description of version 1.0)

Given one or more Ogg and FLAC files, it creates a temporary text file with the tags, opens the user's default editor and, after the editor ends, puts the changed tags back in the Ogg and FLAC files.

vorbiscommentedit [-m] file [file...]

It can operate in two different modes. By default, it compares the tags of all the files and only operates on those that are common to all of them. This is a quick and safe way to change the tags that are the same in all files. This mode also allows to add new common tags to all the files passed as arguments.

E.g., if you have a bunch of file with the same ARTIST tag, but there is a mistake in the name of the artist, this is an easy way to change all the files at once: vorbiscommentedit *

With the option -m (for “multiple”), all the tags of the files are edited, not just the common ones. The tags are grouped by file in the temporary text file. When the editor ends, all the tags are written back to the file they belong to.

This mode also allows editing the names of the files.

Files that are neither Ogg nor FLAC are silently ignored (default mode) or only their names are shown in the editor (option -m). This allows to invoke vorbiscommentedit with a wildcard, e.g.,

vorbiscommentedit *

or

vorbiscommentedit -m *

even if there are other types of files in the directory. And with option -m, this can also by useful to rename those other files.

More details

Which editor to use is determined from the environment variables $VISUAL or $EDITOR. If neither is defined, a few well-known editors are tried.

Invoking vorbiscommentedit * in a directory with numbers from the the album “Oxygène” might, e.g., open an editor displaying this:

ALBUM=Oxygène [Remastered]
ARTIST=Jean Michel Jarre
CDDB=37094f06
DATE=1976
GENRE=Electronic
REPLAYGAIN_ALBUM_GAIN=-5.28 dB
REPLAYGAIN_ALBUM_PEAK=1.15025377
~ REPLAYGAIN_TRACK_GAIN
~ REPLAYGAIN_TRACK_PEAK
~ TITLE
~ TRACKNUMBER

This indicates that all the Ogg and FLAC files in the directory have in common the tags for ALBUM, ARTIST, CDDB, DATE, GENRE, REPLAYGAIN_ALBUM_GAIN and REPLAYGAIN_ALBUM_PEAK. Some or all of them also have the tags REPLAYGAIN_TRACK_GAIN, REPLAYGAIN_TRACK_PEAK, TITLE or TRACKNUMBER, but with different values.

Invoking vorbiscommentedit -m * opens a much longer file in the editor, with, e.g, this content:

# Edit, remove or add TAG= lines.
# Edit the "+" line to rename the file.
# Empty lines and lines starting with "#" are ignored.
# Don't change the :" lines!
#
# For Ogg files:
#   - Backslashes must be doubled (\\).
#   - Use \n, \r and \0 to for LF, CR, and the null character, resp.
# (Multi-line tags are not supported for FLAC files yet.)

: 1_Oxygene__Part_I_.ogg
+ 1_Oxygene__Part_I_.ogg
ARTIST=Jean Michel Jarre
ALBUM=Oxygène [Remastered]
TITLE=Oxygène (Part I)
DATE=1976
GENRE=Electronic
TRACKNUMBER=1
CDDB=37094f06
REPLAYGAIN_TRACK_PEAK=1.08939934
REPLAYGAIN_TRACK_GAIN=-4.93 dB
REPLAYGAIN_ALBUM_PEAK=1.15025377
REPLAYGAIN_ALBUM_GAIN=-5.28 dB

: 2_Oxygene__Part_II_.ogg
+ 2_Oxygene__Part_II_.ogg
ARTIST=Jean Michel Jarre
ALBUM=Oxygène [Remastered]
TITLE=Oxygène (Part II)
DATE=1976
GENRE=Electronic
TRACKNUMBER=2
CDDB=37094f06
REPLAYGAIN_TRACK_PEAK=1.10011435
REPLAYGAIN_TRACK_GAIN=-4.90 dB
REPLAYGAIN_ALBUM_PEAK=1.15025377
REPLAYGAIN_ALBUM_GAIN=-5.28 dB

: cover.png
+ cover.png

This shows that there were three files: two Ogg files and a PNG file. The tags of the Ogg files are shown. The PNG file has no tags, but its name is shown. All tags can be edited, and also the file names can be edited on the +-lines. (The :-lines should not be changed, otherwise vorbiscommentedit will not know what the original name was.)

The comment at the start gives some basic instructions. It shows, e.g., that certain backslash-escapes can be used to include special characters in the tag values.

Differences from vorbistagedit

vorbiscommentedit was inspired by vorbistagedit by Martin F. Krafft (available in Debian's vorbis-tools package), but is meant to make editing the same tags in multiple files easier.

With option -m, the program behaves very similar to vorbistagedit, with the following differences: The program also handles FLAC files and allows to rename (but not change tags in) arbitrary other files. (Handy if you have, e.g., files music.ogg and music.info and want to rename both.) Unlike vorbistagedit, it doesn't allow to set common tags for all files in the preamble. It also doesn't rely on file extensions but uses the file command to get the file's type (which makes it slower, though). It also allows editing multi-line tag values (using the backslash-escapes understood by vorbiscomment). Unfortunately, that only works for Ogg file, not FLAC files, because metaflac doesn't handle escapes yet.

There are other programs that work similar to vorbistagedit or vorbiscommentedit -m:

Changes since version 1.3

Version 1.4 has only one change relative to version 1.3: When renaming a file (the +-line), it is now also possible to rename the directory. Previously, trying to move the file to a different or new directory by editing the +-line resulted in an error.

Bert Bos
Created 8 December 2018