Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: HOWTO: Convert music CDs to MP3 using the Command Line.

  1. #1
    Join Date
    Dec 2006
    Beans
    7,312

    HOWTO: Convert music CDs to MP3 using the Command Line.

    I have tried a variety of programs to rip my personal collection of music from CD to mp3 format on my computer. I consistently found significant shortcomings with many of the GUI programs and throughout I was a little nonplussed at the complexities of whole process. Fortunately I came across the program abcde which eliminates the needless froth of the GUI as well as seamlessly takes care of much of the complexity of the process. abcde is available in the repositories and can be downloaded as follows:

    Code:
    sudo apt-get install abcde cd-discid lame cdparanoia id3 id3v2
    The program abcde is actually a long script that manipulates a handful of programs, which I have conveniently added into the Terminal command above. It can actually do a great deal more than simply produce reasonable mp3 files but I will leave you to explore its many other possibilities. The programs that will be used to produce mp3s in this example are:
    • abcde
      "A Better CD Encoder" = abcde! Ordinarily, the process of grabbing the data off a CD and encoding it, then tagging or commenting it, is very involved. The abcde script is designed to automate this.
    • cd-discid
      In order to do CDDB (Compact Disc Database) queries over the Internet, you must know the DiscID of the CD you are querying. cd-discid provides you with that information. It outputs the discid, the number of tracks, the frame offset of all of the tracks, and the total length of the CD in seconds, on one line in a space-delimited format.
    • cdparanoia
      cdparanoia retrieves audio tracks from CDROM drives. The data can be saved to a file or directed to standard output in WAV, AIFF, AIFF-C or raw format. For the purposes of conversion to mp3 abcde directs cdparanoia to produce WAV files.
    • lame
      LAME is a program which can be used to create MPEG Audio Layer III (MP3) files.
    • id3
      id3 is an ID3 v1.1 tag editor. ID3 tags are traditionally put at the end of compressed streamed audio files to denote information about the audio contents.
    • id3v2
      id3v2 is an ID3 v2 tag editor. ID3 tags are traditionally put at the end of compressed streamed audio files to denote information about the audio contents. Using this command line software you can add/modifiy/delete id3v2 tags and optionally convert id3v1 tags to id3v2.
    abcde looks for two files on startup: /etc/abcde.conf and ~/.abcde.conf. The file abcde.conf is a fully commented configuration file that is well worth looking at, if only to copy to your home directory as ~/.abcde.conf (as is most usually done). Or if you are only interested in creating mp3s my gift to you, Gentle Reader, is my own ~/.abcde.conf file:

    Code:
    # -----------------$HOME/.abcde.conf----------------- #
    # 
    # A sample configuration file to convert music cds to 
    #       MP3 format using abcde version 2.3.99.6
    # 
    #       http://andrews-corner.org/abcde.html
    # -------------------------------------------------- #
    
    # Specify the encoder to use for MP3. In this case
    # the alternatives are gogo, bladeenc, l3enc, xingmp3enc, mp3enc.
    MP3ENCODERSYNTAX=lame 
    
    # Specify the path to the selected encoder. In most cases the encoder
    # should be in your $PATH as I illustrate below, otherwise you will 
    # need to specify the full path. For example: /usr/bin/lame
    LAME=lame
    
    # Specify your required encoding options here. Multiple options can
    # be selected as '--preset standard --another-option' etc.
    LAMEOPTS='--preset extreme' 
    
    # Output type for MP3.
    OUTPUTTYPE="mp3"
    
    # The cd ripping program to use. There are a few choices here: cdda2wav,
    # dagrab, cddafs (Mac OS X only) and flac.
    CDROMREADERSYNTAX=cdparanoia            
                                         
    # Give the location of the ripping program and pass any extra options:
    CDPARANOIA=cdparanoia  
    CDPARANOIAOPTS="--never-skip=40"
    
    # Give the location of the CD identification program:       
    CDDISCID=cd-discid            
                                   
    # Give the base location here for the encoded music files.
    OUTPUTDIR="$HOME/music/"               
    
    # Decide here how you want the tracks labelled for a standard 'single-artist',
    # multi-track encode and also for a multi-track, 'various-artist' encode:
    OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
    VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'
    
    # Decide here how you want the tracks labelled for a standard 'single-artist',
    # single-track encode and also for a single-track 'various-artist' encode.
    # (Create a single-track encode with 'abcde -1' from the commandline.)
    ONETRACKOUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}'
    VAONETRACKOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}'
    
    # Put spaces in the filenames instead of the more correct underscores:
    mungefilename ()
    {
      echo "$@" | sed s,:,-,g | tr / _ | tr -d \'\"\?\[:cntrl:\]
    }
    
    # What extra options?
    MAXPROCS=2                              # Run a few encoders simultaneously
    PADTRACKS=y                             # Makes tracks 01 02 not 1 2
    EXTRAVERBOSE=y                          # Useful for debugging
    EJECTCD=y                               # Please eject cd when finished :-)
    With this simple setup complete all that is required is to place the music CD of your choice in your drive and run the command abcde from a Terminal and make a cup of tea while your mp3s are being created. The script can of course do so much more than this. You can create ogg or flac files, you can normalise the volume of your mp3s or you can be much more adventurous with your lame settings. Enjoy your exploration of these great CLI programs!

    Andrew
    April 9th, 2009
    Last edited by andrew.46; April 9th, 2009 at 12:50 AM. Reason: Updated abcde.conf
    You think that's air you're breathing now?

  2. #2
    Join Date
    Jun 2005
    Location
    Albuquerque, New Mexico
    Beans
    272
    Distro
    Ubuntu Development Release

    Re: HOWTO: Convert music CDs to MP3 using the Command Line.

    Thanks! I've been looking for some like this.

    -GC
    "Nice jail. Looks strong."
    - H. Houdini

  3. #3
    Join Date
    Dec 2006
    Beans
    7,312

    Re: HOWTO: Convert music CDs to MP3 using the Command Line.

    Hi,

    Thanks:

    Quote Originally Posted by GrammatonCleric View Post
    Thanks! I've been looking for some like this.
    The fuller version of the page also shows ogg and flac conversion as well as the syntax to convert a cd to all 3 formats with one command:

    http://www.andrews-corner.org/abcde.html

    Great script that one, but not all that well known unfortunately,

    Andrew
    Last edited by andrew.46; January 19th, 2008 at 12:16 PM. Reason: New url
    You think that's air you're breathing now?

  4. #4
    Join Date
    Jan 2006
    Location
    Blacksburg, VA
    Beans
    67
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Convert music CDs to MP3 using the Command Line.

    Alright, I understand the idea, but you lost me at copying the file to your home drive and using a script. How do I get ABCDE to use one of your scripts (/etc/.abcde.conf) instead of the /ect/abcde.conf?

  5. #5
    Join Date
    Dec 2006
    Beans
    7,312

    Re: HOWTO: Convert music CDs to MP3 using the Command Line.

    Hi,

    Just a small misunderstanding:

    Quote Originally Posted by rockstar View Post
    Alright, I understand the idea, but you lost me at copying the file to your home drive and using a script. How do I get ABCDE to use one of your scripts (/etc/.abcde.conf) instead of the /ect/abcde.conf?
    You have to create a file in your home directory called .abcde.conf and then if you like copy my suggested settings into it. You can then place a cd in your drive, run the command abcde and the cd will be converted to mp3.

    Let me know if this is little clearer?

    Andrew
    You think that's air you're breathing now?

  6. #6
    Join Date
    Jan 2006
    Location
    Blacksburg, VA
    Beans
    67
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Convert music CDs to MP3 using the Command Line.

    So, I did what you said and copied the file:

    cp /etc/abcde.conf ~/.abcde.conf

    Then I opened the file and pasted your script

    gedit ~/.abcde.conf

    But then when I run ABCDE it still uses the original config file because it gets stuck on CDDB choices

    Thanks so much!

  7. #7
    Join Date
    Jan 2006
    Location
    Blacksburg, VA
    Beans
    67
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Convert music CDs to MP3 using the Command Line.

    Here is what I get when I run;

    Sudo abcde

    Multiple exact matches:
    #1: ---- folk 4c092806 Led Zeppelin / Physical Graffiti (Disc 1) ----
    1: Custard Pie
    2: The Rover
    3: In My Time of Dying
    4: Houses of the Holy
    5: Trampled Under Foot
    6: Kashmir

    #2: ---- misc 4c092806 Led Zeppelin / Physical Graffiti (Disc 1) ----
    1: Custard Pie
    2: The Rover
    3: In My Time of Dying
    4: Houses of the Holy
    5: Trampled Under Foot
    6: Kashmir

    #3: ---- rock 4c092806 Led Zeppelin / Physical Graffiti (Disc One) ----
    1: Custard Pie
    2: The Rover
    3: In My Time Of Dying
    4: Houses Of The Holy
    5: Trampled Under Foot
    6: Kashmir

    /home/paul/abcde.4c092806/cddbchoices (END)
    Last edited by rockstar; November 8th, 2007 at 09:28 AM.

  8. #8
    Join Date
    Dec 2006
    Beans
    7,312

    Re: HOWTO: Convert music CDs to MP3 using the Command Line.

    Hi,

    Now I see:

    Quote Originally Posted by rockstar View Post
    Here is what I get when I run;
    Sudo abcde

    Multiple exact matches:
    #1: ---- folk 4c092806 Led Zeppelin / Physical Graffiti (Disc 1) ----
    [...]

    #2: ---- misc 4c092806 Led Zeppelin / Physical Graffiti (Disc 1) ----
    [...]

    #3: ---- rock 4c092806 Led Zeppelin / Physical Graffiti (Disc One) ----
    [...]
    (END)
    A couple of small points:

    1. You should not have to use sudo for this
    2. Although you appear to have things working I have been a little less than clear, for which my apologies. You either copy the /etc/abcde.conf to home and edit it as .abcde.conf or you create a blank ~/.abcde.conf file and then copy my configuration into it. But I think in your case this has made no difference.


    The problem you have encountered here is a cddb database problem: 3 different people have entered the details of this album , in this case in 3 different categories. All that happens then is abcde waits for you to select 1, 2 or 3 and then the script continues.

    All the best; perservere as you are almost there!

    Andrew
    You think that's air you're breathing now?

  9. #9
    Join Date
    Jan 2006
    Location
    Blacksburg, VA
    Beans
    67
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Convert music CDs to MP3 using the Command Line.

    Alright I went through and removed abcde and re-installed in just in case I broke something.

    So I tried a different cd. I'm pretty sure it got passed the CDDB and I hope It's using your FLAC script

    http://people.aapt.net.au/~adjlstrong/abcde.html#flac

    But I must have done something else wrong as well.


    210 rock 4d0a6c07 CD database entry follows (until terminating `.')
    # xmcd
    #
    # Track frame offsets:
    # 182
    # 47090
    # 75907
    # 89350
    # 117595
    # 136480
    # 157792
    # Disc length: 2670 seconds
    # Revision: 35
    # Processed by: cddbd v1.5.2PL0 Copyright (c) Steve Scherf et al.
    #
    # Submitted via: libkcddb 0.10
    #
    DISCID=470a6507,490a6407,4d0a6c07
    DTITLE=Led Zeppelin / Presence
    DYEAR=1976
    DGENRE=Classic Rock
    TTITLE0=Achilles Last Stand
    TTITLE1=For Your Life
    TTITLE2=Royal Orleans
    TTITLE3=Nobody's Fault But Mine
    TTITLE4=Candy Store Rock
    TTITLE5=Hots On For Nowhere
    TTITLE6=Tea For One
    EXTD=
    EXTT0=
    EXTT1=
    EXTT2=
    [ Read 38 lines (Converted from DOS format) ]
    ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
    ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell


    I really appreciate the help!

  10. #10
    Join Date
    Dec 2006
    Beans
    7,312

    Re: HOWTO: Convert music CDs to MP3 using the Command Line.

    Hi,

    I hope you are still having fun? You have bumped into another simple problem:


    Quote Originally Posted by rockstar View Post
    But I must have done something else wrong as well. [..]

    ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
    ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell
    !
    The program that is open there is nano, which must be your default console editor. What you have done is selected' y' at the following question:

    Edit selected CDDB data? [y/n] (n):
    which then opens the cddb info in nano for further editing. Unless you wish to edit the information select 'n' instead and the process will continue. Hope this helps you on the way!

    Andrew
    You think that's air you're breathing now?

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •