The following script will iterate through all of the ogv files in the present working directory. This script takes considerable time, maintaining as much quality as I know how. It takes about twice as much time to encode as it does to record (by my guesstimation). If your file was out.ogv, you get a flash video named out.ogv.flv.
for file in *.ogv
do
mencoder -of lavf -oac mp3lame -lameopts abr:br=56 -srate 22050 -ovc lavc -lavcopts vcodec=flv:vbitrate=250:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -o ${file}.flv ${file}
done
What if you want to change the sound before encoding to the final flash form? I'll handle that in another post.
Why not just:
$ ffmpeg ${file} ${file}.flv
I've been having more luck with this simple command recently. Video editing with ffmpeg and/or mencoder is still a bit of a mystery but ffmpeg has been giving me more love recently.