removed unused code - began to merge alpha specific stuff - added mac macros for...
[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
89d5dfd5
FB
9logfile="/tmp/ffmpeg.regression"
10
51133a7d
FB
11# tests to do
12if [ "$1" = "mpeg4" ] ; then
13 do_mpeg4=y
14elif [ "$1" = "mpeg" ] ; then
15 do_mpeg=y
89d5dfd5
FB
16elif [ "$1" = "libavtest" ] ; then
17 do_libav=y
18 logfile="/tmp/libav.regression"
51133a7d
FB
19else
20 do_mpeg=y
21 do_msmpeg4=y
22 do_h263=y
23 do_mpeg4=y
24 do_mjpeg=y
89d5dfd5 25 #do_rv10=y #broken
51133a7d
FB
26 do_mp2=y
27 do_ac3=y
28fi
29
30
31# various files
32ffmpeg="../ffmpeg"
33outfile="/tmp/a-"
34reffile="$2"
51133a7d
FB
35benchfile="/tmp/ffmpeg.bench"
36raw_src="vsynth1/%d.pgm"
37raw_dst="/tmp/out.yuv"
38pcm_src="asynth1.sw"
39pcm_dst="/tmp/out.wav"
40
41function do_ffmpeg ()
42{
43 f="$1"
44 shift
89d5dfd5
FB
45 echo $ffmpeg -bitexact $*
46 $ffmpeg -bitexact -benchmark $* > /tmp/bench.tmp
51133a7d
FB
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
89d5dfd5
FB
52function 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}
51133a7d
FB
61
62echo "ffmpeg regression test" > $logfile
63echo "ffmpeg benchmarks" > $benchfile
64
65###################################
66if [ -n "$do_mpeg" ] ; then
67# mpeg1 encoding
68file=${outfile}mpeg1.mpg
89d5dfd5 69do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file
51133a7d
FB
70
71# mpeg1 decoding
89d5dfd5 72do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
51133a7d
FB
73
74# mpeg2 decoding
75#do_ffmpeg /tmp/out-mpeg2.yuv -y -f mpegvideo -i a.vob \
76# -f rawvideo /tmp/out-mpeg2.yuv
77fi
78
79###################################
80if [ -n "$do_msmpeg4" ] ; then
81# msmpeg4 encoding
82file=${outfile}msmpeg4.avi
83do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
84
85# msmpeg4 decoding
86do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
87fi
88
89###################################
90if [ -n "$do_h263" ] ; then
91# h263 encoding
92file=${outfile}h263.avi
93do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
94
95# h263p decoding
96do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
97fi
98
99###################################
100if [ -n "$do_mpeg4" ] ; then
101# mpeg4
102file=${outfile}odivx.avi
103do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
104
105# mpeg4 decoding
106do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
107fi
108
109###################################
110if [ -n "$do_mjpeg" ] ; then
111# mjpeg
112file=${outfile}mjpeg.avi
113do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg $file
114
115# mjpeg decoding
116do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
117fi
118
119###################################
120if [ -n "$do_rv10" ] ; then
121# rv10 encoding
122file=${outfile}rv10.rm
123do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file
124
125# rv10 decoding
126do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
127fi
128
129###################################
130if [ -n "$do_mp2" ] ; then
131# mp2 encoding
132file=${outfile}mp2.mp2
133do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
134
135# mp2 decoding
136do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
137fi
138
139###################################
140if [ -n "$do_ac3" ] ; then
141# ac3 encoding
142file=${outfile}ac3.rm
143do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file
144
145# ac3 decoding
146do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
147fi
148
89d5dfd5
FB
149###################################
150# libav testing
151###################################
152
153if [ -n "$do_libav" ] ; then
154
155# avi
156file=${outfile}libav.avi
157do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
158do_ffmpeg_crc $file -i $file
159
160# asf
161file=${outfile}libav.asf
162do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
163do_ffmpeg_crc $file -i $file
164
165# rm
166file=${outfile}libav.rm
167do_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
172file=${outfile}libav.mpg
173do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
174do_ffmpeg_crc $file -i $file
175
176# swf (decode audio only)
177file=${outfile}libav.swf
d0c30ca5
FB
178do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
179do_ffmpeg_crc $file -i $file
89d5dfd5
FB
180
181# ffm
182file=${outfile}libav.ffm
183do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
d0c30ca5 184do_ffmpeg_crc $file -i $file
89d5dfd5
FB
185
186# XXX: need mov and mpegts tests (add bitstreams or add output capability in ffmpeg)
187
188####################
189# streamed images
190# mjpeg
191file=${outfile}libav.mjpeg
192do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
d0c30ca5 193do_ffmpeg_crc $file -i $file
89d5dfd5
FB
194
195# pgmpipe
196file=${outfile}libav.pgmpipe
197do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f pgmpipe $file
198do_ffmpeg_crc $file -f pgmpipe -i $file
199
200# ppmpipe
201file=${outfile}libav.ppmpipe
202do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f ppmpipe $file
203do_ffmpeg_crc $file -f ppmpipe -i $file
204
205# gif
206file=${outfile}libav.gif
207do_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)
213file=${outfile}libav%d.pgm
214$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
215do_ffmpeg_crc $file -i $file
216
217# ppm (we do not do md5 on image files yet)
218file=${outfile}libav%d.ppm
219$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
220do_ffmpeg_crc $file -i $file
221
d0c30ca5
FB
222# jpeg (we do not do md5 on image files yet)
223file=${outfile}libav%d.jpg
224$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
225do_ffmpeg_crc $file -i $file
226
89d5dfd5
FB
227####################
228# audio only
229
230# wav
231file=${outfile}libav.wav
232do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
233do_ffmpeg_crc $file -i $file
234
235# alaw
236file=${outfile}libav.al
237do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
238do_ffmpeg_crc $file -i $file
239
240# mulaw
241file=${outfile}libav.ul
242do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
243do_ffmpeg_crc $file -i $file
244
245# au
246file=${outfile}libav.au
247do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
248do_ffmpeg_crc $file -i $file
249
250fi
251
252
51133a7d
FB
253
254if diff -u $logfile $reffile ; then
255 echo
256 echo Regression test succeeded.
257 exit 0
258else
259 echo
260 echo Regression test: Error.
261 exit 1
262fi