Command Line Basics: Ripping Audio CD’s, Part 3

September 18, 2010 by
Filed under: command line, HowTo, linux, Ubuntu 

In part 1 of CLB: Ripping Audio CD's, I showed how to rip the songs from your CD and save them as WAV files. In part 2 I showed how to convert those files to Ogg Vorbis audio. Today in Part 3 I'm going to show a few ways to tag those Ogg Vorbis audio files from the command line.

In the last post we used the oggenc command from the vorbis-tools package. We're going to use another command from vorbis-tools to tag the files: vorbiscomment.

Using vorbiscomment

Using vorbiscomment is a manual process. You'll have to tag the files one at a time. For my example I'm going to use the album No Guts. No Glory. by the Australian hard rock band, Airbourne. In this example I use the -w switch to write tags as well as the -t switch for each individual tag. Note the use of single quotes for any items that contain spaces.

vorbiscomment -w -t ARTIST=Airbourne -t 'TITLE=Born To Kill' -t 'ALBUM=No Guts. No Glory.' -t TRACKNUMBER=1 -t 'GENRE=Hard Rock' track01.cdda.ogg

To list the tags you just wrote you can use the -l switch:

Affiliate Link
vorbiscomment -l track01.cdda.ogg

The output for this example looks like:

TITLE=Born To Kill
ALBUM=No Guts. No Glory.
GENRE=Hard Rock

The format of this tag listing is what you can use to enter tags interactively. To tag files in interactive mode, simply use:

vorbiscomment -w track01.cdda.ogg

Then you just type in the tags like above, hitting the [Enter] key after each tag. When you're done tagging the file, hit [Ctrl]+[D] to exit.

Whichever way you choose to do the tagging, you'll probably want to rename the files when you're done. You can do this with the mv command.

mv track01.cdda.ogg 01_Born_To_Kill.ogg

A More Automated Way

There is a more automated way to apply the tags and rename the files. There's a great little command called lltag. You should be able to find it in your distro's repositories. In Ubuntu you can install it with:

sudo apt-get install lltag

lltag is an interactive program that can search an online CD database for tags and apply them to your files. The files can also be renamed at the same time. To see how it will run without affecting your files you can use the --dry-run switch. I'd suggest using that since you may often find several versions of an album in the database and it may take a few tries to find the correct version. So an example command would look like this:

lltag --cddb-query "airbourne no guts no glory" --rename %n_%t --rename-sep _ --dry-run *.ogg

Once you're sure which album listing you want to use, you can use the --yes switch to tell lltag to use the default actions to tag your files.

lltag --cddb-query "airbourne no guts no glory" --rename %n_%t --rename-sep _ --yes *.ogg

You'll still have to choose the album you want from the listing, but after that everything is automated and all of your files get tagged. My listing of files now looks like this:


So those are the basics for using vorbiscomment and lltag to apply tags to your Ogg Vorbis audio files. In my next installment of Command Line Basics I'm going to show an even better command that does a much better job at automating this whole process.


2 Responses to “Command Line Basics: Ripping Audio CD’s, Part 3”

  1. Bobot says:

    Hi Linerd,

    I am wondering if what you posted here regarding "lltag" as applied to ogg files will work for mp3 files as well?



    • Linerd says:

      Hi bobot,

      Yes, I believe lltag will work with mp3's as well. As long as the required libraries are loaded, it should work. Fire up Synaptic and find lltag. Right click on it and select "Recommended Packages". Then just make sure the packages for mp3 are installed.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>