Convert wma/mp3 to ogg

Had a few wma’s I needed to convert to a different format as I was having trouble streaming them over the net with my internet jukebox. I decided to go with ogg since I don’t have a decent hardware setup, GUI converters did not give me the best output. I tried both oggconvert and soundconverter both are great apps, but my hardware didn’t do them justice, but the command line came to my rescue. To convert the wma’s to ogg I used this cmd

find -name '*wma' -exec ffmpeg -i {} -acodec vorbis -ab 128k {}.ogg \;

This will convert all wma’s in the folder and subdirectories to ogg and you don’t have to take out empty spaces in the file names, it handles them ok.
All the new files have a name “track name.wma.ogg” to rename them to “track name.ogg” I was given this handy scripts by my friends at LinuxQuestions.org.

for file in *.wma.ogg; do mv "${file}" "${file%.wma.ogg}.ogg"; done

and

for file in *.wma.ogg; do mv "${file}" "${file/.wma.ogg/.ogg}"; done

This last one is a more general solution that keeps the first part, and the last part, regardless of the extensions used

for file in *.wma.ogg; do mv "${file}" "${file%%.*}.${file##*.}"; done

just change your variable to suit whatever you are working with.

Leave a Reply

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