Converting flv files to mp3 on CLI
> Recently found myself needing to convert 2000+ .flv files to .mp3 files
it took me a while to find a solution.
I first tried a Japanese program iExtractMP3.app but it couldn't cope
with some older .flv files I'm not sure why I think it must be something
to do with how they were created.
I eventually ended up using VLC on the command line. Then it took me a
while to work out the right set of parameters to use as VLC seems to do
a huge number of different things.
You end up with the Directory full of the original then converted version. aardvark.flv aardvark.mp3 cartilage.flv cartilage.mp3
This post was very helpful in working out the basis. There are a lot of arguments and I'm not an expert but my combination seems to work for the files I was working with.
#!/bin/bash
# extract audio from flv files to mp3 files
# using vlc app
for file in /Directory/*.flv; do
/Applications/VLC.app/Contents/MacOS/VLC -I dummy $file
--sout="#transcode{vcodec=dummy,acodec=mp3,ab=128,channels=2,samplerate=44100,scodec=none}:standard{mux=raw,access=file{overwrite},dst=\"$(echo
"$file" | sed 's/\.[^\.]*$/.mp3/')\"}" vlc://quit; done;
You end up with the Directory full of the original then converted version. aardvark.flv aardvark.mp3 cartilage.flv cartilage.mp3
This post was very helpful in working out the basis. There are a lot of arguments and I'm not an expert but my combination seems to work for the files I was working with.
/ Adam