LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-03-2005, 06:47 PM   #1
lemuel
Member
 
Registered: Nov 2003
Location: Cebu, Philippines
Distribution: Ubuntu
Posts: 73

Rep: Reputation: 15
how do i compress an existing mp3 from 128 bit to 32 bit?


I have lame and sox installed. can I use them to compress an existing mp3 from 128 bit to 32 bit? how do I do that?

If its not possible, what software do I need?
 
Old 01-03-2005, 08:40 PM   #2
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
I don't know if it's necessary to convert to .wav first, but you can do so with sox like this:

Code:
sox -t wav -r 44100 -w -c 2 file.mp3 file.wav
You can maybe omit all the options, but those will give you a standard CD-ready .wav file. Then use lame to convert back to .mp3:

Code:
lame -b 32 file.wav file_32.mp3
Check the lame manual page ('man lame') for more options. You could probably tweak the quality settings to get better output, and unless the file actually needs to be a constant 32kbits/sec, you could probably use variable bitrate (-vbr option to lame) to get a little better quality with about the same file size.
 
Old 01-03-2005, 08:59 PM   #3
lemuel
Member
 
Registered: Nov 2003
Location: Cebu, Philippines
Distribution: Ubuntu
Posts: 73

Original Poster
Rep: Reputation: 15
thanks for the info wapcaplet.

is it possible to convert to wav all the mp3s in a directory all at one command?

is it also possible to compress it directly without having to convert it wav?
 
Old 01-04-2005, 03:54 PM   #4
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Sure enough, I just looked at the lame man page, and it has an option --mp3input, which says is for downsampling an existing mp3. So you're in luck!

Here's a way you can encode a bunch of files at once. Say you want to convert all the mp3s in the current directory, and put the new files in ./compressed. You'd do something like this:

Code:
mkdir ./compressed
for file in *.mp3; do lame --mp3input -b 32 "$file" "./compressed/$file"; done
(The double-quotes are to prevent problems with filenames containing spaces. If your filenames don't have spaces, you can leave the double-quotes out)
 
Old 01-04-2005, 08:28 PM   #5
lemuel
Member
 
Registered: Nov 2003
Location: Cebu, Philippines
Distribution: Ubuntu
Posts: 73

Original Poster
Rep: Reputation: 15
ok i got it!

thanks abunch for your help!
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Unsigned Integers of 128 bit bluechicken Programming 1 06-27-2005 02:27 PM
128 bit encryption SSL in Apache jbeiter Linux - Security 2 11-03-2004 09:58 PM
128 bit encryption cyrilvictor Linux - Security 1 11-02-2004 09:18 AM
128 bit encryption cyrilvictor Linux - Security 4 11-02-2004 07:16 AM
How to enable 40 bit WEP instead of 128 bit WEP tweedledee Linux - Wireless Networking 1 01-01-2004 10:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:23 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration