LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 01-13-2009, 05:28 PM   #1
itzig
Member
 
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77

Rep: Reputation: 15
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!
 
Old 01-14-2009, 09:13 PM   #2
itzig
Member
 
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77

Original Poster
Rep: Reputation: 15
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?
 
Old 01-15-2009, 12:00 AM   #3
itzig
Member
 
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77

Original Poster
Rep: Reputation: 15
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
 
Old 01-15-2009, 12:06 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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//')
}
 
Old 01-15-2009, 12:02 PM   #5
itzig
Member
 
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77

Original Poster
Rep: Reputation: 15
nice, thank you! How would I use this script just for wav to mp3 (high quality, 320kbs) conversion?
 
Old 01-17-2009, 04:13 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
Old 01-17-2009, 07:33 PM   #7
itzig
Member
 
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77

Original Poster
Rep: Reputation: 15
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!
 
Old 01-18-2009, 01:17 PM   #8
itzig
Member
 
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77

Original Poster
Rep: Reputation: 15
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!
 
Old 01-18-2009, 04:00 PM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You might also try using sox to convert the audio.

One thing to check is that you have the needed libraries.
 
Old 01-19-2009, 01:16 PM   #10
itzig
Member
 
Registered: Jan 2006
Location: bay area
Distribution: slackware, Ubunutu, OSX
Posts: 77

Original Poster
Rep: Reputation: 15
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!~
 
  


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
Audio Conversion: FLAC to WAV timswim78 Linux - Software 4 12-06-2017 07:12 PM
LXer: Audio conversion tools for Linux LXer Syndicated Linux News 0 02-28-2008 07:40 PM
audio conversion problems,,, Armon Linux - General 4 06-13-2005 04:51 PM
clustering audio conversion? e1000 Linux - Software 2 06-15-2004 07:33 PM
Audio conversion tools bulliver Linux - Software 8 04-03-2003 03:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:38 PM.

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