Musicbrainz – Using picard

Picard, available here or maybe in the repository of your linux distribution (Arch Linux has it), is a great tool to tag your mp3-collection (if you don’t use beets), but it’s not very intuitive, so here are the instructions.

Click “Add Folder” to add a folder, oder “Add Files” to add single files. Most of the time they’ll show up under “Unmatched Files” on the left. Then select “Unmatched files” and click the button “Lookup”. Now Picard contacts musicbrainz.org and searches for the album.

After a while you should see the album name on the right pane. If you get an error that it couldn’t load the album information, fret not. Just hit CTRL-R until the error is gone.

Expand the album information. Now drag and drop the filenames from the left pane to their respective tracks on the right. Yes, there’s no other way to match the files! Once you’re done, click “Save” to tag.

If you want Picard to move and/or rename the files according to their track title and number, check Options -> Move Files and Options -> Rename Files. Select a destination folder in Options -> Options… -> File Naming, and a pattern in “Name files like this”.

The pattern controls how the files are named. I like this one for USB-Sticks (all in one line):

%albumartist% - %album%/$if($gt(%totaldiscs%,1),%discnumber%$num(%tracknumber%,2) - %title%, $num(%tracknumber%,2) - %title%)

Guess what it means 🙂

Splitting big mp3 files

When splitting big mp3 files (like audiobooks) into digestible chunks (say 20 minutes) with ffmpeg, there are several things to keep in mind:

  1. It really, really matters where you put the -ss option on the command line! If you use it as an output option (i.e. after -i), input is read but discarded, so you end up with a file containing silence at the start. You have to use it as an input option (i.e. before -i) to get the proper result.
  2. Same goes for -t, only that you have to use this one as an output option (i.e. after -i but before the output file name. Also note that -t denotes a duration, not a position!
  3. If you want to transfer the split files to an Android device, you need to adjust the IDv3-tag “title”. Android uses that plus the original extension as the display file name. If the title-tag does not contain some string to differentiate files, you end up with identical file names. So you have to fix the title to something like “audiobook – 01 of 37”. Of course the track-tag is ignored (why bother with something so obvious 🙁 ).

But do not fret. I put this all together in a quick and dirty quick and dirty perl script. First argument is the input file, second the base for output file names and third the base for the title tag:

$ splitmp3.pl "Big Input file.mp3" "Output file" "Name"

outputs files like this:

Output file - 01.mp3
Output file - 02.mp3
...

with titles like this:

Name - 01 of 37
Name - 02 of 37
...

That’s all, folks!

flac + cue to mp3

To convert a single flac file with a cue sheet to mp3, first split it up:

$ shnsplit -f <sheet.cue> <source.flac>

Then convert the wav-files to mp3 with ffmpeg:

for i in *.wav ; do ffmpeg -i ${i} -codec:a libmp3lame -qscale:a 2 ${i%%wav}mp3 ; done

Or, if you have individual flac files:

for i in *.flac; do ffmpeg -i ${i} -codec:a libmp3lame -qscale:a 2 ${i%%flac}mp3 ; done

qscale:a 2 produces mp3s with an average bitrate around 170-210 kbit/s. It should be close to lossless.