3 # automatic regression test for ffmpeg
10 datadir
="./tests/data"
14 logfile
="$datadir/$this.regression"
15 outfile
="$datadir/$4-"
21 tiny_psnr
="tests/tiny_psnr"
22 benchfile
="$datadir/$this.bench"
23 bench
="$datadir/$this.bench.tmp"
24 bench2
="$datadir/$this.bench2.tmp"
26 raw_dst
="$datadir/$this.out.yuv"
27 raw_ref
="$datadir/$2.ref.yuv"
28 pcm_src
="tests/asynth1.sw"
29 pcm_dst
="$datadir/$this.out.wav"
30 pcm_ref
="$datadir/$2.ref.wav"
31 crcfile
="$datadir/$this.crc"
33 if [ X
"`echo | md5sum 2> /dev/null`" != X
]; then
34 do_md5sum
() { md5sum -b $1; }
35 elif [ -x /sbin
/md5
]; then
36 do_md5sum
() { /sbin
/md5
-r $1 |
sed 's# \**\./# *./#'; }
38 do_md5sum
() { echo No
md5sum program found
; }
41 # create the data directory if it does not exist
44 FFMPEG_OPTS
="-y -flags +bitexact -dct fastint -idct simple"
50 echo $ffmpeg $FFMPEG_OPTS $
*
51 $ffmpeg $FFMPEG_OPTS -benchmark $
* > $bench 2> /tmp
/ffmpeg$$
52 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp
/ffmpeg$$ || true
54 do_md5sum
$f >> $logfile
55 if [ $f = $raw_dst ] ; then
56 $tiny_psnr $f $raw_ref >> $logfile
57 elif [ $f = $pcm_dst ] ; then
58 $tiny_psnr $f $pcm_ref 2 >> $logfile
62 expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
63 echo `cat $bench2` $f >> $benchfile
70 echo $ffmpeg $FFMPEG_OPTS $
*
71 $ffmpeg $FFMPEG_OPTS -benchmark $
* > $bench 2> /tmp
/ffmpeg$$
72 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp
/ffmpeg$$ || true
74 if [ $f = $raw_dst ] ; then
75 $tiny_psnr $f $raw_ref >> $logfile
76 elif [ $f = $pcm_dst ] ; then
77 $tiny_psnr $f $pcm_ref 2 >> $logfile
81 expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
82 echo `cat $bench2` $f >> $benchfile
89 echo $ffmpeg $FFMPEG_OPTS $
* -f crc
"$crcfile"
90 $ffmpeg $FFMPEG_OPTS $
* -f crc
"$crcfile" > /tmp
/ffmpeg$$
2>&1
91 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:|ffmpeg version| configuration| built)" /tmp
/ffmpeg$$ || true
93 echo "$f `cat $crcfile`" >> $logfile
101 echo $ffmpeg $FFMPEG_OPTS $
*
102 $ffmpeg $FFMPEG_OPTS -benchmark $
* > $bench 2> /tmp
/ffmpeg$$
103 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp
/ffmpeg$$ || true
105 expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
106 echo `cat $bench2` $f >> $benchfile
111 do_ffmpeg
$raw_dst $1 -i $file -f rawvideo
$2 $raw_dst
118 do_ffmpeg
$file $2 -f image2
-vcodec pgmyuv
-i $raw_src $3 $file
124 do_ffmpeg
$file -ab 128k
-ac 2 -f s16le
-i $pcm_src $3 $file
129 do_ffmpeg
$pcm_dst -i $file -f wav
$pcm_dst
134 file=${outfile}libav.
$1
135 do_ffmpeg
$file -t 1 -qscale 10 -f image2
-vcodec pgmyuv
-i $raw_src -f s16le
-i $pcm_src $2 $file
136 do_ffmpeg_crc
$file -i $file $3
141 file=${outfile}${1}pipe.
$1
142 do_ffmpeg
$file -t 1 -qscale 10 -f image2
-vcodec pgmyuv
-i $raw_src -f image2pipe
$file
143 do_ffmpeg_crc
$file -f image2pipe
-i $file
148 file=${outfile}libav
%02d.
$1
149 $ffmpeg -t 0.5 -y -qscale 10 -f image2
-vcodec pgmyuv
-i $raw_src $2 $3 -flags +bitexact
$file
150 do_md5sum
${outfile}libav02.
$1 >> $logfile
151 do_ffmpeg_crc
$file $3 -i $file
152 wc -c ${outfile}libav02.
$1 >> $logfile
157 file=${outfile}libav.
$1
158 do_ffmpeg
$file -t 1 -qscale 10 -f s16le
-i $pcm_src $file
159 do_ffmpeg_crc
$file -i $file
165 # generate reference for quality check
166 if [ -n "$do_ref" ]; then
167 do_ffmpeg_nocheck
$raw_ref -f image2
-vcodec pgmyuv
-i $raw_src -an -f rawvideo
$raw_ref
168 do_ffmpeg_nocheck
$pcm_ref -ab 128k
-ac 2 -ar 44100 -f s16le
-i $pcm_src -f wav
$pcm_ref
171 if [ -n "$do_mpeg" ] ; then
173 do_video_encoding mpeg1.mpg
"-qscale 10" "-f mpeg1video"
177 if [ -n "$do_mpeg2" ] ; then
179 do_video_encoding mpeg2.mpg
"-qscale 10" "-vcodec mpeg2video -f mpeg1video"
182 # mpeg2 encoding intra vlc qprd
183 do_video_encoding mpeg2ivlc-qprd.mpg
"-vb 500k -bf 2 -flags +trell+qprd+mv0 -flags2 +ivlc -cmp 2 -subcmp 2 -mbd rd" "-vcodec mpeg2video -f mpeg2video"
187 do_video_encoding mpeg2.mpg
"-qscale 10" "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
188 do_video_decoding
"-idct int"
190 # mpeg2 encoding interlaced
191 do_video_encoding mpeg2i.mpg
"-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
195 if [ -n "$do_mpeg2thread" ] ; then
196 # mpeg2 encoding interlaced
197 do_video_encoding mpeg2thread.mpg
"-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
200 # mpeg2 encoding interlaced using intra vlc
201 do_video_encoding mpeg2threadivlc.mpg
"-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
204 # mpeg2 encoding interlaced
205 file=${outfile}mpeg2reuse.mpg
206 do_ffmpeg
$file -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg
-vcodec mpeg2video
-f mpeg1video
-bf 2 -flags +ildct
+ilme
-threads 4 $file
210 if [ -n "$do_msmpeg4v2" ] ; then
211 do_video_encoding msmpeg4v2.avi
"-qscale 10" "-an -vcodec msmpeg4v2"
215 if [ -n "$do_msmpeg4" ] ; then
216 do_video_encoding msmpeg4.avi
"-qscale 10" "-an -vcodec msmpeg4"
220 if [ -n "$do_wmv1" ] ; then
221 do_video_encoding wmv1.avi
"-qscale 10" "-an -vcodec wmv1"
225 if [ -n "$do_wmv2" ] ; then
226 do_video_encoding wmv2.avi
"-qscale 10" "-an -vcodec wmv2"
230 if [ -n "$do_h261" ] ; then
231 do_video_encoding h261.avi
"-qscale 11" "-s 352x288 -an -vcodec h261"
235 if [ -n "$do_h263" ] ; then
236 do_video_encoding h263.avi
"-qscale 10" "-s 352x288 -an -vcodec h263"
240 if [ -n "$do_h263p" ] ; then
241 do_video_encoding h263p.avi
"-qscale 2 -flags +umv+aiv+aic" "-s 352x288 -an -vcodec h263p -ps 300"
245 if [ -n "$do_mpeg4" ] ; then
246 do_video_encoding odivx.mp4
"-flags +mv4 -mbd bits -qscale 10" "-an -vcodec mpeg4"
250 if [ -n "$do_huffyuv" ] ; then
251 do_video_encoding huffyuv.avi
"" "-an -vcodec huffyuv -pix_fmt yuv422p"
252 do_video_decoding
"" "-strict -2 -pix_fmt yuv420p"
255 if [ -n "$do_rc" ] ; then
256 do_video_encoding mpeg4-rc.avi
"-b 400k -bf 2" "-an -vcodec mpeg4"
260 if [ -n "$do_mpeg4adv" ] ; then
261 do_video_encoding mpeg4-adv.avi
"-qscale 9 -flags +mv4+part+aic+trell -mbd bits -ps 200" "-an -vcodec mpeg4"
264 do_video_encoding mpeg4-qprd.avi
"-b 450k -bf 2 -flags +mv4+trell+qprd+mv0 -cmp 2 -subcmp 2 -mbd rd" "-an -vcodec mpeg4"
267 do_video_encoding mpeg4-adap.avi
"-b 550k -bf 2 -flags +mv4+trell+mv0 -cmp 1 -subcmp 2 -mbd rd -scplx_mask 0.3" "-an -vcodec mpeg4"
270 do_video_encoding mpeg4-Q.avi
"-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" "-an -vcodec mpeg4"
274 if [ -n "$do_mpeg4thread" ] ; then
275 do_video_encoding mpeg4-thread.avi
"-b 500k -flags +mv4+part+aic+trell -mbd bits -ps 200 -bf 2" "-an -vcodec mpeg4 -threads 2"
279 if [ -n "$do_error" ] ; then
280 do_video_encoding error-mpeg4-adv.avi
"-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" "-an -vcodec mpeg4"
284 if [ -n "$do_mpeg4nr" ] ; then
285 do_video_encoding mpeg4-nr.avi
"-qscale 8 -flags +mv4 -mbd rd -nr 200" "-an -vcodec mpeg4"
289 if [ -n "$do_mpeg1b" ] ; then
290 do_video_encoding mpeg1b.mpg
"-qscale 8 -bf 3 -ps 200" "-an -vcodec mpeg1video -f mpeg1video"
294 if [ -n "$do_mjpeg" ] ; then
295 do_video_encoding mjpeg.avi
"-qscale 10" "-an -vcodec mjpeg -pix_fmt yuvj420p"
296 do_video_decoding
"" "-pix_fmt yuv420p"
299 if [ -n "$do_ljpeg" ] ; then
300 do_video_encoding ljpeg.avi
"" "-an -vcodec ljpeg -strict -1"
304 if [ -n "$do_jpegls" ] ; then
305 do_video_encoding jpegls.avi
"" "-an -vcodec jpegls -vtag MJPG"
306 do_video_decoding
"" "-pix_fmt yuv420p"
309 if [ -n "$do_rv10" ] ; then
310 do_video_encoding rv10.
rm "-qscale 10" "-an"
314 if [ -n "$do_rv20" ] ; then
315 do_video_encoding rv20.
rm "-qscale 10" "-vcodec rv20 -an"
319 if [ -n "$do_asv1" ] ; then
320 do_video_encoding asv1.avi
"-qscale 10" "-an -vcodec asv1"
324 if [ -n "$do_asv2" ] ; then
325 do_video_encoding asv2.avi
"-qscale 10" "-an -vcodec asv2"
329 if [ -n "$do_flv" ] ; then
330 do_video_encoding flv.flv
"-qscale 10" "-an -vcodec flv"
334 if [ -n "$do_ffv1" ] ; then
335 do_video_encoding ffv1.avi
"-strict -2" "-an -vcodec ffv1"
339 if [ -n "$do_snow" ] ; then
340 do_video_encoding snow.avi
"-strict -2" "-an -vcodec snow -qscale 2 -flags +qpel -me iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64"
341 do_video_decoding
"" "-s 352x288"
344 if [ -n "$do_snowll" ] ; then
345 do_video_encoding snow53.avi
"-strict -2" "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
349 if [ -n "$do_dv" ] ; then
350 do_video_encoding dv.dv
"-dct int" "-s pal -an"
351 do_video_decoding
"" "-s cif"
354 if [ -n "$do_dv50" ] ; then
355 do_video_encoding dv50.dv
"-dct int" "-s pal -pix_fmt yuv422p -an"
356 do_video_decoding
"" "-s cif -pix_fmt yuv420p"
359 if [ -n "$do_svq1" ] ; then
360 do_video_encoding svq1.mov
"" "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
361 do_video_decoding
"" "-pix_fmt yuv420p"
364 if [ -n "$do_flashsv" ] ; then
365 do_video_encoding flashsv.flv
"" "-an -vcodec flashsv "
366 do_video_decoding
"" "-pix_fmt yuv420p"
369 if [ -n "$do_mp2" ] ; then
370 do_audio_encoding mp2.mp2
"-ar 44100"
372 $tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
375 if [ -n "$do_ac3" ] ; then
376 do_audio_encoding ac3.
rm "" -vn
380 if [ -n "$do_g726" ] ; then
381 do_audio_encoding g726.wav
"-ar 44100" "-ab 32k -ac 1 -ar 8000 -acodec g726"
385 if [ -n "$do_adpcm_ima_wav" ] ; then
386 do_audio_encoding adpcm_ima.wav
"-ar 44100" "-acodec adpcm_ima_wav"
390 if [ -n "$do_adpcm_ima_qt" ] ; then
391 do_audio_encoding adpcm_qt.aiff
"-ar 44100" "-acodec adpcm_ima_qt"
395 if [ -n "$do_adpcm_ms" ] ; then
396 do_audio_encoding adpcm_ms.wav
"-ar 44100" "-acodec adpcm_ms"
400 if [ -n "$do_adpcm_yam" ] ; then
401 do_audio_encoding adpcm_yam.wav
"-ar 44100" "-acodec adpcm_yamaha"
405 if [ -n "$do_adpcm_swf" ] ; then
406 do_audio_encoding adpcm_swf.flv
"-ar 44100" "-acodec adpcm_swf"
410 if [ -n "$do_flac" ] ; then
411 do_audio_encoding flac.flac
"-ar 44100" "-acodec flac -compression_level 2"
415 if [ -n "$do_wma" ] ; then
417 do_audio_encoding wmav1.asf
"-ar 44100" "-acodec wmav1"
418 do_ffmpeg_nomd5
$pcm_dst -i $file -f wav
$pcm_dst
419 $tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
421 do_audio_encoding wmav2.asf
"-ar 44100" "-acodec wmav2"
422 do_ffmpeg_nomd5
$pcm_dst -i $file -f wav
$pcm_dst
423 $tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
426 #if [ -n "$do_vorbis" ] ; then
428 #disabled because it is broken
429 #do_audio_encoding vorbis.asf "-ar 44100" "-acodec vorbis"
433 # libavformat testing
435 if [ -n "$do_avi" ] ; then
439 if [ -n "$do_asf" ] ; then
440 do_libav asf
"-acodec mp2" "-r 25"
443 if [ -n "$do_rm" ] ; then
444 file=${outfile}libav.
rm
445 do_ffmpeg
$file -t 1 -qscale 10 -f image2
-vcodec pgmyuv
-i $raw_src -f s16le
-i $pcm_src $file
447 #do_ffmpeg_crc $file -i $file
450 if [ -n "$do_mpg" ] ; then
454 if [ -n "$do_ts" ] ; then
458 if [ -n "$do_swf" ] ; then
462 if [ -n "$do_ffm" ] ; then
466 if [ -n "$do_flv_fmt" ] ; then
470 if [ -n "$do_mov" ] ; then
471 do_libav mov
"-acodec pcm_alaw"
474 if [ -n "$do_dv_fmt" ] ; then
475 do_libav dv
"-ar 48000 -r 25 -s pal -ac 2"
478 if [ -n "$do_gxf" ] ; then
479 do_libav gxf
"-ar 48000 -r 25 -s pal -ac 1"
482 if [ -n "$do_nut" ] ; then
483 do_libav nut
"-acodec mp2"
486 if [ -n "$do_mkv" ] ; then
493 #file=${outfile}libav.mjpeg
494 #do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src $file
495 #do_ffmpeg_crc $file -i $file
497 if [ -n "$do_pbmpipe" ] ; then
498 do_streamed_images pbm
501 if [ -n "$do_pgmpipe" ] ; then
502 do_streamed_images pgm
505 if [ -n "$do_ppmpipe" ] ; then
506 do_streamed_images ppm
509 if [ -n "$do_gif" ] ; then
510 file=${outfile}libav.gif
511 do_ffmpeg
$file -t 1 -qscale 10 -f image2
-vcodec pgmyuv
-i $raw_src -pix_fmt rgb24
$file
512 #do_ffmpeg_crc $file -i $file
515 if [ -n "$do_yuv4mpeg" ] ; then
516 file=${outfile}libav.y4m
517 do_ffmpeg
$file -t 1 -qscale 10 -f image2
-vcodec pgmyuv
-i $raw_src $file
518 #do_ffmpeg_crc $file -i $file
523 if [ -n "$do_pgm" ] ; then
527 if [ -n "$do_ppm" ] ; then
531 if [ -n "$do_bmp" ] ; then
535 if [ -n "$do_tga" ] ; then
539 if [ -n "$do_tiff" ] ; then
540 do_image_formats tiff
"-pix_fmt rgb24"
543 if [ -n "$do_sgi" ] ; then
547 if [ -n "$do_jpg" ] ; then
548 do_image_formats jpg
"-flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p" "-f image2"
553 if [ -n "$do_wav" ] ; then
557 if [ -n "$do_alaw" ] ; then
561 if [ -n "$do_mulaw" ] ; then
565 if [ -n "$do_au" ] ; then
569 if [ -n "$do_mmf" ] ; then
573 if [ -n "$do_aiff" ] ; then
577 if [ -n "$do_voc" ] ; then
581 if [ -n "$do_ogg" ] ; then
585 # pix_fmt conversions
587 if [ -n "$do_pixfmt" ] ; then
588 conversions
="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
589 yuvj422p yuvj444p rgb24 bgr24 rgb32 rgb565 rgb555 gray monow \
590 monob pal8 yuv440p yuvj440p"
591 for pix_fmt
in $conversions ; do
592 file=${outfile}libav-
${pix_fmt}.yuv
593 do_ffmpeg_nocheck
$file -r 1 -t 1 -f image2
-vcodec pgmyuv
-i $raw_src \
594 -f rawvideo
-s 352x288
-pix_fmt $pix_fmt $raw_dst
595 do_ffmpeg
$file -f rawvideo
-s 352x288
-pix_fmt $pix_fmt -i $raw_dst \
596 -f rawvideo
-s 352x288
-pix_fmt yuv444p
$file
600 rm -f "$bench" "$bench2"