]> git.phdru.name Git - audio-cdr-video.git/commitdiff
Specify an output file; remove fixed AVI format
authorOleg Broytman <phd@phdru.name>
Tue, 4 Nov 2014 00:22:44 +0000 (03:22 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 4 Nov 2014 00:27:47 +0000 (03:27 +0300)
Output format will be determined by the output file's extension.

video/ff_encode

index 990e5c332b80d95b52bf62c33a8b2124c51bed43..c838f9719d09cc6e0db5b67f1d9f2271c06677f6 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] [aid=n] [acodec=s] [abitrate=n] [ascale=s] [pass=n] [input_opts=input_opts] [output_opts=output_opts] $0 input.avi"
+   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 [output]"
    exit 1
 fi
 
    exit 1
 fi
 
@@ -32,17 +32,24 @@ fi
 input="$1"
 shift
 
 input="$1"
 shift
 
+if [ -n "$1" ]; then
+   output="$1"
+   shift
+else
+   output=output.avi
+fi
+
 if [ "$vcodec" = mpeg4-hq ]; then
    vcodec=mpeg4
    vopts="-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2"
 fi
 
 if [ "$pass" -eq 1 ]; then
 if [ "$vcodec" = mpeg4-hq ]; then
    vcodec=mpeg4
    vopts="-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2"
 fi
 
 if [ "$pass" -eq 1 ]; then
-   exec ffmpeg $input_opts -i "$input" -f avi -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -g 300 -bf 2 -c:a "$acodec" -b:a "$abitrate" $output_opts output.avi
+   exec ffmpeg $input_opts -i "$input" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -g 300 -bf 2 -c:a "$acodec" -b:a "$abitrate" $output_opts "$output"
 
 elif [ "$pass" -eq 2 ]; then
 
 elif [ "$pass" -eq 2 ]; then
-   ffmpeg -pass 1 $input_opts -i "$input" -f avi -c:v "$vcodec" $vopts $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" $vopts $vscale -b:v "$vbitrate" -g 300 -bf 2 -c:a "$acodec" -b:a "$abitrate" $output_opts output.avi
+   ffmpeg -pass 1 $input_opts -i "$input" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -g 300 -bf 2 -an -f rawvideo -y /dev/null $output_opts &&
+   exec ffmpeg -pass 2 $input_opts -i "$input" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -g 300 -bf 2 -c:a "$acodec" -b:a "$abitrate" $output_opts "$output"
 
 else
    echo "Can only do 1 or 2 passes." >&2
 
 else
    echo "Can only do 1 or 2 passes." >&2