vorbiscommentedit

Update Dec 8, 2018: Version 1.4 available.

Update Apr 18, 2016: Version 1.3 available.

Update Feb 8, 2008: now also supports FLAC audio files (requires metaflac).

vorbiscommentedit 1.0 is a little Unix shell script that makes it easy to edit Ogg Vorbis comment fields (tags) with a text editor. When run with multiple arguments, it edits only the common fields in each Ogg Vorbis file, leaving the rest unchanged.

vorbiscommentedit oggfile [oggfile [oggfile...]]

History

Many grapical tools for editing tags in Ogg Vorbis files only know about a few tags (TITLE, AUTHOR, DATE, etc.), but for classical music I use an extended set, including tags like COMPOSER, PERFORMER and ENSEMBLE. Some of these can even be repeated, for example if there are multiple performers (a violinist, a pianist, etc.) Therefore, vorbiscommentedit simply edits all tags that it finds.

Additionally, when I'm logged in to a remote machine, it is not always desirable to start a graphical program. When the network is slow, using a program under X gets a bit frustrating, sometimes. An editor in text terminal is then much more comfortable. But running vorbiscomment, then an editor and then vorbiscomment again gets tedious, especially if many of the files to edit have almost the same comment fields.

How it works

vorbiscommentedit uses vorbiscomment to read and write comment fields from Ogg Vorbis files and for the rest relies on common Unix utilities, such as sed and awk.

It extracts the comment fields from all the files given on the command line and collects the fields that those files have in common. It also keeps track of the fields that are different among the files, to be able to put them back unchanged later.

The script then calls the default editor (from the $EDITOR environment variable) to let the user edit the common fields.

At the end of the text is a list of all the tags that were different in the different files, so that the user knows that, if he creates a comment field with such a tag, it will overwrite certain existing comments. The tags are prefixed with “~” (tilde). All lines prefixed with “~” are for information only. Editing them has no effect.

If the user changed one or more of the comment fields, the script writes the changed comments back to the Ogg Vorbis files, overwriting the old comments.

Removing a field removes it from all files. (Removing one of the tags prefixed with “~” does not remove those tags from any files.) Adding a new field adds it to all files.

Related

Martin Krafft's vorbistagedit is based on a similar idea: collect tags in a file, edit them with a text editor and write them back. But vorbistagedit shows all fields of all files, not just the common ones. Disadvantage: common fields have to be edited multiple times (although in a single file, so search and replace works). Advantage: Edits multiple ogg files in one editing session.

Bert Bos
Created 25 November 2007