[SATLUG] Bash scripting noob could use some help with a Bash script

Nate Turnage pixelnate at gmail.com
Sun May 30 00:10:59 CDT 2010


I am trying to automate a process of encoding many videos into six different
formats. That's not the part that I need help with, yet. I am starting out
trying to batch process the image still preview images for each of the
videos. All of the videos are quicktime '.mov' files. The ffmpeg commands I
am working from can be found here:
http://rodrigopolo.com/wp-content/uploads/video/BigBuckBunny/encoding-commands.txt

What I would like to do is iterate over all the '.mov' files in a directory
and save out a preview of them using ffmpeg. Each of these preview files
should be named 'filename_preview.jpg'. The script is trying to do what I am
asking, but I don't know how to get it to save the file out properly. The
files aren't being saved and the images are being 'written' on the terminal.
Can somebody take a look at the script and offer some pointers?

Script:

#!/bin/bash
FILES="*.mov"
for f in $FILES
do
  echo "Processing $f file..."
  ffmpeg -i $f -ss 78.5 -s 640x352 -vframes 1 -an -f image2 ${f}_preview.jpg
  cat $f
done


Thanks in advance,

Nate


More information about the SATLUG mailing list