]> git.phdru.name Git - audio-cdr-video.git/commitdiff
Pass crop filter
authorOleg Broytman <phd@phdru.name>
Tue, 4 Nov 2014 23:06:47 +0000 (02:06 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 4 Nov 2014 23:06:47 +0000 (02:06 +0300)
video/ff_encode

index c265ecde07a98f07c4ddbc6b2cd937ea588200ac..e5afed8d9f36ce4d4291f1af8187222a8c5a5968 100755 (executable)
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 if [ -z "$1" ]; then
 #! /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
 
    exit 1
 fi
 
@@ -29,6 +29,10 @@ if [ -z "$pass" ]; then
    pass=1
 fi
 
    pass=1
 fi
 
+if [ -n "$crop" ]; then
+   crop="-vf crop=$crop"
+fi
+
 if [ $# -eq 1 ]; then
    input="$1"
 else
 if [ $# -eq 1 ]; then
    input="$1"
 else
@@ -67,11 +71,11 @@ else
 fi
 
 if [ "$pass" -eq 1 ]; then
 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
 
 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
 
 else
    echo "Can only do 1 or 2 passes." >&2