X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=video%2Fff_encode;h=6c29a10f61d6e75d45720c20481fa6cb513b558b;hb=44bd40306e6f23b5c8601b46178bd46eab88488f;hp=bdca2177eb8b2232124396343ab2211a87fcd0fc;hpb=2c61676e8fd4863e1399b4363db1198de3d06262;p=audio-cdr-video.git diff --git a/video/ff_encode b/video/ff_encode index bdca217..6c29a10 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] [aid=n] [acodec=s] [abitrate=n] [ascale=s] [pass=n] $0 input.avi [-ffmpeg_options]" + echo "Usage: [vcodec=s] [vbitrate=n] [vscale=s] [acodec=s] [abitrate=n] [ascale=s] [pass=n] [input_opts=input_opts] [output_opts=output_opts] $0 input [output]" exit 1 fi @@ -32,12 +32,47 @@ fi input="$1" shift +if [ -n "$1" ]; then + output="$1" + shift +else + output=output.avi +fi + +if [ "$vcodec" = mpeg4 ]; then + vopts="-g 300 -bf 2" +fi + +if [ "$vcodec" = mpeg4-hq ]; then + vcodec=mpeg4 + vopts="-g 300 -bf 2 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2" +fi + +if [ "$vcodec" = mpeg4-vhq ]; then + vcodec=mpeg4 + vopts="-g 200 -bf 2 -mbd rd -flags +mv4+aic+qprd+mv0 -flags2 skiprd -trellis 2 -cmp 2 -subcmp 2" +fi + +if [ "$vcodec" = x264 ]; then + vcodec=libx264 +fi + +if [ "$vcodec" = x264-hq ]; then + vcodec=libx264 + vopts="-preset slow" +fi + +if [ "$vcodec" = x264-vhq ]; then + vcodec=libx264 + vopts="-preset veryslow" +fi + 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" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -c:a "$acodec" -b:a "$abitrate" $output_opts "$output" 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" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -an -f rawvideo -y /dev/null $output_opts && + exec ffmpeg -pass 2 $input_opts -i "$input" -c:v "$vcodec" $vopts $vscale -b:v "$vbitrate" -c:a "$acodec" -b:a "$abitrate" $output_opts "$output" else echo "Can only do 1 or 2 passes." >&2