#! /bin/sh
if [ -z "$1" ]; then
- echo "Usage: [vcodec=s] [vbitrate=n] [vscale=s] [aid=n] [acodec=s] [abitrate=n] [ascale=s] [pass=n] $0 input.avi [-ffmpeg_options]"
+ echo "Usage: [vcodec=s] [vbitrate=n] [vscale=s] [aid=n] [acodec=s] [abitrate=n] [ascale=s] [pass=n] [input_opts=input_opts] [output_opts=output_opts] $0 input.avi"
exit 1
fi
shift
if [ "$pass" -eq 1 ]; then
- exec ffmpeg -i "$input" -f avi -c:v "$vcodec" -b:v "$vbitrate" -g 300 -bf 2 -c:a "$acodec" -b:a "$abitrate" "$@" output.avi
+ exec ffmpeg $input_opts -i "$input" -f avi -c:v "$vcodec" $vscale -b:v "$vbitrate" -g 300 -bf 2 -c:a "$acodec" -b:a "$abitrate" $output_opts output.avi
elif [ "$pass" -eq 2 ]; then
- ffmpeg -pass 1 -i "$input" -f avi -c:v "$vcodec" -b:v "$vbitrate" -g 300 -bf 2 -an -f rawvideo -y /dev/null "$@" &&
- exec ffmpeg -pass 2 -i "$input" -f avi -c:v "$vcodec" -b:v "$vbitrate" -g 300 -bf 2 -c:a "$acodec" -b:a "$abitrate" "$@" output.avi
+ ffmpeg -pass 1 $input_opts -i "$input" -f avi -c:v "$vcodec" $vscale -b:v "$vbitrate" -g 300 -bf 2 -an -f rawvideo -y /dev/null $output_opts &&
+ exec ffmpeg -pass 2 $input_opts -i "$input" -f avi -c:v "$vcodec" $vscale -b:v "$vbitrate" -g 300 -bf 2 -c:a "$acodec" -b:a "$abitrate" $output_opts output.avi
else
echo "Can only do 1 or 2 passes." >&2