I'm trying to create a script that will trawl through a directory structure looking for VOB files, convert them to AVI and place them in a ./converted/ sub-directory of the the original source folder. I've knocked up the script below which appears to work fine when I place an "echo" in front of the actual ffmpeg encode line, I get the output on the screen with ffmpeg finding all the VOB files in the directories and looking to convert them to the correct sub-directory. Yet, when I remove the echo and run the script for real, ffmpeg converts the first file and then stops. No errors. Is this something to do with ffmpeg or a problem with my script below?
# Define the starting search point:
# Loop over directories looking for VOB files
while read file
if [ ! -d "$DIR/converted" ]
ORIGINAL=`basename "$file" .VOB`
ffmpeg -i "$file" -f avi -vcodec mpeg4 -b 5000k -g 300 -bf 2 -ab 192k "$DIR/converted/$NEWNAME"
done < <(find $start \( -iname \*.VOB \))
Thanks for your help