Statistics
| Branch: | Revision:

ffmpeg / tests / regression.sh @ d0c30ca5

History | View | Annotate | Download (6.1 KB)

1
#!/bin/sh
2
#
3
# automatic regression test for ffmpeg
4
#
5
#
6
#set -x
7
set -e
8

    
9
logfile="/tmp/ffmpeg.regression"
10

    
11
# tests to do
12
if [ "$1" = "mpeg4" ] ; then
13
    do_mpeg4=y
14
elif [ "$1" = "mpeg" ] ; then
15
    do_mpeg=y
16
elif [ "$1" = "libavtest" ] ; then
17
    do_libav=y
18
    logfile="/tmp/libav.regression"
19
else
20
    do_mpeg=y
21
    do_msmpeg4=y
22
    do_h263=y
23
    do_mpeg4=y
24
    do_mjpeg=y
25
    #do_rv10=y #broken
26
    do_mp2=y
27
    do_ac3=y
28
fi
29

    
30

    
31
# various files
32
ffmpeg="../ffmpeg"
33
outfile="/tmp/a-"
34
reffile="$2"
35
benchfile="/tmp/ffmpeg.bench"
36
raw_src="vsynth1/%d.pgm"
37
raw_dst="/tmp/out.yuv"
38
pcm_src="asynth1.sw"
39
pcm_dst="/tmp/out.wav"
40

    
41
function do_ffmpeg ()
42
{
43
    f="$1"
44
    shift
45
    echo $ffmpeg -bitexact $*
46
    $ffmpeg -bitexact -benchmark $* > /tmp/bench.tmp
47
    md5sum $f >> $logfile
48
    expr match "`cat /tmp/bench.tmp`" '.*utime=\(.*s\)' > /tmp/bench2.tmp
49
    echo `cat /tmp/bench2.tmp` $f >> $benchfile
50
}
51

    
52
function do_ffmpeg_crc ()
53
{
54
    f="$1"
55
    shift
56
    echo $ffmpeg -y -bitexact $* -f crc /tmp/ffmpeg.crc
57
    $ffmpeg -y -bitexact $* -f crc /tmp/ffmpeg.crc
58
    echo -n "$f " >> $logfile
59
    cat /tmp/ffmpeg.crc >> $logfile
60
}
61

    
62
echo "ffmpeg regression test" > $logfile
63
echo "ffmpeg benchmarks" > $benchfile
64

    
65
###################################
66
if [ -n "$do_mpeg" ] ; then
67
# mpeg1 encoding
68
file=${outfile}mpeg1.mpg
69
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file 
70

    
71
# mpeg1 decoding
72
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
73

    
74
# mpeg2 decoding
75
#do_ffmpeg /tmp/out-mpeg2.yuv -y -f mpegvideo -i a.vob \
76
#          -f rawvideo /tmp/out-mpeg2.yuv
77
fi
78

    
79
###################################
80
if [ -n "$do_msmpeg4" ] ; then
81
# msmpeg4 encoding
82
file=${outfile}msmpeg4.avi
83
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
84

    
85
# msmpeg4 decoding
86
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
87
fi
88

    
89
###################################
90
if [ -n "$do_h263" ] ; then
91
# h263 encoding
92
file=${outfile}h263.avi
93
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
94

    
95
# h263p decoding
96
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
97
fi
98

    
99
###################################
100
if [ -n "$do_mpeg4" ] ; then
101
# mpeg4
102
file=${outfile}odivx.avi
103
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
104

    
105
# mpeg4 decoding
106
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
107
fi
108

    
109
###################################
110
if [ -n "$do_mjpeg" ] ; then
111
# mjpeg
112
file=${outfile}mjpeg.avi
113
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg $file
114

    
115
# mjpeg decoding
116
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
117
fi
118

    
119
###################################
120
if [ -n "$do_rv10" ] ; then
121
# rv10 encoding
122
file=${outfile}rv10.rm
123
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file 
124

    
125
# rv10 decoding
126
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst 
127
fi
128

    
129
###################################
130
if [ -n "$do_mp2" ] ; then
131
# mp2 encoding
132
file=${outfile}mp2.mp2
133
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file 
134

    
135
# mp2 decoding
136
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst 
137
fi
138

    
139
###################################
140
if [ -n "$do_ac3" ] ; then
141
# ac3 encoding
142
file=${outfile}ac3.rm
143
do_ffmpeg $file -y -ab 128 -ac 2 -f s16le  -i $pcm_src -vn $file 
144

    
145
# ac3 decoding
146
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst 
147
fi
148

    
149
###################################
150
# libav testing
151
###################################
152

    
153
if [ -n "$do_libav" ] ; then
154

    
155
# avi
156
file=${outfile}libav.avi
157
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
158
do_ffmpeg_crc $file -i $file
159

    
160
# asf
161
file=${outfile}libav.asf
162
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
163
do_ffmpeg_crc $file -i $file
164

    
165
# rm
166
file=${outfile}libav.rm
167
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
168
# broken
169
#do_ffmpeg_crc $file -i $file
170

    
171
# mpegps
172
file=${outfile}libav.mpg
173
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
174
do_ffmpeg_crc $file -i $file
175

    
176
# swf (decode audio only)
177
file=${outfile}libav.swf
178
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
179
do_ffmpeg_crc $file -i $file
180

    
181
# ffm
182
file=${outfile}libav.ffm
183
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
184
do_ffmpeg_crc $file -i $file
185

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

    
188
####################
189
# streamed images
190
# mjpeg
191
file=${outfile}libav.mjpeg
192
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
193
do_ffmpeg_crc $file -i $file
194

    
195
# pgmpipe
196
file=${outfile}libav.pgmpipe
197
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f pgmpipe $file
198
do_ffmpeg_crc $file -f pgmpipe -i $file
199

    
200
# ppmpipe
201
file=${outfile}libav.ppmpipe
202
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f ppmpipe $file
203
do_ffmpeg_crc $file -f ppmpipe -i $file
204

    
205
# gif
206
file=${outfile}libav.gif
207
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f ppmpipe $file
208
#do_ffmpeg_crc $file -f ppmpipe -i $file
209

    
210
####################
211
# image formats
212
# pgm (we do not do md5 on image files yet)
213
file=${outfile}libav%d.pgm
214
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
215
do_ffmpeg_crc $file -i $file
216

    
217
# ppm (we do not do md5 on image files yet)
218
file=${outfile}libav%d.ppm
219
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
220
do_ffmpeg_crc $file -i $file
221

    
222
# jpeg (we do not do md5 on image files yet)
223
file=${outfile}libav%d.jpg
224
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
225
do_ffmpeg_crc $file -i $file
226

    
227
####################
228
# audio only
229

    
230
# wav
231
file=${outfile}libav.wav
232
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
233
do_ffmpeg_crc $file -i $file
234

    
235
# alaw
236
file=${outfile}libav.al
237
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
238
do_ffmpeg_crc $file -i $file
239

    
240
# mulaw
241
file=${outfile}libav.ul
242
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
243
do_ffmpeg_crc $file -i $file
244

    
245
# au
246
file=${outfile}libav.au
247
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
248
do_ffmpeg_crc $file -i $file
249

    
250
fi
251

    
252

    
253

    
254
if diff -u $logfile $reffile ; then
255
    echo 
256
    echo Regression test succeeded.
257
    exit 0
258
else
259
    echo 
260
    echo Regression test: Error.
261
    exit 1
262
fi