Consistency checking
FLAC
FLAC files already contain MD5 sums of stream data, so changes to other metadata (artist, track title, etc) will not perturb this checksum. flac can be used to check FLAC files:
flac -ts *.flac
Some FLAC files cannot be checked, with the self-explaining warning:
WARNING, cannot check MD5 signature since it was unset in the STREAMINFO
The best thing to do is decode and recompress the FLAC files to contain an MD5 header. In the process, decoding is an effective check for frame damage. To rencode such files in-place:
flac --best -f *flac
MP3
Checkmate MP3 checker is a simple and fast tool for checking MP3 files, particularly checking for bad frames. Invocation:
mpck -qrB .
mp3info (in Debian) can also check for bad frames:
mp3info -b "%b" ${filename}
Splitting
FLAC with .CUE files
Sometimes, a FLAC file is distributed as a monolithic FLAC file with a .CUE sheet describing when tracks start/end. To split the monolithic file into smaller ones:
sudo aptitude install cuetools shntool
cuebreakpoints monolithic.cue | shnsplit -o flac monolithic.flac
cuetag monolithic.cue split-track*.flac
Sometimes, the .CUE sheet is included with the FLAC. To get it:
# If .CUE sheet is in cuesheet block
metaflac --export-cuesheet-to=monolithic.cue monolithic.flac
# If .CUE sheet is in tag
metaflac --show-tag=CUESHEET monolithic.flac | grep -v ^CUESHEET > monolithic.cue
Source: Split lossless audio in Ubuntu
Conversion
dir2ogg finds all MP3s/FLACs/etc in a directory and converts them to Ogg Vorbis, preservings tags & metadata.
Copy (or better yet, hard link) your media into a new directory, and run the following in that folder to convert to Ogg Vorbis (q=8):
dir2ogg -rf -q 8 --delete-input .
Make sure to copy! The above deletes files.