public
Created — forked from bxt/twopassenc.sh

  • Download Gist
twopassenc.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/bin/sh
# optimal_bitrate = 50 * 25 * width * height / 256
# credits: http://personal.cscs.ch/~mvalle/mencoder/mencoder.html
 
if [ $1 = "-h" ] ; then
echo "usage: twopassenc \"frames_run1/*.png\" output1.avi 1920 1200"
echo " [filname search string] [output file] [width] [height]"
else
bitrate=`(echo "50 * 25 * $3 * $4 / 256"|bc)`
echo "Using bitrate: $bitrate"
opt="vbitrate=$bitrate:mbd=2:keyint=132:v4mv:vqmin=3:lumi_mask=0.07:dark_mask=0.2:scplx_mask=0.1:tcplx_mask=0.1:naq"
mencoder "mf://$1" -mf fps=25 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:$opt -nosound -o /dev/null
mencoder "mf://$1" -mf fps=25 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:$opt -nosound -o $2
fi

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.