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.

2 comments:

  1. So what would it be advisable for you to would in the event that you like to play them on your macintosh?anyconv.com

    ReplyDelete
  2. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. FLAC vs MP3

    ReplyDelete