Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old July 18th, 2006   #1
aarbear26
5 Cups of Ubuntu
 
aarbear26's Avatar
 
Join Date: Mar 2006
Location: PA
Beans: 33
Ubuntu 6.06
Talking HOW TO: Convert any audio to an mp3

I have spent weeks trying to figure out how to convert my .rm and .ram files to mp3. I finally found it by searching for something to encode an mp3 from a wma. This works for wma, RealMedia or any other format that your mplayer is set up to play.

Also so everyone knows I did not come up with this on my own, I found it here and had to make some changes to make it compatible with enhancements in mplayer.

1. open gedit to a blank document (Applications >Accessories>Text Editor)

2. copy this text into it, then save it as wmamp3 (or whatever format you use it for)

#!/bin/bash

current_directory=$( pwd )

#remove spaces
for i in *.ram; do mv "$i" `echo $i | tr ' ' '_'`; done

#remove uppercase
for i in *.ram; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done

#Rip with Mplayer / encode with LAME
for i in *.ram ; 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 *.ram; do mv "$i" "`basename "$i" .ram`.mp3"; done

rm audiodump.wav

3. For wma use this, or for other formats anywhere you see .wma change it to .rm or .ogg or.mov, use it for anything mplayer can play

4. Open a terminal (Applications>Accessories>Terminal) and make sure you are in the directory the file was saved in

5. make it executable with:
chmod +x wmamp3 (or for other to use it too use a+x for +x)

6. and copy it to your script folder with:
sudo cp wmamp3 /usr/bin/
(you'll want to rename other iterations things like rmmp3, movmp3 and change the line accordingly)

7. Then use it by going to the folder in terminal and typing wmamp3

WARNING!! This will change ALL your files in that folder of the type specified to an mp3 and remove the old files. Create backups of your files first and test it on your system to make sure you have everything configured properly!!

Notes:
I'm not sure I like the quality of the files made by lame, i may change later to toolame or if anyone knows of a better mp3 encoder I'm all ears for better options. Also, you can use this to convert to ogg, wma or anything you have an encoder for. I hope this helps anyone looking for a quick solution to convert large amounts of files.

On my system it took about 15 seconds to convert each rm file to mp3.

Good luck!
aarbear26 is offline   Reply With Quote
Old July 23rd, 2006   #2
evaristegalois
A Carafe of Ubuntu
 
Join Date: Feb 2006
Beans: 112
Ubuntu 6.06
Re: HOW TO: Convert any audio to an mp3

The perl audio converter pac will do the job as well, although it is rather a grief to install

--evaristegalois
evaristegalois is offline   Reply With Quote
Old July 23rd, 2006   #3
evaristegalois
A Carafe of Ubuntu
 
Join Date: Feb 2006
Beans: 112
Ubuntu 6.06
Re: HOW TO: Convert any audio to an mp3

FANTASTIC! I spent hours trying to re-install the perl audio converter pac which once upon a time I had working but couldn't get re-installed, and now you have given such an elegant solution for the problem. Thanks!

--evaristegalois
evaristegalois is offline   Reply With Quote
Old September 3rd, 2006   #4
standards
5 Cups of Ubuntu
 
Join Date: Jun 2006
Beans: 21
Re: HOW TO: Convert any audio to an mp3

great how-to. using it right now and it's working fantastically.

however, i think there might be a typo under point 3. the script you've written is NOT for wma files, it's for .ram (real audio? i have no idea) files. easy enough for most to figure out, but still.
standards is offline   Reply With Quote
Old September 10th, 2006   #5
finferflu
Extra Foam Sugar Free Ubuntu
 
finferflu's Avatar
 
Join Date: Jul 2006
Location: Pomezia, Rome, IT
Beans: 825
Ubuntu 9.04 Jaunty Jackalope
Send a message via MSN to finferflu Send a message via Yahoo to finferflu Send a message via Skype™ to finferflu
Talking Re: HOW TO: Convert any audio to an mp3

Thanks a lot for this very useful script, I really appreciate your how-to
finferflu is offline   Reply With Quote
Old October 10th, 2006   #6
Adam Golebiewski
First Cup of Ubuntu
 
Adam Golebiewski's Avatar
 
Join Date: Nov 2005
Beans: 8
Ubuntu 6.06
Re: HOW TO: Convert any audio to an mp3

it's just GREAT!

Adam
Adam Golebiewski is offline   Reply With Quote
Old November 3rd, 2006   #7
Maximinus
First Cup of Ubuntu
 
Maximinus's Avatar
 
Join Date: Nov 2006
Location: New Zealand
Beans: 6
Ubuntu 7.10 Gutsy Gibbon
Re: HOW TO: Convert any audio to an mp3

Brilliant - just used it to convert a bunch of FLACs created by Sound Juicer from an audio CD
Maximinus is offline   Reply With Quote
Old December 29th, 2006   #8
jstrubberg
5 Cups of Ubuntu
 
Join Date: Jul 2005
Beans: 17
Re: HOW TO: Convert any audio to an mp3

I must be missing something. Evertime I execute the script I get the following:



-aofile is deprecated. Use -ao pcm:file=<filename> instead.
MPlayer 2:0.99+1.0pre8-0ubuntu8 (C) 2000-2006 MPlayer Team
CPU: Genuine Intel(R) CPU T2500 @ 2.00GHz (Family: 6, Model: 14, Stepping:
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
jstrubberg is offline   Reply With Quote
Old August 20th, 2008   #9
tetrafuran
Just Give Me the Beans!
 
tetrafuran's Avatar
 
Join Date: Jun 2007
Beans: 82
Xubuntu 8.04 Hardy Heron
Re: HOW TO: Convert any audio to an mp3

I got something similar but then I fixed the parts that say ".ram" into ".rm" in the script. If you are converting wma files then your .ram should say .wma.
__________________
I installed ubuntu 18.4.2007.
tetrafuran is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:20 PM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry