jrincon87
November 20th, 2005, 03:03 AM
This is a simple script which will allow you to convert all the files in a folder into ogg format.
First create a file called wma2ogg with your favorite text editor:
Code:
gedit wma2ogg.sh
Copy the following script:
#!/bin/bash
# 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 Oggenc
for i in *.wma ; do
mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader $i && oggenc -q 6 audiodump.wav -o $i;
done
# Convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.ogg"; done
rm audiodump.wav
Save and close.
Make the script executable:
Code:
chmod +x wma2ogg.sh
Copy the file into /usr/bin
Code:
sudo cp wma2ogg.sh /usr/bin
Now you can change to the folder in which you have the wma files and execute the program.
Code:
sudo wma2ogg.sh
This will automatically encode ALL the wma files in the folder into Ogg, quality = 6 (around 160kbps and 210kbps), and OVERWRITE them, which means you don't have to manually erase the original files after you have converted them (if not desired, make a copy of the original wma files).
Dependencies:
- mplayer
- vorbis-tools
That's all. Start converting files!
First create a file called wma2ogg with your favorite text editor:
Code:
gedit wma2ogg.sh
Copy the following script:
#!/bin/bash
# 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 Oggenc
for i in *.wma ; do
mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader $i && oggenc -q 6 audiodump.wav -o $i;
done
# Convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.ogg"; done
rm audiodump.wav
Save and close.
Make the script executable:
Code:
chmod +x wma2ogg.sh
Copy the file into /usr/bin
Code:
sudo cp wma2ogg.sh /usr/bin
Now you can change to the folder in which you have the wma files and execute the program.
Code:
sudo wma2ogg.sh
This will automatically encode ALL the wma files in the folder into Ogg, quality = 6 (around 160kbps and 210kbps), and OVERWRITE them, which means you don't have to manually erase the original files after you have converted them (if not desired, make a copy of the original wma files).
Dependencies:
- mplayer
- vorbis-tools
That's all. Start converting files!