-
-
Save otmjka/6378b10522ded3574fb9fef007ed3aba to your computer and use it in GitHub Desktop.
Convert wma files to mp3 using ffmpeg & lame
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # wma2mp3.sh | |
| # Ricardo Tun <me@ricardotun.net> | |
| # | |
| # Depends: lame, ffmpeg | |
| # Use: ./wma2mp3.sh path_to_wma_files | |
| # If directory is not specified, the current working directory will be used to find wma files. | |
| wma2mp3() { | |
| if [ ! -e *.wma ]; then | |
| echo "`basename $0`: It looks like there's any wma file in this directory." | |
| sleep 2 | |
| else | |
| i=0 | |
| for j in *.wma | |
| do | |
| ffmpeg -i "$j" -vn -f wav - | lame -V2 - "`basename "$j" .wma`".mp3 | |
| rm -f "$j" | |
| let i=i+1 | |
| done | |
| clear | |
| echo "`basename $0`: $i wma files converted to mp3." | |
| sleep 2 | |
| fi | |
| } | |
| if [ ! -n "$1" ]; then | |
| echo "`basename $0`: Not specifying directory. Using ./ to find wma files to convert..." | |
| sleep 2 | |
| wma2mp3 | |
| else | |
| basedir=`pwd` | |
| echo "`basename $0`: Looking to wma files in $1 directory." | |
| sleep 2 | |
| cd "$1" | |
| wma2mp3 | |
| cd "$basedir" | |
| fi | |
| # EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment