#!/bin/sh source="$1" dest="$2" title="$3" image="$4" V_BITRATE=700 A_BITRATE=192 MAX_X=480 MAX_Y=320 HandBrakeCLI --input "$source" --output "$dest" --markers -v 5 \ --encoder x264 --x264opts nocabac:no8x8dct:bframes=0:noweight_b \ --two-pass --turbo \ --vb $V_BITRATE --ab $A_BITRATE --maxWidth $MAX_X --maxHeight $MAX_Y || exit 1 if [ \! "$title" ]; then title="$(basename "${source%.*}" | sed 's/[-._]/ /g')" fi if [ \! "$image" ]; then mplayer -vo png:outdir=/tmp/video2phone-$$ -nosound -ss 5 -frames 1 "$source" image=/tmp/video2phone-$$/00000001.png fi AtomicParsley "$dest" --title "$title" --artwork "$image" --overWrite if [ -d /tmp/video2phone-$$ ]; then rm -r /tmp/video2phone-$$ fi