Statistics
| Branch: | Revision:

ffmpeg / tests / regression.sh @ d90cc6af

History | View | Annotate | Download (8.3 KB)

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