📄 regression.sh
字号:
#!/bin/sh## automatic regression test for ffmpeg###set -x# Even in the 21st century some diffs are not supporting -u.diff -u "$0" "$0" > /dev/null 2>&1if [ $? -eq 0 ]; then diff_cmd="diff -u"else diff_cmd="diff"fidiff -w "$0" "$0" > /dev/null 2>&1if [ $? -eq 0 ]; then diff_cmd="$diff_cmd -w"fiset -edatadir="./data"logfile="$datadir/ffmpeg.regression"outfile="$datadir/a-"# tests to doif [ "$1" = "mpeg4" ] ; then do_mpeg4=yelif [ "$1" = "mpeg" ] ; then do_mpeg=y do_mpeg2=yelif [ "$1" = "ac3" ] ; then do_ac3=yelif [ "$1" = "huffyuv" ] ; then do_huffyuv=yelif [ "$1" = "mpeg2thread" ] ; then do_mpeg2thread=yelif [ "$1" = "snow" ] ; then do_snow=yelif [ "$1" = "snowll" ] ; then do_snowll=yelif [ "$1" = "libavtest" ] ; then do_libav=y logfile="$datadir/libav.regression" outfile="$datadir/b-"else do_mpeg=y do_mpeg2=y do_mpeg2thread=y do_msmpeg4v2=y do_msmpeg4=y do_wmv1=y do_wmv2=y do_h261=y do_h263=y do_h263p=y do_mpeg4=y do_mp4psp=y do_huffyuv=y do_mjpeg=y do_ljpeg=y do_jpegls=y do_rv10=y do_rv20=y do_mp2=y do_ac3=y do_g726=y do_adpcm_ima_wav=y do_adpcm_ms=y do_rc=y do_mpeg4adv=y do_mpeg4thread=y do_mpeg4nr=y do_mpeg1b=y do_asv1=y do_asv2=y do_flv=y do_ffv1=y do_error=y do_svq1=y do_snow=y do_snowll=y do_adpcm_yam=y do_dv=y do_dv50=yfi# various filesffmpeg="../ffmpeg_g"tiny_psnr="./tiny_psnr"reffile="$2"benchfile="$datadir/ffmpeg.bench"raw_src="$3/%02d.pgm"raw_dst="$datadir/out.yuv"raw_ref="$datadir/ref.yuv"pcm_src="asynth1.sw"pcm_dst="$datadir/out.wav"pcm_ref="$datadir/ref.wav"if [ X"`echo | md5sum 2> /dev/null`" != X ]; then do_md5sum() { md5sum -b $1; }elif [ -x /sbin/md5 ]; then do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }else do_md5sum() { echo No md5sum program found; }fi# create the data directory if it does not existsmkdir -p $datadirdo_ffmpeg(){ f="$1" shift echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $* $ffmpeg -y -flags +bitexact -dct fastint -idct simple -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true rm -f /tmp/ffmpeg$$ do_md5sum $f >> $logfile if [ $f = $raw_dst ] ; then $tiny_psnr $f $raw_ref >> $logfile elif [ $f = $pcm_dst ] ; then $tiny_psnr $f $pcm_ref 2 >> $logfile else wc -c $f >> $logfile fi expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp echo `cat $datadir/bench2.tmp` $f >> $benchfile}do_ffmpeg_crc(){ f="$1" shift echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $* -f crc $datadir/ffmpeg.crc $ffmpeg -y -flags +bitexact -dct fastint -idct simple $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:|ffmpeg version| configuration| built)" /tmp/ffmpeg$$ || true rm -f /tmp/ffmpeg$$ echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile}do_ffmpeg_nocheck(){ f="$1" shift echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $* $ffmpeg -y -flags +bitexact -dct fastint -idct simple -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true rm -f /tmp/ffmpeg$$ expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp echo `cat $datadir/bench2.tmp` $f >> $benchfile}echo "ffmpeg regression test" > $logfileecho "ffmpeg benchmarks" > $benchfile#################################### generate reference for quality checkdo_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_refdo_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref###################################if [ -n "$do_mpeg" ] ; then# mpeg1 encodingfile=${outfile}mpeg1.mpgdo_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file# mpeg1 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_mpeg2" ] ; then# mpeg2 encodingfile=${outfile}mpeg2.mpgdo_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video $file# mpeg2 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst# mpeg2 encodingfile=${outfile}mpeg2.mpgdo_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -idct int -dct int -f mpeg1video $file# mpeg2 decodingdo_ffmpeg $raw_dst -y -idct int -i $file -f rawvideo $raw_dst# mpeg2 encoding interlacedfile=${outfile}mpeg2i.mpgdo_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -flags +ildct+ilme $file# mpeg2 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_mpeg2thread" ] ; then# mpeg2 encoding interlacedfile=${outfile}mpeg2thread.mpgdo_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2 $file# mpeg2 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst# mpeg2 encoding interlacedfile=${outfile}mpeg2reuse.mpgdo_ffmpeg $file -y -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4 $file# mpeg2 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_msmpeg4v2" ] ; then# msmpeg4 encodingfile=${outfile}msmpeg4v2.avido_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file# msmpeg4v2 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_msmpeg4" ] ; then# msmpeg4 encodingfile=${outfile}msmpeg4.avido_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file# msmpeg4 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_wmv1" ] ; then# wmv1 encodingfile=${outfile}wmv1.avido_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file# wmv1 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_wmv2" ] ; then# wmv2 encodingfile=${outfile}wmv2.avido_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv2 $file# wmv2 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_h261" ] ; then# h261 encodingfile=${outfile}h261.avido_ffmpeg $file -y -qscale 11 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h261 $file# h261 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_h263" ] ; then# h263 encodingfile=${outfile}h263.avido_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file# h263 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_h263p" ] ; then# h263p encodingfile=${outfile}h263p.avido_ffmpeg $file -y -qscale 2 -flags +umv+aiv+aic -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file# h263p decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_mpeg4" ] ; then# mpeg4file=${outfile}odivx.mp4do_ffmpeg $file -y -flags +mv4 -mbd bits -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file# mpeg4 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_huffyuv" ] ; then# huffyuvfile=${outfile}huffyuv.avido_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec huffyuv -pix_fmt yuv422p $file# huffyuv decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -2 -pix_fmt yuv420p $raw_dstfi###################################if [ -n "$do_rc" ] ; then# mpeg4 rate controlfile=${outfile}mpeg4-rc.avido_ffmpeg $file -y -b 400 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file# mpeg4 rate control decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_mpeg4adv" ] ; then# mpeg4file=${outfile}mpeg4-adv.avido_ffmpeg $file -y -qscale 9 -flags +mv4+part+aic+trell -mbd bits -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file# mpeg4 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_mpeg4thread" ] ; then# mpeg4file=${outfile}mpeg4-thread.avido_ffmpeg $file -y -b 500 -flags +mv4+part+aic+trell -mbd bits -ps 200 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file# mpeg4 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_mpeg4adv" ] ; then# mpeg4file=${outfile}mpeg4-Q.avido_ffmpeg $file -y -qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file# mpeg4 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_mp4psp" ] ; then# mp4 PSP stylefile=${outfile}mpeg4-PSP.mp4do_ffmpeg $file -y -b 768 -s 320x240 -f psp -ar 24000 -ab 32 -i $raw_src $filefi###################################if [ -n "$do_error" ] ; then# damaged mpeg4file=${outfile}error-mpeg4-adv.avido_ffmpeg $file -y -qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file# damaged mpeg4 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_mpeg4nr" ] ; then# noise reductionfile=${outfile}mpeg4-nr.avido_ffmpeg $file -y -qscale 8 -flags +mv4 -mbd rd -nr 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file# mpeg4 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi###################################if [ -n "$do_mpeg1b" ] ; then# mpeg1file=${outfile}mpeg1b.mpgdo_ffmpeg $file -y -qscale 8 -bf 3 -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg1video -f mpeg1video $file# mpeg1 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dstfi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -