Split one flac/ape (+ cue) file into separate tracks

You may have backupped your music CDs using a single flac file instead of a file for each track. In case you need to split the cd-flac, do this (instruction for Debian/Ubuntu):

  • Install the needed software.
sudo apt-get install cuetools ffmpeg flac shntool
  • In case the source file is one unsplitted ape file, you can convert it to flac first.
ffmpeg -i sample.ape sample.flac
  • In case the cue file is not a separate file, but included in the flac file itself, split them.
metaflac --show-tag=CUESHEET sample.flac | grep -v ^CUESHEET > sample.cue

(NB: The regular syntax is metaflac --export-cuesheet-to=sample.cue sample.flac, however often the cue file in embedded in a tag instead of the cuesheet block).

  • Split the album flac file into separate tracks:
cuebreakpoints sample.cue | shnsplit -o flac sample.flac
  • Copy the flac tags (if present):
cuetag sample.cue split-track*.flac

That’s it.

(Post moved from nxadm.wordpress.com.)