Showing posts with label Flac. Show all posts
Showing posts with label Flac. Show all posts

Wednesday, May 6, 2015

Split Flac audio file: errors, solutions and workarounds

I've previously split some Flac files with the following command:
 shntool split -f *.cue -o flac *.flac
But I recently tried the same command on some other Flac files and got the following error message:
shntool [split]: error: m:ss.ff format can only be used with CD-quality files
A suggestion on linuxquestions.org was to use a similar command to this (where you have one Flac file and one cue file; you'll have to specify the names if you have more than one in the folder obviously):
cuebreakpoints *.cue | sed s/$/0/ | shnsplit -o flac *.flac
However, I ran into a similar error as another poster there:
shnsplit: warning: error while transferring -4195974166 bytes of data shnsplit: error: failed to split file
I noticed that in both cases it was the final track that failed to split.

A workaround is to add a extra dummy track to the end of the cue file, using the track length of the origianl Flac file from file properties.

The final track is then spit successfully and the error message appears when the program tries to slit the dummy track.

Once the Flac file is successfully split, to add tag information to the split files from the cue file, use this command:
cuetag *.cue split-track*.flac
To change the file names to track titles from the cue file, use this script:
#!/bin/bash
for f in *.flac; do
track=`metaflac "$f" --show-tag=TRACKNUMBER | sed s/.*=//g`
artist=`metaflac "$f" --show-tag=ARTIST | sed s/.*=//g`
title=`metaflac "$f" --show-tag=TITLE | sed s/.*=//g`
mv "$f" "`printf %02g $track` - $artist - $title.flac"
done
 Author: Ruben Verweij

Monday, August 23, 2010

Split Flac audio file

I recently downloaded some rips of audio CD's. In each CD folder, I found one huge .flac file and a .cue file. Professor Google told me that Flac is a lossless audio codec, and that I could split the .flac file into individual tracks using a command-line tool and the .cue file.
I installed flac, shntool and cuetools from the Debian repository and ran the following command:
shntool split -f *.cue -o flac *.flac
This splits the one big flac file, whatever its name, into separate flac files, according to the information in the .cue file, whatever its name. (It is of course possible to specify the file names if there's more than one in the directory.)
I didn't have any luck trying to change the output format to MP3, or trying to add file tags using the .cue file, and simply used Sound Converter instead.
Users of Ubuntu and Debian Unstable can get this good looking GUI application to split audio files. It's called gCue2tracks. The screenshot I found here.

Update: If you experience the following error message, see this post:
shntool [split]: error: m:ss.ff format can only be used with CD-quality files