Created
February 27, 2011 12:38
-
-
Save bxt/846147 to your computer and use it in GitHub Desktop.
Encode frames saved in image files to 2-pass-mpeg4-compressed video
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment