📄 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" = "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_h263=y do_h263p=y do_mpeg4=y do_huffyuv=y do_mjpeg=y do_ljpeg=y do_rv10=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=yfi# various filesffmpeg="../ffmpeg_g"tiny_psnr="./tiny_psnr"reffile="$2"benchfile="$datadir/ffmpeg.bench"raw_src="$3/%d.pgm"raw_dst="$datadir/out.yuv"raw_ref="$datadir/ref.yuv"pcm_src="asynth1.sw"pcm_dst="$datadir/out.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 -bitexact -dct_algo 1 -idct_algo 2 $* $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration)" /tmp/ffmpeg$$ || true rm -f /tmp/ffmpeg$$ do_md5sum $f >> $logfile if [ $f = $raw_dst ] ; then $tiny_psnr $f $raw_ref >> $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 -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration)" /tmp/ffmpeg$$ || true rm -f /tmp/ffmpeg$$ echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile}do_ffmpeg_nocheck(){ f="$1" shift echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration)" /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_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_algo 1 -dct_algo 2 -f mpeg1video $file # mpeg2 decodingdo_ffmpeg $raw_dst -y -idct_algo 1 -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 -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 -ildct -ilme -threads 2 $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_dst fi###################################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_dst fi###################################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_dst fi###################################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_dst fi###################################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_dst fi###################################if [ -n "$do_h263p" ] ; then# h263p encodingfile=${outfile}h263p.avido_ffmpeg $file -y -qscale 2 -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_dst fi###################################if [ -n "$do_mpeg4" ] ; then# mpeg4file=${outfile}odivx.mp4do_ffmpeg $file -y -4mv -hq -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file# mpeg4 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst fi###################################if [ -n "$do_huffyuv" ] ; then# huffyuvfile=${outfile}huffyuv.avido_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec huffyuv -strict -1 $file# huffyuv decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -1 $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_dst fi###################################if [ -n "$do_mpeg4adv" ] ; then# mpeg4file=${outfile}mpeg4-adv.avido_ffmpeg $file -y -qscale 9 -4mv -hq -part -ps 200 -aic -trell -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file# mpeg4 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst fi###################################if [ -n "$do_mpeg4thread" ] ; then# mpeg4file=${outfile}mpeg4-thread.avido_ffmpeg $file -y -b 500 -4mv -hq -part -ps 200 -aic -trell -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file# mpeg4 decodingdo_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst fi###################################if [ -n "$do_error" ] ; then# damaged mpeg4file=${outfile}error-mpeg4-adv.avido_ffmpeg $file -y -qscale 7 -4mv -mbd 2 -part -ps 250 -error 10 -aic -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -