Thursday, February 22, 2024
 Popular · Latest · Hot · Upcoming
19
rated 0 times [  19] [ 0]  / answers: 1 / hits: 41366  / 10 Months ago, fri, may 26, 2023, 9:10:03

I know there are options such as Sound Converter for doing them one track or directory at a time, but are there any tools that will recursively crawl through a directory's subdirectories and convert all WMA's to MP3's?



I basically would like to let it loose on my ~/Music and let it do its thing without me manually having to give it one subdirectory at a time.


More From » sound

 Answers
2

MPlayer is likely to be installed already. Also make sure you have lame:



sudo apt-get install mplayer lame


Then there are two ways to do it, an easy to read version, and a short and dirty script to do it:



All wma's should be in your current directory.
Create a file called wmamp3 in your home directory (~/) containing:



#!/bin/bash

current_directory=$( pwd )

#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done

#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done

#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -ao pcm:waveheader $i && lame -m s audiodump.wav -o $i; done

#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done

#cleanup
rm audiodump.wav


chmod +x ~/wmamp3 to make it executable



sudo cp ~/wmamp3 /usr/bin to pop it somewhere useful on your path



Type "wmamp3" to run your conversion.






The short and dirty version (does exactly the same as above):



for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -ao pcm:waveheader "$i" && lame -m j -h --vbr-new -b 160 audiodump.wav -o "`basename "$i" .wma`.mp3"; done; rm -f audiodump.wav

[#44037] Saturday, May 27, 2023, 10 Months  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cocal

Total Points: 236
Total Questions: 111
Total Answers: 123

Location: Belarus
Member since Tue, Mar 14, 2023
1 Year ago
cocal questions
Tue, Oct 12, 21, 20:46, 2 Years ago
Sat, Oct 8, 22, 04:23, 1 Year ago
Sun, Dec 18, 22, 02:24, 1 Year ago
Wed, Jun 29, 22, 17:31, 2 Years ago
;