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