flags=+loop
cmp=+chroma
partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8
me_method=umh
subq=9
me_range=16
g=250
keyint_min=25
sc_threshold=40
i_qfactor=0.71
b_strategy=2
qcomp=0.6
qmin=10
qmax=51
qdiff=4
refs=6
directpred=3
trellis=2
rc_lookahead=60
level=30
maxrate=2048k
bufsize=4096k
coder=0
bf=0
flags2=-wpred-dct8x8
wpredp=0
h264base.sh
#!/bin/bash
ARGS=("[email protected]")
INPUT=${ARGS[0]}
if [ -z ${INPUT} ]; then
echo "need one media file!"
exit
fi
echo "converting ${INPUT} ..."
width=
height=
audiobitrate=
videobitrate=
if [ -z ${width} ]; then
echo "Detecting WIDTH... "
info=`ffmpeg -i ${INPUT} 2>&1 | grep Video`
echo "${info}"
width=`echo "${info}" | grep Video | awk {'print $6'} | cut -d "x" -f 1`
fi
if [ -z ${height} ]; then
echo "Detecting HEIGHT... "
height=`echo "${info}" | grep Video | awk {'print $6'} | cut -d "x" -f 2 | cut -d "," -f 1`
fi
if [ -z ${width} ]; then
echo "cannot detect width, exit ..."
exit
fi
if [ -z ${height} ]; then
echo "cannot detect width, exit ..."
exit
fi
echo "width:height=${width}:${height}"
FLAG="-y -f mp4 -threads 0"
ACFLAG="-acodec libfaac -ac 2 -ab 96k"
VFLAG="-vcodec libx264 \
-s 720x480 -aspect ${width}:${height} \
-b 768k -bt 1536k \
-vpre baseslow "
echo "ffmpeg -i ${INPUT} ${FLAG} ${ACFLAG1} ${VFLAG} ${INPUT}.mp4"
echo ""
ffmpeg -i ${INPUT} ${FLAG} ${ACFLAG} ${VFLAG} ${INPUT}.mp4