[GRLUG] Bash Scripting

Benjamin Flanders flanderb at gmail.com
Sat Nov 17 12:17:05 EST 2007


I am having trouble with a shell script I am running.  I am trying to
use ffmpeg to transcode a video and the bash script seems to stop
after the first exec and doesn't do any of the following commands.
The first exec script is the first pass for encoding and this takes a
while.  I am thinking that bash isn't waiting for this finish before
trying to go on.  If you are interested the script is :
#!/bin/sh

[ $# -ne 2 -o "$1" = "-h" -o "$1" = "--help" ] &&
{ echo "${0##*/} input output"; exit 1; }

ffmpeg="/tmp/ffmpeg.log"

cmd="-r 29.97 -b 4096k -vcodec mpeg2video -aspect 4:3 -s 720x352 "
cmd="${cmd} -padtop 64 -padbottom 64 "
cmd="${cmd} -passlogfile ${ffmpeg} "

exec ffmpeg -i ${1} -pass 1 ${cmd} ${2}

rm ${2}

exec ffmpeg -i ${1} -pass 2 ${cmd} ${2}

rm ${ffmpeg}

-- 
Share and Enjoy
Ben


More information about the grlug mailing list