ffmpeg: Batch Converting

    I was getting tired of converting each individual flash video to mpg by hand, so I wrote a script to convert every .flv file in a directory.

#!/bin/sh
for f in *.flv ;
do FILE=${f%%.flv};
 ffmpeg -i "$FILE.flv" -target ntsc-dvd -s 320×240 "$FILE.mpg"
 done

    Using my favorite bash scripting tutorial: The Advanced Bash scripting Guide, I figured out how to strip the suffix and separating period from a file.  You can find it here, just search for '%%'.

    My biggest problem was to get ffmpeg to recognize filenames with spaces.  ffmpeg, for that matter most command line applications, see spaces as file separators.  After trying many things I found using double quotes did the trick.