Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-13-2009, 05:28 PM
|
#1
|
Member
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77
Rep:
|
nautilus script audio conversion
HI Im running Ubuntu 7.10 and Gnome. I was trying to batch convert a bunch of wave file to high quality mp3's(320kbs). I figured it's best to use those nautilus scripts below:
http://g-scripts.sourceforge.net/cat-multimedia.php
I copied them to the scripts directory, and made them executable.
When I right click in nautilus and choose audio-converter or Naudilus, nothing happens. When I try Wom-audio converter a window comes up where only the mp3's option does anything at all, and it only puts out an empty file (0kb)!?
What am I missing here?
thank you!
|
|
|
01-14-2009, 09:13 PM
|
#2
|
Member
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77
Original Poster
Rep:
|
update: I found this:
https://bugs.launchpad.net/ubuntu/+s...rt/+bug/130055
and it added a new menu item under scripts, which seems to work, but it also only puts out a file with 0kb!?
why is that?
|
|
|
01-15-2009, 12:00 AM
|
#3
|
Member
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77
Original Poster
Rep:
|
doing the conversion with lame only, also puts out an emapty file, So here must be where the problem is.
Quote:
lame test.wav test.mp3
LAME 3.97 32bits (http://www.mp3dev.org/)
CPU features: MMX (ASM used), SSE, SSE2
Using polyphase lowpass filter, transition band: 8269 Hz - 8535 Hz
Encoding test.wav to test.mp3
Encoding as 22.05 kHz 32 kbps single-ch MPEG-2 Layer III (11x) qval=3
Only 8, 16, 24 and 32 bit input files supported
|
|
|
|
01-15-2009, 12:06 AM
|
#4
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Here is the script that I use to convert oggs to mp3s. I first convert the ogg to a wave file and then use lame to convert the temporary wave file to an mp3.
Code:
#!/usr/bin/env bash
# convert ogg file to wav file using mplayer
# ${1} is the ogg filename
oggfile="${1}"
echo "$oggfile" # debug
mplayer -vo null -vc null -ao pcm:waveheader:file="${oggfile%.ogg}.wav" "${oggfile}"
# Extract the tag variables TITLE, YEAR, ARTIST, ALBUM
# define get_tags() function
. ~/bin/get_tags "${oggfile}"
get_tags ${oggfile}
if [ -d $DATE ]; then YEAR=$DATE; fi
# Convert .wav file to .mp3 file. Set the tags as well.
lame "${oggfile%.ogg}.wav" \
--tt "${TITLE}" \
--ty "${DATE}" \
--ta "${ARTIST}" \
--tl "${ALBUM}" \
--tg "${GENRE}" \
--tn "${TRACKNUMBER}" \
"${oggfile%.ogg}.mp3"
# remove the temporary file
rm "${oggfile%.ogg}.wav"
Here is where the get_tags() function is defined:
Code:
cat bin/get_tags
get_tags()
{
# clear out old tags
ALBUM='';
ARTIST='';
DATE='';
GENRE='';
TITLE='';
# the tags returned by ogginfo are of the form NAME=VALUE.
# put single quotes around the values to encapsulate white space.
# eval will set the tag variables ALBUM, ARTIST, DATE, GENRE, TITLE
eval $(ogginfo ${1} | sed '/[A-Z][A-Z]*=/!d;s/=\(.*\)$/='"'"'\1'"'"'/;s/^\t//')
}
|
|
|
01-15-2009, 12:02 PM
|
#5
|
Member
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77
Original Poster
Rep:
|
nice, thank you! How would I use this script just for wav to mp3 (high quality, 320kbs) conversion?
|
|
|
01-17-2009, 04:13 AM
|
#6
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
This is the part that performs wav to ogg conversion:
Code:
# Convert .wav file to .mp3 file. Set the tags as well.
lame "${oggfile%.ogg}.wav" \
--tt "${TITLE}" \
--ty "${DATE}" \
--ta "${ARTIST}" \
--tl "${ALBUM}" \
--tg "${GENRE}" \
--tn "${TRACKNUMBER}" \
"${oggfile%.ogg}.mp3"
# remove the temporary file
rm "${oggfile%.ogg}.wav"
It is lame that does the work of conversion, so you can do it with just a lame command.
Look at the manpage of lame for more options such as setting the cbr bitrate or vbr bitrate ranges.
Code:
CBR (constant bitrate, the default) options:
-b n For MPEG1 (sampling frequencies of 32, 44.1 and 48 kHz)
n = 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320
For MPEG2 (sampling frequencies of 16, 22.05 and 24 kHz)
n = 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160
Default is 128 for MPEG1 and 64 for MPEG2.
--cbr enforce use of constant bitrate
ABR (average bitrate) options:
--abr n
Turns on encoding with a targeted average bitrate of n kbits, allowing to use frames of different sizes. The allowed range of n is 8 - 310, you can use any
integer value within that range.
It can be combined with the -b and -B switches like: lame --abr 123 -b 64 -B 192 a.wav a.mp3 which would limit the allowed frame sizes between 64 and 192 kbits.
Last edited by jschiwal; 01-17-2009 at 04:18 AM.
|
|
|
01-17-2009, 07:33 PM
|
#7
|
Member
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77
Original Poster
Rep:
|
great, thanks you! that's what I was looking for, I also found this:
http://www.experts-exchange.com/Digi..._23692279.html
for i in *.wav; do lame -h -b 192 "$i" "${i%.wav}.mp3"; done
but, I get errors using this line. Sorry Im not well versed in the command line!
I am in a folder with a bunch of .wav files and want to convert them, how do I need to change that line?
thanks in advance for any insight!
|
|
|
01-18-2009, 01:17 PM
|
#8
|
Member
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77
Original Poster
Rep:
|
I guess my problem is that lame isn't really working from the command line, it always put out an empty file, even when trying to do a simple conversion such as:
Quote:
$ lame -b 128 test.wav test.mp3
LAME 3.97 32bits (http://www.mp3dev.org/)
CPU features: MMX (ASM used), SSE, SSE2
polyphase lowpass filter disabled
Encoding test.wav to test.mp3
Encoding as 22.05 kHz 128 kbps single-ch MPEG-2 Layer III (2.8x) qval=3
Only 8, 16, 24 and 32 bit input files supported
phi@Betelgeuse:~/Music/NEW$ lame -b 32 test.wav test.mp3
LAME 3.97 32bits (http://www.mp3dev.org/)
CPU features: MMX (ASM used), SSE, SSE2
Using polyphase lowpass filter, transition band: 8269 Hz - 8535 Hz
Encoding test.wav to test.mp3
Encoding as 22.05 kHz 32 kbps single-ch MPEG-2 Layer III (11x) qval=3
Only 8, 16, 24 and 32 bit input files supported
|
This is frustrating, I have no idea why it's doing that!
|
|
|
01-18-2009, 04:00 PM
|
#9
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
You might also try using sox to convert the audio.
One thing to check is that you have the needed libraries.
|
|
|
01-19-2009, 01:16 PM
|
#10
|
Member
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77
Original Poster
Rep:
|
Ah! I have it, but I get:
'SoX was compiled without MP3 encoding support'
same thing probably happened on all the other command line encoders I got installed here.
For some reason ripping off CD's, encodes just fine, but not from my HD.
I guess I have to recompile and reinstall, what a PITA!
Thanks anyhow!~
|
|
|
All times are GMT -5. The time now is 12:38 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|