Converting multiple wmv videos to audio in bash

iPods and smart phones happily play hours of videos but I still find it difficult to watch them whilst walking ! So what do you do when you find an online course that consists of 60 wmv files ?

Mac and iPod won’t play nice with these so the normal iTunes ‘create AAC version’ trick won’t work. In this case not even the current version of FLV Crunch helped, yielding instead a mysterious ffmpeg error.

Here we go, download the latest ffmpeg binary and copy it to a directory that’s  in you $PATH, eg. I have a bin directory in my home directory.

Now for the clever part, the braces syntax below maps the .wmv file extension of each input file to the .m4a of the corresponding audio file. The AAC format is assumed from the file name and I’m not sure you even need -vn

My MacBook is currently chewing through 25GB of videos !

for x in *.wmv
  ffmpeg -i "$x" -vn "${x%.wmv}.m4a"
done

facebooktwitterlinkedinrssfacebooktwitterlinkedinrss

Leave a Reply

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