LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxAnswers Discussion
User Name
Password
LinuxAnswers Discussion This forum is to discuss articles posted to LinuxAnswers.

Notices

Reply
 
LinkBack Search this Thread
Old 12-06-2010, 05:50 PM   #91
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 547

Rep: Reputation: 115Reputation: 115

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"

Last edited by devnull10; 12-06-2010 at 05:55 PM.
 
Old 12-07-2010, 01:41 AM   #92
dopla
Member
 
Registered: Aug 2008
Location: Beacon Bay, East London, South Africa
Distribution: Ubuntu
Posts: 30

Rep: Reputation: 16
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.
 
Old 12-07-2010, 10:30 AM   #93
gnyrfta
LQ Newbie
 
Registered: Jan 2010
Location: Sweden
Distribution: Ubuntu
Posts: 14
Blog Entries: 4

Rep: Reputation: 0
:)

Worked great - thx!
 
Old 12-07-2010, 10:31 AM   #94
gnyrfta
LQ Newbie
 
Registered: Jan 2010
Location: Sweden
Distribution: Ubuntu
Posts: 14
Blog Entries: 4

Rep: Reputation: 0
:)

Cadjs code that is
 
Old 02-14-2011, 07:14 AM   #95
Phacoff
LQ Newbie
 
Registered: Feb 2011
Posts: 1

Rep: Reputation: 0
this should go without saying, but make sure to make a copy of your wma files if you want to keep them as is.
 
Old 04-08-2011, 12:41 PM   #96
Luthaneal
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
Could someone tell me, please, how exactly do I do step 5:

"5. as root, copy the file to your exec path (/usr/bin or /bin)"
 
Old 04-08-2011, 12:50 PM   #97
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Slackware 14.0
Posts: 8,464

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
Quote:
Originally Posted by Luthaneal View Post
Could someone tell me, please, how exactly do I do step 5:

"5. as root, copy the file to your exec path (/usr/bin or /bin)"
type
Code:
sudo cp filename /usr/local/bin
Kind regards
 
Old 04-10-2011, 12:56 AM   #98
Luthaneal
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
Thank you.
 
Old 04-10-2011, 10:48 AM   #99
jamessp007
Member
 
Registered: Aug 2002
Location: Highland, UT
Distribution: Linux Mint 9
Posts: 44

Rep: Reputation: 15
I ge the new file but no audio

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
 
Old 05-13-2011, 11:16 AM   #100
egarson
LQ Newbie
 
Registered: May 2011
Posts: 1

Rep: Reputation: 0
Exclamation Somewhat Dangerous Script

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? ^_^
 
Old 05-14-2011, 07:05 AM   #101
dopla
Member
 
Registered: Aug 2008
Location: Beacon Bay, East London, South Africa
Distribution: Ubuntu
Posts: 30

Rep: Reputation: 16
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.

You can read more about it on its official googlecode website: http://code.google.com/p/ftransc/

Cheers
 
Old 06-05-2011, 09:06 AM   #102
JoatMan
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Rep: Reputation: 0
@ jamessp007

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
Hope someone will find this useful.
Cheers
 
  


Reply

Tags
amarok, convert, mp3, wma


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert wma to ogg lixy Linux - Software 20 10-12-2011 05:58 PM
convert wma > mp3? andrewlkho Linux - Software 31 08-20-2007 12:26 AM
wma to mp3 pulsez Linux - Newbie 5 10-27-2005 07:17 PM
Any program that can convert mp3 files to wma? josh_hd_new Linux - Newbie 1 01-21-2005 02:03 AM
how to convert a wma to mp3?? yenonn Linux - General 2 04-26-2004 07:25 PM


All times are GMT -5. The time now is 04:03 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration