Format Conversion Scripts

Format Conversion scripts

WMA to MP3

I created this script to go through all *.wma files in a directory and convert them to mp3 files and then delete the wma files. I works great for my mp3 play that does not support wma. It takes the wma files and converts them to wav then converts them to mp3. It uses mplayer and lame to do the work.

#!/bin/bash
#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -ao pcm -vc dummy "$i" && lame --preset 128 audiodump.wav -o "`basename "$i" .wma`.mp3"; done; rm -f audiodump.wav
#Delete audiodump.wav
rm audiodump.wav

ffmpeg

If you need to transcode from one format to another I have struggled to get it working correctly the fastest / best program I have used is ffmpeg. I’ll document some of my steps here to make the correct ffmpeg setup.

To display all codec’s / supported formats type

ffmpeg -formats

To convert from a file to avi type this:

ffmpeg -i inputfilename.mpg output.avi

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.