Statistics
| Branch: | Revision:

ffmpeg / tests / regression.sh @ d90cc6af

History | View | Annotate | Download (8.3 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_h263=y
29
    do_h263p=y
30
    do_mpeg4=y
31
#    do_huffyuv=y
32
    do_mjpeg=y
33
    do_rv10=y
34
    do_mp2=y
35
    do_ac3=y
36
    do_rc=y
37
    do_mpeg4adv=y
38
fi
39

    
40

    
41
# various files
42
ffmpeg="../ffmpeg_g"
43
outfile="$datadir/a-"
44
reffile="$2"
45
benchfile="$datadir/ffmpeg.bench"
46
raw_src="vsynth1/%d.pgm"
47
raw_dst="$datadir/out.yuv"
48
pcm_src="asynth1.sw"
49
pcm_dst="$datadir/out.wav"
50

    
51
# create the data directory if it does not exists
52
mkdir -p $datadir
53

    
54
do_ffmpeg()
55
{
56
    f="$1"
57
    shift
58
    echo $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 $*
59
    $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp
60
    md5sum -b $f >> $logfile
61
    expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
62
    echo `cat $datadir/bench2.tmp` $f >> $benchfile
63
}
64

    
65
do_ffmpeg_crc()
66
{
67
    f="$1"
68
    shift
69
    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
    echo -n "$f " >> $logfile
72
    cat $datadir/ffmpeg.crc >> $logfile
73
}
74

    
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
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file 
83

    
84
# mpeg1 decoding
85
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
86

    
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
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
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
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
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
# 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
# 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
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
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
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
###################################
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
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

    
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
do_ffmpeg_crc $file -i $file
258

    
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
do_ffmpeg_crc $file -i $file
267

    
268
# 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
# pgmpipe
274
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

    
278
# ppmpipe
279
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

    
283
# gif
284
file=${outfile}libav.gif
285
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

    
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
# 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
####################
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

    
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