3 # automatic regression test for ffmpeg
7 # Even in the 21st century some diffs are not supporting -u.
8 diff -u $0 $0 > /dev/null 2>&1
19 logfile="$datadir/ffmpeg.regression"
22 if [ "$1" = "mpeg4" ] ; then
24 elif [ "$1" = "mpeg" ] ; then
26 elif [ "$1" = "ac3" ] ; then
28 elif [ "$1" = "libavtest" ] ; then
30 logfile="$datadir/libav.regression"
54 tiny_psnr="./tiny_psnr"
57 benchfile="$datadir/ffmpeg.bench"
59 raw_dst="$datadir/out.yuv"
60 raw_ref="$datadir/ref.yuv"
62 pcm_dst="$datadir/out.wav"
64 # create the data directory if it does not exists
71 echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $*
72 $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
73 egrep -v "^(Stream|Press|Input|Output|frame| Stream)" /tmp/ffmpeg$$ || true
75 md5sum -b $f >> $logfile
76 if [ $f = $raw_dst ] ; then
77 $tiny_psnr $f $raw_ref >> $logfile
79 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
80 echo `cat $datadir/bench2.tmp` $f >> $benchfile
87 echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc
88 $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1
89 egrep -v "^(Stream|Press|Input|Output|frame| Stream)" /tmp/ffmpeg$$ || true
91 echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile
98 echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $*
99 $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
100 egrep -v "^(Stream|Press|Input|Output|frame| Stream)" /tmp/ffmpeg$$ || true
102 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
103 echo `cat $datadir/bench2.tmp` $f >> $benchfile
106 echo "ffmpeg regression test" > $logfile
107 echo "ffmpeg benchmarks" > $benchfile
109 ###################################
110 # generate reference for quality check
111 do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
113 ###################################
114 if [ -n "$do_mpeg" ] ; then
116 file=${outfile}mpeg1.mpg
117 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file
120 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
123 #do_ffmpeg /tmp/out-mpeg2.yuv -y -f mpegvideo -i a.vob \
124 # -f rawvideo /tmp/out-mpeg2.yuv
127 ###################################
128 if [ -n "$do_msmpeg4v2" ] ; then
130 file=${outfile}msmpeg4v2.avi
131 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file
134 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
137 ###################################
138 if [ -n "$do_msmpeg4" ] ; then
140 file=${outfile}msmpeg4.avi
141 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
144 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
147 ###################################
148 if [ -n "$do_wmv1" ] ; then
150 file=${outfile}wmv1.avi
151 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file
154 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
157 ###################################
158 if [ -n "$do_wmv2" ] ; then
160 file=${outfile}wmv2.avi
161 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv2 $file
164 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
167 ###################################
168 if [ -n "$do_h263" ] ; then
170 file=${outfile}h263.avi
171 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
174 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
177 ###################################
178 if [ -n "$do_h263p" ] ; then
180 file=${outfile}h263p.avi
181 do_ffmpeg $file -y -qscale 2 -umv -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file
184 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
187 ###################################
188 if [ -n "$do_mpeg4" ] ; then
190 file=${outfile}odivx.avi
191 do_ffmpeg $file -y -4mv -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
194 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
197 ###################################
198 if [ -n "$do_huffyuv" ] ; then
200 file=${outfile}huffyuv.avi
201 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec huffyuv -strict -1 $file
204 do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -1 $raw_dst
207 ###################################
208 if [ -n "$do_rc" ] ; then
210 file=${outfile}mpeg4-rc.avi
211 do_ffmpeg $file -y -b 400 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
213 # mpeg4 rate control decoding
214 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
217 ###################################
218 if [ -n "$do_mpeg4adv" ] ; then
220 file=${outfile}mpeg4-adv.avi
221 do_ffmpeg $file -y -qscale 9 -4mv -hq -part -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
224 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
227 ###################################
228 if [ -n "$do_mpeg1b" ] ; then
230 file=${outfile}mpeg1b.mpg
231 do_ffmpeg $file -y -qscale 8 -bf 3 -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg1video $file
234 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
237 ###################################
238 if [ -n "$do_mjpeg" ] ; then
240 file=${outfile}mjpeg.avi
241 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg $file
244 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
247 ###################################
248 if [ -n "$do_rv10" ] ; then
250 file=${outfile}rv10.rm
251 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file
254 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
257 ###################################
258 if [ -n "$do_asv1" ] ; then
260 file=${outfile}asv1.avi
261 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv1 $file
264 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
267 ###################################
268 if [ -n "$do_mp2" ] ; then
270 file=${outfile}mp2.mp2
271 do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
274 do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
277 ###################################
278 if [ -n "$do_ac3" ] ; then
280 file=${outfile}ac3.rm
281 do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file
284 #do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
287 ###################################
289 ###################################
291 if [ -n "$do_libav" ] ; then
294 file=${outfile}libav.avi
295 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
296 do_ffmpeg_crc $file -i $file
299 file=${outfile}libav.asf
300 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
301 do_ffmpeg_crc $file -i $file
304 file=${outfile}libav.rm
305 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
307 #do_ffmpeg_crc $file -i $file
310 file=${outfile}libav.mpg
311 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
312 do_ffmpeg_crc $file -i $file
314 # swf (decode audio only)
315 file=${outfile}libav.swf
316 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
317 do_ffmpeg_crc $file -i $file
320 file=${outfile}libav.ffm
321 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
322 do_ffmpeg_crc $file -i $file
324 # XXX: need mov and mpegts tests (add bitstreams or add output capability in ffmpeg)
329 #file=${outfile}libav.mjpeg
330 #do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
331 #do_ffmpeg_crc $file -i $file
334 file=${outfile}libav.pbm
335 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
336 do_ffmpeg_crc $file -f imagepipe -i $file
339 file=${outfile}libav.pgm
340 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
341 do_ffmpeg_crc $file -f imagepipe -i $file
344 file=${outfile}libav.ppm
345 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
346 do_ffmpeg_crc $file -f imagepipe -i $file
349 file=${outfile}libav.gif
350 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
351 #do_ffmpeg_crc $file -i $file
354 file=${outfile}libav.yuv4mpeg
355 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
356 #do_ffmpeg_crc $file -i $file
360 # pgm (we do not do md5 on image files yet)
361 file=${outfile}libav%d.pgm
362 $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
363 do_ffmpeg_crc $file -i $file
365 # ppm (we do not do md5 on image files yet)
366 file=${outfile}libav%d.ppm
367 $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
368 do_ffmpeg_crc $file -i $file
370 # jpeg (we do not do md5 on image files yet)
371 #file=${outfile}libav%d.jpg
372 #$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
373 #do_ffmpeg_crc $file -i $file
379 file=${outfile}libav.wav
380 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
381 do_ffmpeg_crc $file -i $file
384 file=${outfile}libav.al
385 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
386 do_ffmpeg_crc $file -i $file
389 file=${outfile}libav.ul
390 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
391 do_ffmpeg_crc $file -i $file
394 file=${outfile}libav.au
395 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
396 do_ffmpeg_crc $file -i $file
399 # pix_fmt conversions
400 conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
401 yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
403 for pix_fmt in $conversions ; do
404 file=${outfile}libav-${pix_fmt}.yuv
405 do_ffmpeg_nocheck $file -r 1 -t 1 -y -f pgmyuv -i $raw_src \
406 -f rawvideo -s 352x288 -pix_fmt $pix_fmt $raw_dst
407 do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $raw_dst \
408 -f rawvideo -s 352x288 -pix_fmt yuv444p $file
415 if $diff_cmd $logfile $reffile ; then
417 echo Regression test succeeded.
421 echo Regression test: Error.