Web Projects Consulting

[Solved] Fast High Quality Encoding of ape Format into Lame mp3 or Nero m4a on Linux

The lossless2lossy.sh script does not give enough good functions to split *.ape files into tracks. The below solves the problem in Fedora 12.

Install the needed tools:

sudo yum -y install bchunk shntool cuetools

Download the latest Nero Acc encoder/decoder from the Nero website and uncompress it to ~/bin folder. Make sure that ~/bin is in your path. Make sure you have ffmpeg, best would be having recompiled it as described in my previous article.

All is ready, convert an ape file into pcm wap:

ffmpeg -i cd.ape converted.wav

Convert into lame mp3 (options can be specified):

shnsplit -o 'cust ext=mp3 lame --preset insane --quiet - %f' -f "cd.cue" -t "%n.%p - %a - %t" converted.wav

Convert into NeroAac (iPod-ready, options can be specified):

shnsplit -o 'cust ext=m4a neroAacEnc -q .62 -if - -of %f' -f "cd.cue" -t "%n.%p - %a - %t" converted.wav

The output will be a bunch of tracks in the desired format. That simple!

%n.%a - %t

6 thoughts on “[Solved] Fast High Quality Encoding of ape Format into Lame mp3 or Nero m4a on Linux

  1. Colin Brace

    Thanks, this is very helpful.

    I am trying to get this working with ogg instead of mp3, but I keep getting an error message. Following your example:

    shnsplit -o ‘cust ext=mp3 lame –preset insane –quiet – %f’ -f “converted.cue” -t “%n.%p – %a – %t” converted.wav

    This works. But substituting oggenc:

    shnsplit -o ‘cust ext=ogg oggenc -q 7 – %f’ -f “converted.cue” -t “%n.%p – %a – %t” converted.wav

    keeps returning an error message:

    shnsplit: warning: error while transferring 192045504 bytes of data
    shnsplit: warning: child encoder process 32295 had non-zero exit status 1
    shnsplit: error: failed to split file

    Any ideas?

  2. Alec

    Interesting, will try during the week-end if i have time. I still have no sanely portable hardware to play ogg, and do not encode to this format very often.

  3. Colin Brace

    Yep, I realize ogg support, especially on portable devices, is less than ideal. Several months ago I got an Android phone which I now use as much as music player as for calling people (I got a 16GB micro SD card for it). And of course, ogg support is built-in.

    I probably should be able to figure out what is going wrong myself in the above example, except that there is no man page for shnsplit, so I am having difficulty figuring out which are the oggenc parameters and which are shnsplit.

  4. Alec

    Try

    # shnsplit –help

    I am a happy owner of ipod classic 160Gb bought in 2007 by my sister in the USA. With all those cons, I am still not going to change it for anything else just because of the pros. Ogg format postponed until something competitive hits the market (in Ukraine).

  5. Alec

    Ogg solved, it’s pretty simple: oggenc does not specify output files with the default commad.

    [aaa@bbb ~]$ oggenc –help
    oggenc from vorbis-tools 1.2.0
    (c) 2000-2005 Michael Smith

    Usage: oggenc [options] inputfile […]

    Thus, looking at the help stuff, you can find the “-o” parameter:

    Naming:
    -o, –output=fn Write file to fn (only valid in single-file mode)

    The below is tested and works:

    # shnsplit -o ‘cust ext=ogg oggenc -q 7 – -o %f’ -f “cd.cue” -t “%n.%p – %a – %t” converted.wav

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.