Statistics
| Branch: | Revision:

ffmpeg / tests / regression.sh @ 6afd3b92

History | View | Annotate | Download (9.43 KB)

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
tiny_psnr="./tiny_psnr"
46
outfile="$datadir/a-"
47
reffile="$2"
48
benchfile="$datadir/ffmpeg.bench"
49
raw_src="$3/%d.pgm"
50
raw_dst="$datadir/out.yuv"
51
raw_ref="$datadir/ref.yuv"
52
pcm_src="asynth1.sw"
53
pcm_dst="$datadir/out.wav"
54

    
55
# create the data directory if it does not exists
56
mkdir -p $datadir
57

    
58
do_ffmpeg()
59
{
60
    f="$1"
61
    shift
62
    echo $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 $*
63
    $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp
64
    md5sum -b $f >> $logfile
65
    if [ $f = $raw_dst ] ; then
66
        $tiny_psnr $f $raw_ref >> $logfile
67
    fi
68
    expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
69
    echo `cat $datadir/bench2.tmp` $f >> $benchfile
70
}
71

    
72
do_ffmpeg_crc()
73
{
74
    f="$1"
75
    shift
76
    echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc
77
    $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc
78
    echo -n "$f " >> $logfile
79
    cat $datadir/ffmpeg.crc >> $logfile
80
}
81

    
82
do_ffmpeg_nocheck()
83
{
84
    f="$1"
85
    shift
86
    echo $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 $*
87
    $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp
88
    expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
89
    echo `cat $datadir/bench2.tmp` $f >> $benchfile
90
}
91

    
92
echo "ffmpeg regression test" > $logfile
93
echo "ffmpeg benchmarks" > $benchfile
94

    
95
###################################
96
# generate reference for quality check
97
do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
98

    
99
###################################
100
if [ -n "$do_mpeg" ] ; then
101
# mpeg1 encoding
102
file=${outfile}mpeg1.mpg
103
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file 
104

    
105
# mpeg1 decoding
106
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
107

    
108
# mpeg2 decoding
109
#do_ffmpeg /tmp/out-mpeg2.yuv -y -f mpegvideo -i a.vob \
110
#          -f rawvideo /tmp/out-mpeg2.yuv
111
fi
112

    
113
###################################
114
if [ -n "$do_msmpeg4v2" ] ; then
115
# msmpeg4 encoding
116
file=${outfile}msmpeg4v2.avi
117
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file
118

    
119
# msmpeg4v2 decoding
120
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
121
fi
122

    
123
###################################
124
if [ -n "$do_msmpeg4" ] ; then
125
# msmpeg4 encoding
126
file=${outfile}msmpeg4.avi
127
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
128

    
129
# msmpeg4 decoding
130
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
131
fi
132

    
133
###################################
134
if [ -n "$do_wmv1" ] ; then
135
# wmv1 encoding
136
file=${outfile}wmv1.avi
137
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file
138

    
139
# wmv1 decoding
140
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
141
fi
142

    
143
###################################
144
if [ -n "$do_wmv2" ] ; then
145
# wmv2 encoding
146
file=${outfile}wmv2.avi
147
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv2 $file
148

    
149
# wmv2 decoding
150
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
151
fi
152

    
153
###################################
154
if [ -n "$do_h263" ] ; then
155
# h263 encoding
156
file=${outfile}h263.avi
157
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
158

    
159
# h263 decoding
160
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
161
fi
162

    
163
###################################
164
if [ -n "$do_h263p" ] ; then
165
# h263p encoding
166
file=${outfile}h263p.avi
167
do_ffmpeg $file -y -qscale 2 -umv -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file
168

    
169
# h263p decoding
170
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
171
fi
172

    
173
###################################
174
if [ -n "$do_mpeg4" ] ; then
175
# mpeg4
176
file=${outfile}odivx.avi
177
do_ffmpeg $file -y -4mv -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
178

    
179
# mpeg4 decoding
180
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
181
fi
182

    
183
###################################
184
if [ -n "$do_huffyuv" ] ; then
185
# huffyuv
186
file=${outfile}huffyuv.avi
187
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec huffyuv -strict -1 $file
188

    
189
# huffyuv decoding
190
do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -1 $raw_dst
191
fi
192

    
193
###################################
194
if [ -n "$do_rc" ] ; then
195
# mpeg4 rate control
196
file=${outfile}mpeg4-rc.avi
197
do_ffmpeg $file -y -b 400 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
198

    
199
# mpeg4 rate control decoding
200
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
201
fi
202

    
203
###################################
204
if [ -n "$do_mpeg4adv" ] ; then
205
# mpeg4
206
file=${outfile}mpeg4-adv.avi
207
do_ffmpeg $file -y -qscale 9 -4mv -hq -part -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
208

    
209
# mpeg4 decoding
210
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
211
fi
212

    
213
###################################
214
if [ -n "$do_mpeg1b" ] ; then
215
# mpeg1
216
file=${outfile}mpeg1b.mpg
217
do_ffmpeg $file -y -qscale 8 -bf 3 -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg1video $file
218

    
219
# mpeg1 decoding
220
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
221
fi
222

    
223
###################################
224
if [ -n "$do_mjpeg" ] ; then
225
# mjpeg
226
file=${outfile}mjpeg.avi
227
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg $file
228

    
229
# mjpeg decoding
230
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
231
fi
232

    
233
###################################
234
if [ -n "$do_rv10" ] ; then
235
# rv10 encoding
236
file=${outfile}rv10.rm
237
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file 
238

    
239
# rv10 decoding
240
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
241
fi
242

    
243
###################################
244
if [ -n "$do_mp2" ] ; then
245
# mp2 encoding
246
file=${outfile}mp2.mp2
247
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file 
248

    
249
# mp2 decoding
250
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst 
251
fi
252

    
253
###################################
254
if [ -n "$do_ac3" ] ; then
255
# ac3 encoding
256
file=${outfile}ac3.rm
257
do_ffmpeg $file -y -ab 128 -ac 2 -f s16le  -i $pcm_src -vn $file 
258

    
259
# ac3 decoding
260
#do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst 
261
fi
262

    
263
###################################
264
# libav testing
265
###################################
266

    
267
if [ -n "$do_libav" ] ; then
268

    
269
# avi
270
file=${outfile}libav.avi
271
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
272
do_ffmpeg_crc $file -i $file
273

    
274
# asf
275
file=${outfile}libav.asf
276
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
277
do_ffmpeg_crc $file -i $file
278

    
279
# rm
280
file=${outfile}libav.rm
281
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
282
# broken
283
#do_ffmpeg_crc $file -i $file
284

    
285
# mpegps
286
file=${outfile}libav.mpg
287
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
288
do_ffmpeg_crc $file -i $file
289

    
290
# swf (decode audio only)
291
file=${outfile}libav.swf
292
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
293
do_ffmpeg_crc $file -i $file
294

    
295
# ffm
296
file=${outfile}libav.ffm
297
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
298
do_ffmpeg_crc $file -i $file
299

    
300
# XXX: need mov and mpegts tests (add bitstreams or add output capability in ffmpeg)
301

    
302
####################
303
# streamed images
304
# mjpeg
305
file=${outfile}libav.mjpeg
306
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
307
do_ffmpeg_crc $file -i $file
308

    
309
# pbmpipe
310
file=${outfile}libav.pbm
311
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
312
do_ffmpeg_crc $file -f imagepipe -i $file
313

    
314
# pgmpipe
315
file=${outfile}libav.pgm
316
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
317
do_ffmpeg_crc $file -f imagepipe -i $file
318

    
319
# ppmpipe
320
file=${outfile}libav.ppm
321
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
322
do_ffmpeg_crc $file -f imagepipe -i $file
323

    
324
# gif
325
file=${outfile}libav.gif
326
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
327
#do_ffmpeg_crc $file -i $file
328

    
329
# yuv4mpeg
330
file=${outfile}libav.yuv4mpeg
331
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
332
#do_ffmpeg_crc $file -i $file
333

    
334
####################
335
# image formats
336
# pgm (we do not do md5 on image files yet)
337
file=${outfile}libav%d.pgm
338
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
339
do_ffmpeg_crc $file -i $file
340

    
341
# ppm (we do not do md5 on image files yet)
342
file=${outfile}libav%d.ppm
343
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
344
do_ffmpeg_crc $file -i $file
345

    
346
# jpeg (we do not do md5 on image files yet)
347
file=${outfile}libav%d.jpg
348
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
349
do_ffmpeg_crc $file -i $file
350

    
351
####################
352
# audio only
353

    
354
# wav
355
file=${outfile}libav.wav
356
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
357
do_ffmpeg_crc $file -i $file
358

    
359
# alaw
360
file=${outfile}libav.al
361
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
362
do_ffmpeg_crc $file -i $file
363

    
364
# mulaw
365
file=${outfile}libav.ul
366
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
367
do_ffmpeg_crc $file -i $file
368

    
369
# au
370
file=${outfile}libav.au
371
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
372
do_ffmpeg_crc $file -i $file
373

    
374
fi
375

    
376

    
377

    
378
if diff -u $logfile $reffile ; then
379
    echo 
380
    echo Regression test succeeded.
381
    exit 0
382
else
383
    echo 
384
    echo Regression test: Error.
385
    exit 1
386
fi