LinuxAnswers DiscussionThis forum is to discuss articles posted to LinuxAnswers.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
This is a script I wrote to rip audio cd's into mp3 with a vbr. You can adjust or use bits as required. It's not commented in detail because I wrote it just for personal use.
Doesn't use intermediate files etc and runs fairly quick. I've not looked at the rest of this thread so it might have already been covered.
Code:
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Usage: " `basename $0` "<output directory> [device]"
exit
fi
if [ ! -d $1 ]
then
echo "$1 is not a valid directory"
exit
fi
#Default device to /dev/sr0 unless $2 is set
if [ $2 ]
then
device=$2
else
device="/dev/sr0"
fi
# Need determine the number of tracks on the disc
n_files=`cdparanoia -d $device -Q 2>&1 | egrep "^ *[0-9]+\." | wc -l`
if [ $n_files -lt 1 ]
then
echo "ERROR - Can't find any tracks - is the CD inserted?"
exit
fi
echo -e "Ripping $n_files files..."
for i in `seq 1 $n_files`
do
cdparanoia -d $device -q $i - | lame --silent -h --vbr-new -V 4 - `printf "%s/track_%02d.mp3" $1 $i`
echo - Sucessfully ripped track $i
done
echo "Ripping complete"
At all costs, we must always try to avoid reinventing the wheel. There is a lightweight commandline program that can rip files from audio CD to MP3 or OGG formats AND fetch track metadata (tag info) from the internet (ie CDDB/Gracenote) for the entire album. It's name is abcde and is available via synaptic in 'ubuntu'. Further configuration can be customized via /etc/abcde.conf.
I have followed your instructions but still get no audio.
The following is the output from my terminal after executing. I don't the file is converted, just renamed.
james@local ~/Desktop/convert /Disintegration $ wmamp3
mv: `Closedown.wma' and `Closedown.wma' are the same file
mv: `Disintegration.wma' and `Disintegration.wma' are the same file
mv: `Lullaby.wma' and `Lullaby.wma' are the same file
mv: `Plainsong.wma' and `Plainsong.wma' are the same file
mv: `Untitled.wma' and `Untitled.wma' are the same file
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-waveheader has been removed. Use -ao pcm:waveheader instead.
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
rm: cannot remove `audiodump.wav': No such file or directory
Back up your data before running this script, because on error it destroys the files it runs against. I ran the script with a newer version of mplayer, which had a different switch (specifically, `-waveheader' is now `pcm:waveheader'). However, renaming the files - without performing the conversion - still takes place! Luckily I have a backup. Do you? ^_^
I had made a script for converting audio files to and from MP3, WMA, OGG, AAC, FLAC, WAV. It is fairly safe as files are not removed if you dont want them to and existing files are not overwritten if you dont want them to. All the metadata tags (song information) are preserved (ie not lost) when converting to another format.
I had the same problem and the answer is in the error message. The newer version of mplayer uses different tags. A slight adjustment of the command line under #Rip with Mplayer took care of that.
@ egarson
An extra line in the script can do the backup for you. See the code under #make copies of original files.
Here is the script I'm currently using to convert wma-files of sound files I download from a web-server with mmsrip. My version of mplayer is SVN-r31628-4.4.4.
Code:
#!/bin/bash
current_directory=$( pwd )
#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done
#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
#make copies of original files
for i in *.wma; do cp "$i" "`basename "$i" .wma`.tmp"; done
#Rip with Mplayer / encode with LAME
for i in *.tmp ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader $i && lame -m s audiodump.wav -o $i; done
#convert file names
for i in *.tmp; do mv "$i" "`basename "$i" .tmp`.mp3"; done
rm audiodump.wav
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.