How Do I Burn MP3 onto an audio CD from Linux shell command prompt?

last updated in Categories Howto, Linux, Linux desktop, Linux distribution, RedHat/Fedora Linux, Shell scripting, Tip of the day, Ubuntu Linux

Recently I decided to burn selected MP3 files on an audio CD from command prompt.

First, you need to convert your mp3 (myfile.mp3) into .wav (myfile.wav) file:
$ mpg123 -w myfile.wav myfile.mp3
Use above command to convert all files to mp3

Then burn all .wav file on to the CD
# cdrecord -dev=ATA:1,0,0 -eject speed=4 -pad -audio *.wav

For more information see:

Get 15% off on Linux Foundation certified SysAdmin, Progamming, Kubernetes/Containers and Open Stack certification & course. Use "SPLASH15" coupon code. Offer expires on August 27, 2018
training.linuxfoundation.org

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

5 comment

  1. You can use lame to encode the WAVs to MP3s. Once wav file created using cdparanoia you can use lame to encode the file wav to an MP3:

    lame myfile.wav myfile.mp3

    lame also supports bitrate option for example to use 256 kilobytes bitrate you can use:

    lame -b 256 myfile.wav myfile.mp3

    Read man page of lame for all supported options.

  2. To convert all mp3 files, accounting for spaces in names and correcting the “filename.mp3.wav” naming, try:

    IFS=$'n' ; for i in $(ls |grep mp3$) ; do echo $i ; mpg123 -w `basename $i .mp3`.wav $i ; done

    Have a question? Post it on our forum!