LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux > 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

Tags used in this thread
Popular LQ Tags

Reply
 
Thread Tools
Old 08-10-2006, 04:29 PM   #31
TradedManatee
LQ Newbie
 
Registered: Feb 2006
Posts: 5
Thanked: 0
Newer versions of mplayer


[Log in to get rid of this advertisement]
[
mplayer -ao pcm -aofile "${i%.wma}.wav" "$i" && lame -h "${i%.wma}.wav" "${i%.wma}.mp3"

]

Newer versions of mplayer have a slightly different syntax:

mplayer -ao pcm:file="${i%.wma}.wav" ...
TradedManatee is offline     Reply With Quote
Old 08-20-2007, 01:26 AM   #32
WARnux
LQ Newbie
 
Registered: Jun 2007
Distribution: Debian with KDE
Posts: 17
Thanked: 0
I thought I'd submit a fixed version of the original perl script:
Code:
#!/usr/bin/perl

#Searches a directory for mp3 files,
#normalizes the sound and then
#creates an .ogg file.

#$fromExt and $toExt can be used to change
#the default conversions. Remember
#to change the oggenc line as well.

#Modified by WARnux but still has no warrenty

$fromExt='mp3';
$toExt='ogg';
$tmpDir='/tmp/NormalizeAndConvertTmp/';
$outDir='./';
#'./Normalized_'.$toExt.'/';
mkdir($tmpDir);
mkdir($outDir);

$dir=`pwd`;
chop($dir);
opendir(checkdir,"$dir");

while($file=readdir(checkdir))
{
	$orig_file= $file;
#/in here matches a regex/
#$ makes it match the end of the string and i is for case insensitive
	if($orig_file !~ /\.$fromExt$/i)
	{next};
	
	print "Checking file: $orig_file\n";
	
	$temp= $orig_file;
#s is for substitute; it will replace the first match with the second string
	$temp =~ s/\.$fromExt$/\.wav/i;
	$out= $orig_file;
	$out =~ s/\.$fromExt$/\.$toExt/i;
	
	$convert1= "mplayer \"./$orig_file\" -vc null -vo null -af volnorm -ao pcm:file=\"$tmpDir$temp\"";
	$convert2= "oggenc \"$tmpDir$temp\" -o \"$outDir$out\"";
#"lame -h \"$tmpDir$temp\" \"$outDir$out\"";
	$remove_temp= "rm -rf \"$tmpDir$temp\"";
	
	print "Converting to .wav: $convert1\n";
	$cmd= `$convert1`;
	print "Converting to .ogg: $convert2\n";
	$cmd= `$convert2`;
	print "Removing .wav: $remove_temp\n";
	$cmd= `$remove_temp`;
	print "\n\n";
}
rmdir($tmpDir);
print "Done.\n\n";
The original had a few issues if files were .MP3 or .mp3.mp3 and I added scalability and other improvements. Oh, and by default, it converts mp3 not wma but that's easily changed.

Last edited by WARnux; 08-20-2007 at 08:03 AM.. Reason: Didn't keep some slashes in post with [php]
WARnux is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
DISCUSSION: Convert WMA to MP3 cadj LinuxAnswers Discussion 78 11-14-2009 07:09 PM
Convert wma to ogg lixy Linux - Software 13 07-19-2008 01:45 AM
Wma to Mp3 Knowledgements Slackware 23 09-23-2006 10:07 AM
Any program that can convert mp3 files to wma? josh_hd_new Linux - Newbie 1 01-21-2005 03:03 AM
how to convert a wma to mp3?? yenonn Linux - General 2 04-26-2004 08:25 PM


All times are GMT -5. The time now is 07:50 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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration