Wednesday, June 17, 2015

Spliting a Flac (audio) file via Command line

If you have a flac-file that contains multiple songs, you might want to separate each track into a separate file. Nothing is holding you back to do that manually, however, doing it automatically seems a better way.

Normally flac files comes with a cue-file (*.cue) that contains the information where to cut the flac-file to extract each track. 

To do this quick and clean at the command line, you'll need to install the following packages "cuetools, shntool & flac" by typing this command at the command line:


sudo apt-get install cuetools shntool flac

To split the flac audio file (*.flac) type:

cuebreakpoints file.cue | shnsplit -o flac file.flac

  • "shnsplit" is used to split tracks,
  • "cuebreakpoints" reads the break-points from the *.cue-file 
  • With the pipe command "|" we feed this information into the "shnsplit" command.


Thanks to Danilo Dellaquila that provided this tip.

No comments:

Post a Comment

Please be courteous, even if you do not share the same view.