Sunday, 20 July 2014

Converting flac+cue file to split ogg encoded files in one go - one liner bash command

Requirements for Ubuntu (12.04, most likely later ones as well):
sudo apt-get install cuetools shntool flac vorbis-tools
Standing in a directory with exactly one flac file and exactly one cue file:
cuebreakpoints *.cue | shnsplit -o "cust ext=ogg oggenc -q 6 -o %f -" *.flac -f *.cue -t '%n. %p - %t'

Standing in a directory with multiple subdirectories containing exactly one flac file and one cue file:
for d in *; do cd "$d"; cuebreakpoints *.cue | shnsplit -o "cust ext=ogg oggenc -q 6 -o %f -" *.flac -f *.cue -t '%n. %p - %t' && rm *.flac *.cue *.log ; cd .. ; done

Note: as you can see, there's absolutely no error checking. It only works in the said circumstances. However, the original flac, cue (and the unnecessary log) files will only be deleted if the split+encoding command succeeded, so it's relatively safe.

No comments:

Post a Comment