LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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
 
LinkBack Search this Thread
Old 09-28-2005, 06:24 PM   #1
SolidSnakeX28
Member
 
Registered: May 2005
Distribution: Gentoo Linux
Posts: 85

Rep: Reputation: 15
Mass LAME encoding?


I have alot of music that I want to encode using lame, but don't want to repetitively type the commands. How can I do this?
 
Old 09-28-2005, 06:39 PM   #2
kencaz
Senior Member
 
Registered: Mar 2005
Location: Las Vegas, NV
Distribution: Mandriva Slackware FreeBSD
Posts: 1,468

Rep: Reputation: 45
I use the mlame script below. It works great for me never had a problem...

1. Copy/Paste save as 'mlame'

2. Make it executable:
chmod -x mlame

3. Put to use from command line:
./mlame -r -o "-v -V 0 -b 128" *.wav *.mp3

WARNING: the original .wav becomes .mp3

#!/bin/bash
#!/usr/local/bin/bash
############################################################################
#
# Run the LAME encoder on multiple files, with option to delete .wav files
# after encoding. "mlame -h" will give instructions.
#
# Robert Hegemann <Robert.Hegemann@gmx.de>
#
############################################################################

mp3coder="lame"
options="-h -d -m j -b 128"
rmsrc=false

helptext="\
\nThis script runs the LAME mp3 encoder on multiple files: \n\n\
$0 [options] <file 1> ... <file n>\n\
\n\
options:\n\
-h this help text\n\
-r remove files after encoding\n\
-o \"<lame options>\" overrides script default options \"${options}\"\n\
\n\
example:\n\
$0 -r -o \"-v -V 0 -b 112\" a*.wav z*.aif\n\
\n\
"

# process command-line options
# this could be extended to fake the
# commandline interface of the mp3encoder

while getopts ":r" optn; do
case $optn in
o ) options=$OPTARG # replace default options
;;
r ) rmsrc=true
;;
\? ) printf "$helptext"
exit 1
;;
esac
done
shift $(($OPTIND - 1))

# process input-files

for filename in "$@"; do
case $filename in
*[*?]* ) # means shell couldnīt extend *.wav, etc.
echo "warning: no $filename file(s) found"
;;
*[.][wW][aA][vV] )
name=${filename%[.][wW][aA][vV]}
if $mp3coder $options "$filename" "${name}.mp3"
then
if [ $rmsrc = true ]; then
rm -f "$filename"
fi
fi
;;
*[.][aA][iI][fF] )
name=${filename%[.][aA][iI][fF]}
if $mp3coder $options "$filename" "${name}.mp3"
then
if [ $rmsrc = true ]; then
rm -f "$filename"
fi
fi
;;
* )
if $mp3coder $options "$filename" "${filename}.mp3"
then
if [ $rmsrc = true ]; then
rm -f "$filename"
fi
fi
;;
esac
done


KC
 
Old 09-28-2005, 06:40 PM   #3
daihard
Member
 
Registered: Jul 2003
Location: Lynnwood, WA
Distribution: Kubuntu 10.10
Posts: 912

Rep: Reputation: 31
Re: Mass LAME encoding?

Quote:
Originally posted by SolidSnakeX28
I have alot of music that I want to encode using lame, but don't want to repetitively type the commands. How can I do this?
If you're using KDE, you can use KAudioCreator. You can choose LAME as the encoder. KAudioCreator lets you rip/encode multiple files at once.
 
Old 09-28-2005, 07:09 PM   #4
SolidSnakeX28
Member
 
Registered: May 2005
Distribution: Gentoo Linux
Posts: 85

Original Poster
Rep: Reputation: 15
I meant MP3 files; unless kaudiocreator can also encode those from the hard drive to another location of the hard drive (in which case I'd like to know how).
 
Old 09-28-2005, 11:15 PM   #5
kencaz
Senior Member
 
Registered: Mar 2005
Location: Las Vegas, NV
Distribution: Mandriva Slackware FreeBSD
Posts: 1,468

Rep: Reputation: 45
Quote:
Originally posted by SolidSnakeX28
I meant MP3 files; unless kaudiocreator can also encode those from the hard drive to another location of the hard drive (in which case I'd like to know how).
so what format are you trying to convert to what? if .mp3 to .cda then yes Kaudiocreator will work, however, from HD to HD I don't know. usually from CD to HD.

Do you have audio (.cda) format files on your HD?

Please elaborate!

KC
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
lame wav2mp3 encoding help Cinematography Linux - Software 3 11-06-2005 02:17 PM
lame dfowensby cAos 3 09-14-2005 08:11 PM
encoding using Grip+lame minm Linux - Software 4 08-09-2004 01:25 PM
lame mp3 encoding under Grip Joe47 Fedora 12 07-26-2004 08:45 AM
Lame doralsoral Linux - Software 4 09-08-2003 11:54 PM


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

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