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"
23 if [ "$1" = "mpeg4" ] ; then
25 elif [ "$1" = "mpeg" ] ; then
27 elif [ "$1" = "ac3" ] ; then
29 elif [ "$1" = "libavtest" ] ; then
31 logfile
="$datadir/libav.regression"
62 tiny_psnr
="./tiny_psnr"
64 benchfile
="$datadir/ffmpeg.bench"
66 raw_dst
="$datadir/out.yuv"
67 raw_ref
="$datadir/ref.yuv"
69 pcm_dst
="$datadir/out.wav"
71 # create the data directory if it does not exists
78 echo $ffmpeg -y
-bitexact
-dct_algo
1 -idct_algo
2 $
*
79 $ffmpeg -y
-bitexact
-dct_algo
1 -idct_algo
2 -benchmark $
* > $datadir/bench.tmp
2> /tmp
/ffmpeg$$
80 egrep -v
"^(Stream|Press|Input|Output|frame| Stream| Duration)" /tmp
/ffmpeg$$ || true
82 md5sum -b
$f >> $logfile
83 if [ $f = $raw_dst ] ; then
84 $tiny_psnr $f $raw_ref >> $logfile
86 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
87 echo `cat $datadir/bench2.tmp` $f >> $benchfile
94 echo $ffmpeg -y
-bitexact
-dct_algo
1 -idct_algo
2 $
* -f crc
$datadir/ffmpeg.crc
95 $ffmpeg -y
-bitexact
-dct_algo
1 -idct_algo
2 $
* -f crc
$datadir/ffmpeg.crc
> /tmp
/ffmpeg$$
2>&1
96 egrep -v
"^(Stream|Press|Input|Output|frame| Stream| Duration)" /tmp
/ffmpeg$$ || true
98 echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile
105 echo $ffmpeg -y
-bitexact
-dct_algo
1 -idct_algo
2 $
*
106 $ffmpeg -y
-bitexact
-dct_algo
1 -idct_algo
2 -benchmark $
* > $datadir/bench.tmp
2> /tmp
/ffmpeg$$
107 egrep -v
"^(Stream|Press|Input|Output|frame| Stream| Duration)" /tmp
/ffmpeg$$ || true
109 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
110 echo `cat $datadir/bench2.tmp` $f >> $benchfile
113 echo "ffmpeg regression test" > $logfile
114 echo "ffmpeg benchmarks" > $benchfile
116 ###################################
117 # generate reference for quality check
118 do_ffmpeg_nocheck
$raw_ref -y
-f pgmyuv
-i
$raw_src -an
-f rawvideo
$raw_ref
120 ###################################
121 if [ -n
"$do_mpeg" ] ; then
123 file=${outfile}mpeg1.mpg
124 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -f mpeg1video
$file
127 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
130 ###################################
131 if [ -n
"$do_mpeg2" ] ; then
133 file=${outfile}mpeg2.mpg
134 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -vcodec mpeg2video
-f mpeg1video
$file
137 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
139 # mpeg2 encoding interlaced
140 file=${outfile}mpeg2i.mpg
141 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -vcodec mpeg2video
-f mpeg1video
-ildct
$file
144 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
147 ###################################
148 if [ -n
"$do_msmpeg4v2" ] ; then
150 file=${outfile}msmpeg4v2.avi
151 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -an
-vcodec msmpeg4v2
$file
154 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
157 ###################################
158 if [ -n
"$do_msmpeg4" ] ; then
160 file=${outfile}msmpeg4.avi
161 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -an
-vcodec msmpeg4
$file
164 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
167 ###################################
168 if [ -n
"$do_wmv1" ] ; then
170 file=${outfile}wmv1.avi
171 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -an
-vcodec wmv1
$file
174 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
177 ###################################
178 if [ -n
"$do_wmv2" ] ; then
180 file=${outfile}wmv2.avi
181 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -an
-vcodec wmv2
$file
184 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
187 ###################################
188 if [ -n
"$do_h263" ] ; then
190 file=${outfile}h263.avi
191 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -s
352x288
-an
-vcodec h263
$file
194 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
197 ###################################
198 if [ -n
"$do_h263p" ] ; then
200 file=${outfile}h263p.avi
201 do_ffmpeg
$file -y
-qscale
2 -umv
-aiv
-aic
-f pgmyuv
-i
$raw_src -s
352x288
-an
-vcodec h263p
-ps
300 $file
204 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
207 ###################################
208 if [ -n
"$do_mpeg4" ] ; then
210 file=${outfile}odivx.mp4
211 do_ffmpeg
$file -y
-4mv -hq
-qscale
10 -f pgmyuv
-i
$raw_src -an
-vcodec mpeg4
$file
214 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
217 ###################################
218 if [ -n
"$do_huffyuv" ] ; then
220 file=${outfile}huffyuv.avi
221 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -an
-vcodec huffyuv
-strict
-1 $file
224 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
-strict
-1 $raw_dst
227 ###################################
228 if [ -n
"$do_rc" ] ; then
230 file=${outfile}mpeg4-rc.avi
231 do_ffmpeg
$file -y
-b
400 -bf
2 -f pgmyuv
-i
$raw_src -an
-vcodec mpeg4
$file
233 # mpeg4 rate control decoding
234 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
237 ###################################
238 if [ -n
"$do_mpeg4adv" ] ; then
240 file=${outfile}mpeg4-adv.avi
241 do_ffmpeg
$file -y
-qscale
9 -4mv -hq
-part
-ps
200 -aic
-f pgmyuv
-i
$raw_src -an
-vcodec mpeg4
$file
244 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
247 ###################################
248 if [ -n
"$do_error" ] ; then
250 file=${outfile}error-mpeg4-adv.avi
251 do_ffmpeg
$file -y
-qscale
7 -4mv -mbd
2 -part
-ps
250 -error
10 -aic
-f pgmyuv
-i
$raw_src -an
-vcodec mpeg4
$file
253 # damaged mpeg4 decoding
254 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
257 ###################################
258 if [ -n
"$do_mpeg1b" ] ; then
260 file=${outfile}mpeg1b.mpg
261 do_ffmpeg
$file -y
-qscale
8 -bf
3 -ps
200 -f pgmyuv
-i
$raw_src -an
-vcodec mpeg1video
-f mpeg1video
$file
264 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
267 ###################################
268 if [ -n
"$do_mjpeg" ] ; then
270 file=${outfile}mjpeg.avi
271 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -an
-vcodec mjpeg
$file
274 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
277 ###################################
278 if [ -n
"$do_ljpeg" ] ; then
280 file=${outfile}ljpeg.avi
281 do_ffmpeg
$file -y
-f pgmyuv
-i
$raw_src -an
-vcodec ljpeg
$file
284 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
287 ###################################
288 if [ -n
"$do_rv10" ] ; then
290 file=${outfile}rv10.
rm
291 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -an
$file
294 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
297 ###################################
298 if [ -n
"$do_asv1" ] ; then
300 file=${outfile}asv1.avi
301 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -an
-vcodec asv1
$file
304 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
307 ###################################
308 if [ -n
"$do_asv2" ] ; then
310 file=${outfile}asv2.avi
311 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -an
-vcodec asv2
$file
314 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
317 ###################################
318 if [ -n
"$do_flv" ] ; then
320 file=${outfile}flv.flv
321 do_ffmpeg
$file -y
-qscale
10 -f pgmyuv
-i
$raw_src -an
-vcodec flv
$file
324 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
327 ###################################
328 if [ -n
"$do_ffv1" ] ; then
330 file=${outfile}ffv1.avi
331 do_ffmpeg
$file -y
-strict
-1 -f pgmyuv
-i
$raw_src -an
-vcodec ffv1
$file
334 do_ffmpeg
$raw_dst -y
-i
$file -f rawvideo
$raw_dst
337 ###################################
338 if [ -n
"$do_mp2" ] ; then
340 file=${outfile}mp2.mp2
341 do_ffmpeg
$file -y
-ab
128 -ac
2 -ar 44100 -f s16le
-i
$pcm_src $file
344 do_ffmpeg
$pcm_dst -y
-i
$file -f wav
$pcm_dst
347 ###################################
348 if [ -n
"$do_ac3" ] ; then
350 file=${outfile}ac3.
rm
351 do_ffmpeg
$file -y
-ab
128 -ac
2 -f s16le
-i
$pcm_src -vn
$file
354 #do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
357 ###################################
359 ###################################
361 if [ -n
"$do_libav" ] ; then
364 file=${outfile}libav.avi
365 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src -f s16le
-i
$pcm_src $file
366 do_ffmpeg_crc
$file -i
$file
369 file=${outfile}libav.asf
370 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src -f s16le
-i
$pcm_src $file
371 do_ffmpeg_crc
$file -i
$file
374 file=${outfile}libav.
rm
375 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src -f s16le
-i
$pcm_src $file
377 #do_ffmpeg_crc $file -i $file
380 file=${outfile}libav.mpg
381 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src -f s16le
-i
$pcm_src $file
382 do_ffmpeg_crc
$file -i
$file
384 # swf (decode audio only)
385 file=${outfile}libav.swf
386 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src -f s16le
-i
$pcm_src $file
387 do_ffmpeg_crc
$file -i
$file
390 file=${outfile}libav.ffm
391 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src -f s16le
-i
$pcm_src $file
392 do_ffmpeg_crc
$file -i
$file
395 file=${outfile}libav.flv
396 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src -f s16le
-i
$pcm_src $file
397 do_ffmpeg_crc
$file -i
$file
400 #file=${outfile}libav.mov
401 #do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
402 #do_ffmpeg_crc $file -i $file
405 file=${outfile}libav.nut
406 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src -f s16le
-i
$pcm_src $file
407 do_ffmpeg_crc
$file -i
$file
409 # XXX: need mpegts tests (add bitstreams or add output capability in ffmpeg)
414 #file=${outfile}libav.mjpeg
415 #do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
416 #do_ffmpeg_crc $file -i $file
419 file=${outfile}libav.pbm
420 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src -f imagepipe
$file
421 do_ffmpeg_crc
$file -f imagepipe
-i
$file
424 file=${outfile}libav.pgm
425 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src -f imagepipe
$file
426 do_ffmpeg_crc
$file -f imagepipe
-i
$file
429 file=${outfile}libav.ppm
430 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src -f imagepipe
$file
431 do_ffmpeg_crc
$file -f imagepipe
-i
$file
434 file=${outfile}libav.gif
435 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src $file
436 #do_ffmpeg_crc $file -i $file
439 file=${outfile}libav.yuv4mpeg
440 do_ffmpeg
$file -t
1 -y
-qscale
10 -f pgmyuv
-i
$raw_src $file
441 #do_ffmpeg_crc $file -i $file
445 # pgm (we do not do md5 on image files yet)
446 file=${outfile}libav
%d.pgm
447 $ffmpeg -t
0.5 -y
-qscale
10 -f pgmyuv
-i
$raw_src $file
448 do_ffmpeg_crc
$file -i
$file
450 # ppm (we do not do md5 on image files yet)
451 file=${outfile}libav
%d.ppm
452 $ffmpeg -t
0.5 -y
-qscale
10 -f pgmyuv
-i
$raw_src $file
453 do_ffmpeg_crc
$file -i
$file
455 # jpeg (we do not do md5 on image files yet)
456 #file=${outfile}libav%d.jpg
457 #$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
458 #do_ffmpeg_crc $file -i $file
464 file=${outfile}libav.wav
465 do_ffmpeg
$file -t
1 -y
-qscale
10 -f s16le
-i
$pcm_src $file
466 do_ffmpeg_crc
$file -i
$file
469 file=${outfile}libav.al
470 do_ffmpeg
$file -t
1 -y
-qscale
10 -f s16le
-i
$pcm_src $file
471 do_ffmpeg_crc
$file -i
$file
474 file=${outfile}libav.ul
475 do_ffmpeg
$file -t
1 -y
-qscale
10 -f s16le
-i
$pcm_src $file
476 do_ffmpeg_crc
$file -i
$file
479 file=${outfile}libav.au
480 do_ffmpeg
$file -t
1 -y
-qscale
10 -f s16le
-i
$pcm_src $file
481 do_ffmpeg_crc
$file -i
$file
484 # pix_fmt conversions
485 conversions
="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
486 yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
488 for pix_fmt
in $conversions ; do
489 file=${outfile}libav-
${pix_fmt}.yuv
490 do_ffmpeg_nocheck
$file -r
1 -t
1 -y
-f pgmyuv
-i
$raw_src \
491 -f rawvideo
-s
352x288
-pix_fmt
$pix_fmt $raw_dst
492 do_ffmpeg
$file -f rawvideo
-s
352x288
-pix_fmt
$pix_fmt -i
$raw_dst \
493 -f rawvideo
-s
352x288
-pix_fmt yuv444p
$file
500 if $diff_cmd $logfile $reffile ; then
502 echo Regression
test succeeded.
506 echo Regression
test: Error.