Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
#!/bin/sh
# Re-encode movie files, using mencoder
# $Id: rmov,v 1.4 2009/10/05 11:07:53 yuuji Exp $
# (c)2003-2004 by HIROSE Yuuji [yuuji@gentei.org]
myname=`basename $0`
SCALE=""
vcodec=mpeg4
oac=mp3lame
outdir=.
channels=2
gamma=1.2
ext=avi
verbose=''
seconds=''
ofps=''
vb=''
force=''
newX='' newY=''
otheropt=''
# if echo a | tr -u a a >/dev/null 2>&1; then
# TR='tr -u'
# else
# TR='tr'
# fi
finalize () {
# rm -f $anntmp > /dev/null 2>&1
echo Terminated. 1>&2
exit 0
}
usage() {
cat<&2
echo "サイズ指定は XxY とか 0.75 のように書くべし" 1>&2
exit 2 ;;
esac
fi
tmp1=00000001.jpg tmp2=00000002.jpg
jpginfo=`(cd "$outdir"
mplayer -frames 1 -vo jpeg "$1"
rdjpgcom -v $tmp1
rm -f $tmp1 $tmp2)`
width=`expr "$jpginfo" : '.* \([0-9]*\)w.*'`
height=`expr "$jpginfo" : '.* \([0-9]*\)h.*'`
if [ "$newX" ]; then
newwidth="$newX"
newheight=`expr $height \* $newX / $width`
elif [ "$newY" ]; then
newwidth=`expr $width \* $newY / $height`
newheight="$newY"
else
newwidth=`echo $width \* $SCALE | bc | sed 's/\..*//'`
newheight=`echo $height \* $SCALE | bc | sed 's/\..*//'`
fi
echo "-vf scale=${newwidth}:${newheight}"
}
reconv() {
#dir=`dirname "$1"`
base=`basename "$1"`
root="$outdir"/`expr "$base" : '\(.*\)\..*'`
new=`newname $root $ext "$1"`
[ $verbose ] && echo "Set outfile to $new"
if [ -z "$newX" -a -z "$newY" -a -z "$SCALE" ]; then
vf='-vf scale'
else
vf=`checksize "$1"`
fi
vf="$vf,eq2=$gamma"
[ $quiet ] || echo "$1 -> $new $vf"
cmdline="mencoder -ovc lavc -lavcopts vcodec=$vcodec -oac $oac $vf $opts \
$xy -channels $channels -o '$new' $otheropt '$1'"
echo "$cmdline"
eval "$cmdline" 2> /dev/null
touch -r "$1" $new
# | nkf -u | perl -e '$|=1; select((select(0), $|=1)[0]);
# while (<>) {s/\n/\r/; print}'
}
opts=''
[ "$start" ] && opts="$opts -ss $start"
[ "$end" ] && opts="$opts -endpos $end"
[ "$ofps" ] && opts="$opts -ofps $ofps"
[ "$vb" ] && vcodec="${vcodec}:vbitrate=$vb"
vcodec="${vcodec}:vhq"
for f in $files; do
reconv "$f"
done