X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=video%2Fff_encode;h=cb20f956c2e9d162fe3f71ba4dc6610cd28ac4f8;hb=2afadf768679bd3a1592ecb34412d51a8d2c02b7;hp=c838f9719d09cc6e0db5b67f1d9f2271c06677f6;hpb=99b2740dabc2164f36f5acfdccd2234b352136ab;p=audio-cdr-video.git diff --git a/video/ff_encode b/video/ff_encode index c838f97..cb20f95 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] [input_opts=input_opts] [output_opts=output_opts] $0 input [output]" + 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 @@ -39,17 +39,39 @@ else output=output.avi fi -if [ "$vcodec" = mpeg4-hq ]; then +if [ "$vcodec" = mpeg4 ]; then + vopts="-g 300 -bf 2" + +elif [ "$vcodec" = mpeg4-hq ]; then + vcodec=mpeg4 + vopts="-g 300 -bf 2 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2" + +elif [ "$vcodec" = mpeg4-vhq ]; then vcodec=mpeg4 - vopts="-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2" + vopts="-g 200 -bf 2 -mbd rd -flags +mv4+aic+qprd+mv0 -flags2 skiprd -trellis 2 -cmp 2 -subcmp 2" + +elif [ "$vcodec" = x264 ]; then + vcodec=libx264 + +elif [ "$vcodec" = x264-hq ]; then + vcodec=libx264 + vopts="-preset slow" + +elif [ "$vcodec" = x264-vhq ]; then + vcodec=libx264 + vopts="-preset veryslow" + +else + echo "Unknown video codec $vcodec; known codecs are {mpeg4,x264}[-[v]hq], copy" >&2 + exit 1 fi if [ "$pass" -eq 1 ]; then - 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" + 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 $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" + 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