#!/bin/sh## Usage:## jpg2h264 photos/foo/ bar# produces bar-h264.mpg from the directory photos/foo## prep the rotation of the images with this:# renrot --extension JPG --no-rename *# or perhaps with:# jhead -autorot## The aspect ratio is still foo, need to run convert or something#DIR=$1OUT=$2-h264.mpgIMGEXT=JPGFPS=.75OUTFPS=25#VFOPTS="scale=752:500,pp=autolevels,harddup"VFOPTS="scale=320:240"#X264ENCOPTS="direct_pred=auto:subq=7:trellis=2:threads=4"#X264ENCOPTS="qp=25:threads=auto:subq=4:bframes=2:b_pyramid:weight_b"X264ENCOPTS="bitrate=1000:threads=auto:subq=4:bframes=2:b_pyramid:weight_b"#X264ENCOPTS=""# fast_pskip Performs early skip detection in P-frames (default: enabled). This usually improves speed at no cost, but it can sometimes produce artifacts in areas with no details, like sky.# nr=<0-100000> Noise reduction, 0 means disabled. 100-1000 is a useful range for typical content, but you may want to turn it up a bit more for very noisy content (default: 0). Given its small impact on speed, you might want to prefer to use this over filtering noise away with video filters like denoise3d or hqdn3d.cd $DIRrm -f lavc_stats.txtrm -f divx2pass.log#--subme 6, --partitions all, --trellis 1, --8x8dct, --ref 3, --mixed-refs# -x264encopts $X264ENCOPTS:pass=1 \# -x264encopts $X264ENCOPTS \# -ofps $OUTFPS \mencoder \ "mf://*.$IMGEXT" \ -mf fps=$FPS \ -quiet \ -ovc x264 \ -of mpeg \ -vf $VFOPTS \ -o $OUT#mencoder \# "mf://*.JPG" \# -mf fps=$FPS \# -quiet \# -ovc x264 \# -of mpeg \# -x264encopts $X264ENCOPTS:pass=2 \# -ofps $OUTFPS \# -o $OUT