X-Git-Url: https://git.phdru.name/?p=audio-cdr-video.git;a=blobdiff_plain;f=video%2Fff_encode;h=e5afed8d9f36ce4d4291f1af8187222a8c5a5968;hp=c265ecde07a98f07c4ddbc6b2cd937ea588200ac;hb=80795b99dce510e6dbe3d800510f3386d915ae1d;hpb=4bbd85cc7f5986417f7b9b866d075de33a4be0f4 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