If you're going to use cron, then there are some other things to consider:
1. Cron limits $PATH to /(s)bin and /usr/(s)bin, so you'll have to use full path to ffmpeg if you have compiled it from source
2. The script must check if the output file already exists and skip the input if it does. Otherwise all files will be encoded over and over again on every run.
You can use a simple file test:
Code:
if [ ! -e "$dest_file" ]; then
# ... process the file
fi
Or, if source files can change and destinations must be updated:
Code:
if [ ! -e "$dest_file" -o "$src_file" -nt "$dest_file" ]; then
# ... process the file
fi
3. Encoding is a time-consuming process so if there are many files to encode the previous batch might not be complete yet when the next one starts. I would suggest using some queueing mechanism like Task Spooler (ts):
http://vicerveza.homeunix.net/~viric/soft/ts/
This utility should be in most major distributions. In some cases it can be called a different name like "tsp".
It can also run multiple tasks in parallel, you can set maximum number of simultaneous processes with a command line option.