]> git.sesse.net Git - ffmpeg/blob - tests/regression.sh
smaller slices for the regression tests, i hope that way we'll catch the next 10l...
[ffmpeg] / tests / regression.sh
1 #!/bin/sh
2 #
3 # automatic regression test for ffmpeg
4 #
5 #
6 #set -x
7 set -e
8
9 datadir="./data"
10
11 logfile="$datadir/ffmpeg.regression"
12
13 # tests to do
14 if [ "$1" = "mpeg4" ] ; then
15     do_mpeg4=y
16 elif [ "$1" = "mpeg" ] ; then
17     do_mpeg=y
18 elif [ "$1" = "ac3" ] ; then
19     do_ac3=y
20 elif [ "$1" = "libavtest" ] ; then
21     do_libav=y
22     logfile="$datadir/libav.regression"
23 else
24     do_mpeg=y
25     do_msmpeg4v2=y
26     do_msmpeg4=y
27     do_wmv1=y
28     do_wmv2=y
29     do_h263=y
30     do_h263p=y
31     do_mpeg4=y
32     do_huffyuv=y
33     do_mjpeg=y
34     do_rv10=y
35     do_mp2=y
36     do_ac3=y
37     do_rc=y
38     do_mpeg4adv=y
39     do_mpeg1b=y
40 fi
41
42
43 # various files
44 ffmpeg="../ffmpeg_g"
45 outfile="$datadir/a-"
46 reffile="$2"
47 benchfile="$datadir/ffmpeg.bench"
48 raw_src="vsynth1/%d.pgm"
49 raw_dst="$datadir/out.yuv"
50 pcm_src="asynth1.sw"
51 pcm_dst="$datadir/out.wav"
52
53 # create the data directory if it does not exists
54 mkdir -p $datadir
55
56 do_ffmpeg()
57 {
58     f="$1"
59     shift
60     echo $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 $*
61     $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp
62     md5sum -b $f >> $logfile
63     expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
64     echo `cat $datadir/bench2.tmp` $f >> $benchfile
65 }
66
67 do_ffmpeg_crc()
68 {
69     f="$1"
70     shift
71     echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc
72     $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc
73     echo -n "$f " >> $logfile
74     cat $datadir/ffmpeg.crc >> $logfile
75 }
76
77 echo "ffmpeg regression test" > $logfile
78 echo "ffmpeg benchmarks" > $benchfile
79
80 ###################################
81 if [ -n "$do_mpeg" ] ; then
82 # mpeg1 encoding
83 file=${outfile}mpeg1.mpg
84 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file 
85
86 # mpeg1 decoding
87 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
88
89 # mpeg2 decoding
90 #do_ffmpeg /tmp/out-mpeg2.yuv -y -f mpegvideo -i a.vob \
91 #          -f rawvideo /tmp/out-mpeg2.yuv
92 fi
93
94 ###################################
95 if [ -n "$do_msmpeg4v2" ] ; then
96 # msmpeg4 encoding
97 file=${outfile}msmpeg4v2.avi
98 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file
99
100 # msmpeg4v2 decoding
101 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
102 fi
103
104 ###################################
105 if [ -n "$do_msmpeg4" ] ; then
106 # msmpeg4 encoding
107 file=${outfile}msmpeg4.avi
108 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
109
110 # msmpeg4 decoding
111 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
112 fi
113
114 ###################################
115 if [ -n "$do_wmv1" ] ; then
116 # wmv1 encoding
117 file=${outfile}wmv1.avi
118 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file
119
120 # wmv1 decoding
121 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
122 fi
123
124 ###################################
125 if [ -n "$do_wmv2" ] ; then
126 # wmv2 encoding
127 file=${outfile}wmv2.avi
128 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv2 $file
129
130 # wmv2 decoding
131 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
132 fi
133
134 ###################################
135 if [ -n "$do_h263" ] ; then
136 # h263 encoding
137 file=${outfile}h263.avi
138 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
139
140 # h263 decoding
141 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
142 fi
143
144 ###################################
145 if [ -n "$do_h263p" ] ; then
146 # h263p encoding
147 file=${outfile}h263p.avi
148 do_ffmpeg $file -y -qscale 10 -umv -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file
149
150 # h263p decoding
151 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
152 fi
153
154 ###################################
155 if [ -n "$do_mpeg4" ] ; then
156 # mpeg4
157 file=${outfile}odivx.avi
158 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
159
160 # mpeg4 decoding
161 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
162 fi
163
164 ###################################
165 if [ -n "$do_huffyuv" ] ; then
166 # huffyuv
167 file=${outfile}huffyuv.avi
168 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec huffyuv -strict -1 $file
169
170 # huffyuv decoding
171 do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -1 $raw_dst
172 fi
173
174 ###################################
175 if [ -n "$do_rc" ] ; then
176 # mpeg4 rate control
177 file=${outfile}mpeg4-rc.avi
178 do_ffmpeg $file -y -b 400 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
179
180 # mpeg4 rate control decoding
181 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
182 fi
183
184 ###################################
185 if [ -n "$do_mpeg4adv" ] ; then
186 # mpeg4
187 file=${outfile}mpeg4-adv.avi
188 do_ffmpeg $file -y -qscale 9 -4mv -hq -part -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
189
190 # mpeg4 decoding
191 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
192 fi
193
194 ###################################
195 if [ -n "$do_mpeg1b" ] ; then
196 # mpeg1
197 file=${outfile}mpeg1b.mpg
198 do_ffmpeg $file -y -qscale 8 -bf 3 -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg1video $file
199
200 # mpeg1 decoding
201 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
202 fi
203
204 ###################################
205 if [ -n "$do_mjpeg" ] ; then
206 # mjpeg
207 file=${outfile}mjpeg.avi
208 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg $file
209
210 # mjpeg decoding
211 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
212 fi
213
214 ###################################
215 if [ -n "$do_rv10" ] ; then
216 # rv10 encoding
217 file=${outfile}rv10.rm
218 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file 
219
220 # rv10 decoding
221 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
222 fi
223
224 ###################################
225 if [ -n "$do_mp2" ] ; then
226 # mp2 encoding
227 file=${outfile}mp2.mp2
228 do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file 
229
230 # mp2 decoding
231 do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst 
232 fi
233
234 ###################################
235 if [ -n "$do_ac3" ] ; then
236 # ac3 encoding
237 file=${outfile}ac3.rm
238 do_ffmpeg $file -y -ab 128 -ac 2 -f s16le  -i $pcm_src -vn $file 
239
240 # ac3 decoding
241 #do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst 
242 fi
243
244 ###################################
245 # libav testing
246 ###################################
247
248 if [ -n "$do_libav" ] ; then
249
250 # avi
251 file=${outfile}libav.avi
252 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
253 do_ffmpeg_crc $file -i $file
254
255 # asf
256 file=${outfile}libav.asf
257 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
258 do_ffmpeg_crc $file -i $file
259
260 # rm
261 file=${outfile}libav.rm
262 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
263 # broken
264 #do_ffmpeg_crc $file -i $file
265
266 # mpegps
267 file=${outfile}libav.mpg
268 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
269 do_ffmpeg_crc $file -i $file
270
271 # swf (decode audio only)
272 file=${outfile}libav.swf
273 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
274 do_ffmpeg_crc $file -i $file
275
276 # ffm
277 file=${outfile}libav.ffm
278 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
279 do_ffmpeg_crc $file -i $file
280
281 # XXX: need mov and mpegts tests (add bitstreams or add output capability in ffmpeg)
282
283 ####################
284 # streamed images
285 # mjpeg
286 file=${outfile}libav.mjpeg
287 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
288 do_ffmpeg_crc $file -i $file
289
290 # pbmpipe
291 file=${outfile}libav.pbm
292 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
293 do_ffmpeg_crc $file -f imagepipe -i $file
294
295 # pgmpipe
296 file=${outfile}libav.pgm
297 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
298 do_ffmpeg_crc $file -f imagepipe -i $file
299
300 # ppmpipe
301 file=${outfile}libav.ppm
302 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
303 do_ffmpeg_crc $file -f imagepipe -i $file
304
305 # gif
306 file=${outfile}libav.gif
307 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
308 #do_ffmpeg_crc $file -i $file
309
310 # yuv4mpeg
311 file=${outfile}libav.yuv4mpeg
312 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
313 #do_ffmpeg_crc $file -i $file
314
315 ####################
316 # image formats
317 # pgm (we do not do md5 on image files yet)
318 file=${outfile}libav%d.pgm
319 $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
320 do_ffmpeg_crc $file -i $file
321
322 # ppm (we do not do md5 on image files yet)
323 file=${outfile}libav%d.ppm
324 $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
325 do_ffmpeg_crc $file -i $file
326
327 # jpeg (we do not do md5 on image files yet)
328 file=${outfile}libav%d.jpg
329 $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
330 do_ffmpeg_crc $file -i $file
331
332 ####################
333 # audio only
334
335 # wav
336 file=${outfile}libav.wav
337 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
338 do_ffmpeg_crc $file -i $file
339
340 # alaw
341 file=${outfile}libav.al
342 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
343 do_ffmpeg_crc $file -i $file
344
345 # mulaw
346 file=${outfile}libav.ul
347 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
348 do_ffmpeg_crc $file -i $file
349
350 # au
351 file=${outfile}libav.au
352 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
353 do_ffmpeg_crc $file -i $file
354
355 fi
356
357
358
359 if diff -u $logfile $reffile ; then
360     echo 
361     echo Regression test succeeded.
362     exit 0
363 else
364     echo 
365     echo Regression test: Error.
366     exit 1
367 fi