LinuxQuestions.org
Review your favorite Linux distribution.
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 03-29-2006, 10:49 PM   #1
salviadud
Member
 
Registered: Feb 2005
Location: Mexico
Distribution: Gentoo - kernel 4.1.5
Posts: 186

Rep: Reputation: 30
Question trying to encode wav => mp3 with SOX, bitrate problems.


I have lots of wav files that are recorded at 128 kbit/8Hz. I want them converted to mp3 with sox. I know it's simple, i just do
Code:
sox inputfile.wav outputfile.mp3
But, sox converts the file to 8kbit, and that's not cool... how do i make sox convert it to mp3 with 128 kbit (as in the original)?
 
Old 03-29-2006, 11:27 PM   #2
kencaz
Senior Member
 
Registered: Mar 2005
Location: Las Vegas, NV
Distribution: Mandriva Slackware FreeBSD
Posts: 1,468

Rep: Reputation: 48
If you have Lame try using the ./mlame script: It works great for me and will do multiple .wav to .mp3 conversions at any bitrate you want using:


mlame -r -o "-v -V 0 -b 128" *.wav *.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
 
Old 03-30-2006, 02:18 AM   #3
salviadud
Member
 
Registered: Feb 2005
Location: Mexico
Distribution: Gentoo - kernel 4.1.5
Posts: 186

Original Poster
Rep: Reputation: 30
thanx a lot dude
 
  


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
How do I find out the bitrate of an mp3? redhatman Linux - Newbie 4 11-22-2013 05:30 PM
Reduce MP3 bitrate lumpfish Linux - Software 5 10-26-2009 05:17 AM
Enconding MP3 to lower bitrate Gonto Linux - Software 2 07-20-2005 04:50 AM
clean up and convert wav 2 mp3 with sox dibblethewrecke Linux - Software 1 12-04-2004 08:52 AM
Sox to remove silence from wav J_Szucs Linux - Newbie 1 01-11-2003 12:36 PM

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

All times are GMT -5. The time now is 11:59 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