#!/bin/sh if [ "$#" -ne "5" ] then echo "" echo "Usage: encode-x264.sh [video bitrate] [video width] [video height] infile outfile" echo "" exit 1 fi #echo "Audio bitrate: $1" #if [ "$1" -lt "32" ] #then # echo "Audio bitrate too low! Value must be between 32 and 320 (kbit)." # exit 1 #fi #if [ "$1" -gt "320" ] #then # echo "Audio bitrate too high! Value must be between 32 and 320 (kbit)." # exit 1 #fi echo "Video bitrate: $1" if [ "$1" -lt "100" ] then echo "Video bitrate too low! Value must be 100 or higher (kbit)." exit 1 fi echo "Video width: $2" if [ "$2" -lt "320" ] then echo "Video width too low! Value must be 320 or higher." exit 1 fi echo "Video height: $3" if [ "$3" -lt "180" ] then echo "Video height too low! Value must be 180 or higher." exit 1 fi echo "Input video: $4" echo "Output video: $5" echo "Passing parameters to mencoder and starting encoding." rm divx2pass*.log mencoder -vf lavcdeint,scale="$2":"$3",harddup -ovc x264 -x264encopts subq=5:8x8dct:frameref=2:bframes=3:b_pyramid:weight_b:bitrate="$1":pass=1 -oac copy -o "$5" "$4" mencoder -vf lavcdeint,scale="$2":"$3",harddup -ovc x264 -x264encopts subq=5:8x8dct:frameref=2:bframes=3:b_pyramid:weight_b:bitrate="$1":pass=2 -oac copy -o "$5" "$4" echo "Encoding finished." echo "END"