From: Oleg Broytman Date: Tue, 4 Nov 2014 23:06:47 +0000 (+0300) Subject: Pass crop filter X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=80795b99dce510e6dbe3d800510f3386d915ae1d;p=audio-cdr-video.git Pass crop filter --- diff --git a/video/ff_encode b/video/ff_encode index c265ecd..e5afed8 100755 --- a/video/ff_encode +++ b/video/ff_encode @@ -1,7 +1,7 @@ #! /bin/sh if [ -z "$1" ]; then - echo "Usage: [vcodec=s] [vbitrate=n] [vscale=s] [acodec=s] [abitrate=n] [ascale=s] [pass=n] [input_opts=input_opts] [output_opts=output_opts] [output=output.avi] $0 input1 [input2...]" + echo "Usage: [vcodec=s] [vbitrate=n] [vscale=s] [acodec=s] [abitrate=n] [ascale=s] [pass=n] [input_opts=input_opts] [output_opts=output_opts] [output=output.avi] [crop=w:h:x:y] $0 input1 [input2...]" exit 1 fi @@ -29,6 +29,10 @@ if [ -z "$pass" ]; then pass=1 fi +if [ -n "$crop" ]; then + crop="-vf crop=$crop" +fi + if [ $# -eq 1 ]; then input="$1" else @@ -67,11 +71,11 @@ else fi if [ "$pass" -eq 1 ]; then - exec ffmpeg -threads auto $input_opts -i "$input" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -c:a "$acodec" -b:a "$abitrate" $output_opts "$output" + exec ffmpeg -threads auto $input_opts -i "$input" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -c:a "$acodec" -b:a "$abitrate" $output_opts $crop "$output" elif [ "$pass" -eq 2 ]; then - ffmpeg -pass 1 -threads auto $input_opts -i "$input" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -an -f rawvideo -y /dev/null $output_opts && - exec ffmpeg -pass 2 -threads auto $input_opts -i "$input" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -c:a "$acodec" -b:a "$abitrate" $output_opts "$output" + ffmpeg -pass 1 -threads auto $input_opts -i "$input" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -an -f rawvideo -y /dev/null $output_opts $crop && + exec ffmpeg -pass 2 -threads auto $input_opts -i "$input" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -c:a "$acodec" -b:a "$abitrate" $output_opts $crop "$output" else echo "Can only do 1 or 2 passes." >&2