Commit | Line | Data |
---|---|---|
51133a7d FB |
1 | #!/bin/sh |
2 | # | |
3 | # automatic regression test for ffmpeg | |
4 | # | |
5 | # | |
6 | #set -x | |
6e023978 | 7 | # Even in the 21st century some diffs are not supporting -u. |
281a74da | 8 | diff -u "$0" "$0" > /dev/null 2>&1 |
6e023978 RS |
9 | if [ $? -eq 0 ]; then |
10 | diff_cmd="diff -u" | |
11 | else | |
12 | diff_cmd="diff" | |
13 | fi | |
14 | ||
281a74da | 15 | diff -w "$0" "$0" > /dev/null 2>&1 |
d9d7653e MN |
16 | if [ $? -eq 0 ]; then |
17 | diff_cmd="$diff_cmd -w" | |
18 | fi | |
19 | ||
51133a7d FB |
20 | set -e |
21 | ||
5bcfd1ad FB |
22 | datadir="./data" |
23 | ||
24 | logfile="$datadir/ffmpeg.regression" | |
a12eea30 | 25 | outfile="$datadir/a-" |
89d5dfd5 | 26 | |
51133a7d FB |
27 | # tests to do |
28 | if [ "$1" = "mpeg4" ] ; then | |
29 | do_mpeg4=y | |
30 | elif [ "$1" = "mpeg" ] ; then | |
31 | do_mpeg=y | |
853d659d | 32 | do_mpeg2=y |
7481e919 FB |
33 | elif [ "$1" = "ac3" ] ; then |
34 | do_ac3=y | |
87c5fbc3 MN |
35 | elif [ "$1" = "huffyuv" ] ; then |
36 | do_huffyuv=y | |
7f8038ce MN |
37 | elif [ "$1" = "mpeg2thread" ] ; then |
38 | do_mpeg2thread=y | |
d13eef3d MN |
39 | elif [ "$1" = "snow" ] ; then |
40 | do_snow=y | |
89d5dfd5 FB |
41 | elif [ "$1" = "libavtest" ] ; then |
42 | do_libav=y | |
5bcfd1ad | 43 | logfile="$datadir/libav.regression" |
a12eea30 | 44 | outfile="$datadir/b-" |
51133a7d FB |
45 | else |
46 | do_mpeg=y | |
922bc38d | 47 | do_mpeg2=y |
9c3d33d6 | 48 | do_mpeg2thread=y |
6ebd933b | 49 | do_msmpeg4v2=y |
51133a7d | 50 | do_msmpeg4=y |
6ebd933b | 51 | do_wmv1=y |
e23d5712 | 52 | do_wmv2=y |
61b262a9 | 53 | do_h261=y |
51133a7d | 54 | do_h263=y |
6e2d5f1a | 55 | do_h263p=y |
51133a7d | 56 | do_mpeg4=y |
e23d5712 | 57 | do_huffyuv=y |
51133a7d | 58 | do_mjpeg=y |
3b37408b | 59 | do_ljpeg=y |
64a7a8af | 60 | do_rv10=y |
c50cd09d | 61 | do_rv20=y |
51133a7d FB |
62 | do_mp2=y |
63 | do_ac3=y | |
311be1fb | 64 | do_g726=y |
f02ab814 MN |
65 | do_adpcm_ima_wav=y |
66 | do_adpcm_ms=y | |
1dbb6d90 MN |
67 | do_rc=y |
68 | do_mpeg4adv=y | |
9c3d33d6 | 69 | do_mpeg4thread=y |
be408b67 | 70 | do_mpeg4nr=y |
cfadadec | 71 | do_mpeg1b=y |
9ca9fce1 | 72 | do_asv1=y |
8d876a43 | 73 | do_asv2=y |
bbdd42d3 | 74 | do_flv=y |
f3203047 | 75 | do_ffv1=y |
7ebfc0ea | 76 | do_error=y |
b86bd1f1 | 77 | do_svq1=y |
d13eef3d | 78 | do_snow=y |
51133a7d FB |
79 | fi |
80 | ||
81 | ||
82 | # various files | |
3aca208a | 83 | ffmpeg="../ffmpeg_g" |
67cbe681 | 84 | tiny_psnr="./tiny_psnr" |
51133a7d | 85 | reffile="$2" |
5bcfd1ad | 86 | benchfile="$datadir/ffmpeg.bench" |
6afd3b92 | 87 | raw_src="$3/%d.pgm" |
5bcfd1ad | 88 | raw_dst="$datadir/out.yuv" |
67cbe681 | 89 | raw_ref="$datadir/ref.yuv" |
51133a7d | 90 | pcm_src="asynth1.sw" |
5bcfd1ad | 91 | pcm_dst="$datadir/out.wav" |
16dd93ab | 92 | pcm_ref="$datadir/ref.wav" |
853d659d JD |
93 | if [ X"`echo | md5sum 2> /dev/null`" != X ]; then |
94 | do_md5sum() { md5sum -b $1; } | |
95 | elif [ -x /sbin/md5 ]; then | |
96 | do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; } | |
97 | else | |
98 | do_md5sum() { echo No md5sum program found; } | |
99 | fi | |
5bcfd1ad FB |
100 | |
101 | # create the data directory if it does not exists | |
102 | mkdir -p $datadir | |
51133a7d | 103 | |
3f027ca7 | 104 | do_ffmpeg() |
51133a7d FB |
105 | { |
106 | f="$1" | |
107 | shift | |
affd55a1 RS |
108 | echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* |
109 | $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ | |
37a00782 | 110 | egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true |
e31c1c30 | 111 | rm -f /tmp/ffmpeg$$ |
853d659d | 112 | do_md5sum $f >> $logfile |
67cbe681 MN |
113 | if [ $f = $raw_dst ] ; then |
114 | $tiny_psnr $f $raw_ref >> $logfile | |
16dd93ab | 115 | elif [ $f = $pcm_dst ] ; then |
976709ee | 116 | $tiny_psnr $f $pcm_ref 2 >> $logfile |
039e7889 MN |
117 | else |
118 | wc -c $f >> $logfile | |
67cbe681 | 119 | fi |
90cee0c3 | 120 | expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp |
5bcfd1ad | 121 | echo `cat $datadir/bench2.tmp` $f >> $benchfile |
51133a7d FB |
122 | } |
123 | ||
3f027ca7 | 124 | do_ffmpeg_crc() |
89d5dfd5 FB |
125 | { |
126 | f="$1" | |
127 | shift | |
2ad1516a | 128 | echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc |
affd55a1 | 129 | $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1 |
37a00782 | 130 | egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:|ffmpeg version| configuration| built)" /tmp/ffmpeg$$ || true |
affd55a1 RS |
131 | rm -f /tmp/ffmpeg$$ |
132 | echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile | |
89d5dfd5 | 133 | } |
51133a7d | 134 | |
67cbe681 MN |
135 | do_ffmpeg_nocheck() |
136 | { | |
137 | f="$1" | |
138 | shift | |
affd55a1 RS |
139 | echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* |
140 | $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ | |
37a00782 | 141 | egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true |
affd55a1 | 142 | rm -f /tmp/ffmpeg$$ |
67cbe681 MN |
143 | expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp |
144 | echo `cat $datadir/bench2.tmp` $f >> $benchfile | |
145 | } | |
146 | ||
51133a7d FB |
147 | echo "ffmpeg regression test" > $logfile |
148 | echo "ffmpeg benchmarks" > $benchfile | |
149 | ||
150 | ################################### | |
67cbe681 MN |
151 | # generate reference for quality check |
152 | do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref | |
16dd93ab | 153 | do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref |
67cbe681 MN |
154 | |
155 | ################################### | |
51133a7d FB |
156 | if [ -n "$do_mpeg" ] ; then |
157 | # mpeg1 encoding | |
158 | file=${outfile}mpeg1.mpg | |
89d5dfd5 | 159 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file |
51133a7d FB |
160 | |
161 | # mpeg1 decoding | |
89d5dfd5 | 162 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst |
922bc38d MN |
163 | fi |
164 | ||
165 | ################################### | |
166 | if [ -n "$do_mpeg2" ] ; then | |
167 | # mpeg2 encoding | |
83dddc4a FB |
168 | file=${outfile}mpeg2.mpg |
169 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video $file | |
170 | ||
171 | # mpeg2 decoding | |
172 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
173 | ||
6486ad57 MN |
174 | # mpeg2 encoding |
175 | file=${outfile}mpeg2.mpg | |
176 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -idct_algo 1 -dct_algo 2 -f mpeg1video $file | |
177 | ||
178 | # mpeg2 decoding | |
179 | do_ffmpeg $raw_dst -y -idct_algo 1 -i $file -f rawvideo $raw_dst | |
180 | ||
83dddc4a FB |
181 | # mpeg2 encoding interlaced |
182 | file=${outfile}mpeg2i.mpg | |
69768b77 | 183 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -ildct -ilme $file |
51133a7d FB |
184 | |
185 | # mpeg2 decoding | |
922bc38d | 186 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst |
51133a7d FB |
187 | fi |
188 | ||
189 | ################################### | |
9c3d33d6 MN |
190 | if [ -n "$do_mpeg2thread" ] ; then |
191 | # mpeg2 encoding interlaced | |
192 | file=${outfile}mpeg2thread.mpg | |
193 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -ildct -ilme -threads 2 $file | |
194 | ||
195 | # mpeg2 decoding | |
196 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
7f8038ce MN |
197 | |
198 | # mpeg2 encoding interlaced | |
199 | file=${outfile}mpeg2reuse.mpg | |
200 | do_ffmpeg $file -y -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -ildct -ilme -threads 4 $file | |
201 | ||
202 | # mpeg2 decoding | |
203 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
9c3d33d6 MN |
204 | fi |
205 | ||
206 | ################################### | |
6ebd933b MN |
207 | if [ -n "$do_msmpeg4v2" ] ; then |
208 | # msmpeg4 encoding | |
209 | file=${outfile}msmpeg4v2.avi | |
210 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file | |
211 | ||
212 | # msmpeg4v2 decoding | |
213 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
214 | fi | |
215 | ||
216 | ################################### | |
51133a7d FB |
217 | if [ -n "$do_msmpeg4" ] ; then |
218 | # msmpeg4 encoding | |
219 | file=${outfile}msmpeg4.avi | |
220 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file | |
221 | ||
222 | # msmpeg4 decoding | |
223 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
224 | fi | |
225 | ||
226 | ################################### | |
6ebd933b MN |
227 | if [ -n "$do_wmv1" ] ; then |
228 | # wmv1 encoding | |
229 | file=${outfile}wmv1.avi | |
230 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file | |
231 | ||
232 | # wmv1 decoding | |
233 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
234 | fi | |
235 | ||
236 | ################################### | |
e23d5712 MN |
237 | if [ -n "$do_wmv2" ] ; then |
238 | # wmv2 encoding | |
239 | file=${outfile}wmv2.avi | |
240 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv2 $file | |
241 | ||
242 | # wmv2 decoding | |
243 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
244 | fi | |
245 | ||
246 | ################################### | |
61b262a9 MN |
247 | if [ -n "$do_h261" ] ; then |
248 | # h261 encoding | |
249 | file=${outfile}h261.avi | |
250 | do_ffmpeg $file -y -qscale 11 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h261 $file | |
251 | ||
252 | # h261 decoding | |
253 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
254 | fi | |
255 | ||
256 | ################################### | |
51133a7d FB |
257 | if [ -n "$do_h263" ] ; then |
258 | # h263 encoding | |
259 | file=${outfile}h263.avi | |
260 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file | |
261 | ||
6e2d5f1a MN |
262 | # h263 decoding |
263 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
264 | fi | |
265 | ||
266 | ################################### | |
267 | if [ -n "$do_h263p" ] ; then | |
268 | # h263p encoding | |
269 | file=${outfile}h263p.avi | |
d7d24282 | 270 | do_ffmpeg $file -y -qscale 2 -umv -aiv -aic -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file |
6e2d5f1a | 271 | |
51133a7d FB |
272 | # h263p decoding |
273 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
274 | fi | |
275 | ||
276 | ################################### | |
277 | if [ -n "$do_mpeg4" ] ; then | |
278 | # mpeg4 | |
28c70622 | 279 | file=${outfile}odivx.mp4 |
d3985de7 | 280 | do_ffmpeg $file -y -4mv -hq -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file |
51133a7d FB |
281 | |
282 | # mpeg4 decoding | |
283 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
284 | fi | |
285 | ||
286 | ################################### | |
e629ab68 RD |
287 | if [ -n "$do_huffyuv" ] ; then |
288 | # huffyuv | |
289 | file=${outfile}huffyuv.avi | |
f37b9768 | 290 | do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec huffyuv -pix_fmt yuv422p $file |
e629ab68 RD |
291 | |
292 | # huffyuv decoding | |
9cd81798 | 293 | do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -2 -pix_fmt yuv420p $raw_dst |
e629ab68 RD |
294 | fi |
295 | ||
296 | ################################### | |
1dbb6d90 MN |
297 | if [ -n "$do_rc" ] ; then |
298 | # mpeg4 rate control | |
299 | file=${outfile}mpeg4-rc.avi | |
300 | do_ffmpeg $file -y -b 400 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file | |
301 | ||
302 | # mpeg4 rate control decoding | |
303 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
304 | fi | |
305 | ||
306 | ################################### | |
307 | if [ -n "$do_mpeg4adv" ] ; then | |
308 | # mpeg4 | |
309 | file=${outfile}mpeg4-adv.avi | |
c0baa56a | 310 | do_ffmpeg $file -y -qscale 9 -4mv -hq -part -ps 200 -aic -trell -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file |
1dbb6d90 MN |
311 | |
312 | # mpeg4 decoding | |
313 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
314 | fi | |
315 | ||
316 | ################################### | |
9c3d33d6 MN |
317 | if [ -n "$do_mpeg4thread" ] ; then |
318 | # mpeg4 | |
319 | file=${outfile}mpeg4-thread.avi | |
320 | do_ffmpeg $file -y -b 500 -4mv -hq -part -ps 200 -aic -trell -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file | |
321 | ||
322 | # mpeg4 decoding | |
323 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
aab9cdcf MN |
324 | fi |
325 | ||
326 | ################################### | |
327 | if [ -n "$do_mpeg4adv" ] ; then | |
328 | # mpeg4 | |
329 | file=${outfile}mpeg4-Q.avi | |
330 | do_ffmpeg $file -y -qscale 7 -4mv -mbd 2 -qpel -bf 2 -cmp 1 -subcmp 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file | |
331 | ||
332 | # mpeg4 decoding | |
333 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
9c3d33d6 MN |
334 | fi |
335 | ||
336 | ################################### | |
7ebfc0ea MN |
337 | if [ -n "$do_error" ] ; then |
338 | # damaged mpeg4 | |
339 | file=${outfile}error-mpeg4-adv.avi | |
340 | do_ffmpeg $file -y -qscale 7 -4mv -mbd 2 -part -ps 250 -error 10 -aic -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file | |
341 | ||
342 | # damaged mpeg4 decoding | |
343 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
344 | fi | |
345 | ||
346 | ################################### | |
be408b67 MN |
347 | if [ -n "$do_mpeg4nr" ] ; then |
348 | # noise reduction | |
9c3d33d6 | 349 | file=${outfile}mpeg4-nr.avi |
be408b67 MN |
350 | do_ffmpeg $file -y -qscale 8 -4mv -mbd 2 -nr 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file |
351 | ||
352 | # mpeg4 decoding | |
353 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
354 | fi | |
355 | ||
356 | ################################### | |
cfadadec MN |
357 | if [ -n "$do_mpeg1b" ] ; then |
358 | # mpeg1 | |
359 | file=${outfile}mpeg1b.mpg | |
83dddc4a | 360 | do_ffmpeg $file -y -qscale 8 -bf 3 -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg1video -f mpeg1video $file |
cfadadec MN |
361 | |
362 | # mpeg1 decoding | |
363 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
364 | fi | |
365 | ||
366 | ################################### | |
51133a7d FB |
367 | if [ -n "$do_mjpeg" ] ; then |
368 | # mjpeg | |
369 | file=${outfile}mjpeg.avi | |
dd4f8a04 | 370 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg -pix_fmt yuvj420p $file |
51133a7d FB |
371 | |
372 | # mjpeg decoding | |
644a9262 | 373 | do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst |
51133a7d FB |
374 | fi |
375 | ||
376 | ################################### | |
3b37408b MN |
377 | if [ -n "$do_ljpeg" ] ; then |
378 | # ljpeg | |
379 | file=${outfile}ljpeg.avi | |
dd4f8a04 | 380 | do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec ljpeg -strict -1 $file |
3b37408b MN |
381 | |
382 | # ljpeg decoding | |
383 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
384 | fi | |
385 | ||
386 | ################################### | |
51133a7d FB |
387 | if [ -n "$do_rv10" ] ; then |
388 | # rv10 encoding | |
389 | file=${outfile}rv10.rm | |
390 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file | |
391 | ||
392 | # rv10 decoding | |
393 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
394 | fi | |
395 | ||
396 | ################################### | |
c50cd09d MN |
397 | if [ -n "$do_rv20" ] ; then |
398 | # rv20 encoding | |
399 | file=${outfile}rv20.rm | |
400 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec rv20 -an $file | |
401 | ||
402 | # rv20 decoding | |
403 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
404 | fi | |
405 | ||
406 | ################################### | |
9ca9fce1 MN |
407 | if [ -n "$do_asv1" ] ; then |
408 | # asv1 encoding | |
409 | file=${outfile}asv1.avi | |
410 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv1 $file | |
411 | ||
412 | # asv1 decoding | |
413 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
414 | fi | |
415 | ||
416 | ################################### | |
8d876a43 MN |
417 | if [ -n "$do_asv2" ] ; then |
418 | # asv2 encoding | |
419 | file=${outfile}asv2.avi | |
420 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv2 $file | |
421 | ||
422 | # asv2 decoding | |
423 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
424 | fi | |
425 | ||
426 | ################################### | |
bbdd42d3 MN |
427 | if [ -n "$do_flv" ] ; then |
428 | # flv encoding | |
429 | file=${outfile}flv.flv | |
430 | do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec flv $file | |
431 | ||
432 | # flv decoding | |
433 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
434 | fi | |
435 | ||
436 | ################################### | |
f3203047 MN |
437 | if [ -n "$do_ffv1" ] ; then |
438 | # ffv1 encoding | |
439 | file=${outfile}ffv1.avi | |
9cd81798 | 440 | do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec ffv1 $file |
f3203047 MN |
441 | |
442 | # ffv1 decoding | |
443 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
d13eef3d MN |
444 | fi |
445 | ||
446 | ################################### | |
447 | if [ -n "$do_snow" ] ; then | |
448 | # snow encoding | |
449 | file=${outfile}snow.avi | |
9cd81798 | 450 | do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -qscale 2 $file |
d13eef3d MN |
451 | |
452 | # snow decoding | |
453 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
454 | ||
455 | # snow encoding | |
456 | file=${outfile}snow53.avi | |
9cd81798 | 457 | do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -pred 1 -qpel -4mv $file |
d13eef3d MN |
458 | |
459 | # snow decoding | |
460 | do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst | |
f3203047 MN |
461 | fi |
462 | ||
463 | ################################### | |
b86bd1f1 MN |
464 | if [ -n "$do_svq1" ] ; then |
465 | # svq1 encoding | |
466 | file=${outfile}svq1.mov | |
e6cf9be5 | 467 | do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec svq1 -qscale 3 -pix_fmt yuv410p $file |
b86bd1f1 MN |
468 | |
469 | # svq1 decoding | |
644a9262 | 470 | do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst |
b86bd1f1 MN |
471 | fi |
472 | ||
473 | ################################### | |
51133a7d FB |
474 | if [ -n "$do_mp2" ] ; then |
475 | # mp2 encoding | |
476 | file=${outfile}mp2.mp2 | |
477 | do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file | |
478 | ||
479 | # mp2 decoding | |
480 | do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst | |
976709ee | 481 | $tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile |
51133a7d FB |
482 | fi |
483 | ||
484 | ################################### | |
485 | if [ -n "$do_ac3" ] ; then | |
486 | # ac3 encoding | |
487 | file=${outfile}ac3.rm | |
488 | do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file | |
489 | ||
490 | # ac3 decoding | |
3c300082 | 491 | #do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst |
51133a7d FB |
492 | fi |
493 | ||
89d5dfd5 | 494 | ################################### |
311be1fb MN |
495 | if [ -n "$do_g726" ] ; then |
496 | # g726 encoding | |
497 | file=${outfile}g726.wav | |
498 | do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -ab 32 -ac 1 -ar 8000 -acodec g726 $file | |
499 | ||
500 | # g726 decoding | |
501 | do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst | |
502 | fi | |
503 | ||
504 | ################################### | |
f02ab814 MN |
505 | if [ -n "$do_adpcm_ima_wav" ] ; then |
506 | # encoding | |
507 | file=${outfile}adpcm_ima.wav | |
508 | do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ima_wav $file | |
509 | ||
510 | # decoding | |
511 | do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst | |
512 | fi | |
513 | ||
514 | ################################### | |
515 | if [ -n "$do_adpcm_ms" ] ; then | |
516 | # encoding | |
517 | file=${outfile}adpcm_ms.wav | |
518 | do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ms $file | |
519 | ||
520 | # decoding | |
521 | do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst | |
522 | fi | |
523 | ||
524 | ################################### | |
89d5dfd5 FB |
525 | # libav testing |
526 | ################################### | |
527 | ||
528 | if [ -n "$do_libav" ] ; then | |
529 | ||
530 | # avi | |
531 | file=${outfile}libav.avi | |
532 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file | |
533 | do_ffmpeg_crc $file -i $file | |
534 | ||
535 | # asf | |
536 | file=${outfile}libav.asf | |
ba30abcb | 537 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file |
e928649b | 538 | do_ffmpeg_crc $file -i $file -r 25 |
89d5dfd5 FB |
539 | |
540 | # rm | |
541 | file=${outfile}libav.rm | |
542 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file | |
543 | # broken | |
544 | #do_ffmpeg_crc $file -i $file | |
545 | ||
546 | # mpegps | |
547 | file=${outfile}libav.mpg | |
548 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file | |
549 | do_ffmpeg_crc $file -i $file | |
550 | ||
d05c15cb MN |
551 | # mpegts |
552 | file=${outfile}libav.ts | |
553 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file | |
554 | do_ffmpeg_crc $file -i $file | |
555 | ||
89d5dfd5 FB |
556 | # swf (decode audio only) |
557 | file=${outfile}libav.swf | |
2dd59ebd | 558 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file |
d0c30ca5 | 559 | do_ffmpeg_crc $file -i $file |
89d5dfd5 FB |
560 | |
561 | # ffm | |
74d69c07 MN |
562 | file=${outfile}libav.ffm |
563 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file | |
564 | do_ffmpeg_crc $file -i $file | |
89d5dfd5 | 565 | |
bbdd42d3 MN |
566 | # flv |
567 | file=${outfile}libav.flv | |
ba30abcb | 568 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -an $file |
bbdd42d3 MN |
569 | do_ffmpeg_crc $file -i $file |
570 | ||
c280f2d7 | 571 | # mov |
2dd59ebd MN |
572 | file=${outfile}libav.mov |
573 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec pcm_alaw $file | |
574 | do_ffmpeg_crc $file -i $file | |
c280f2d7 MN |
575 | |
576 | # nut | |
577 | file=${outfile}libav.nut | |
ba30abcb | 578 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file |
c280f2d7 MN |
579 | do_ffmpeg_crc $file -i $file |
580 | ||
a811de6e | 581 | # dv |
3ea1ce21 RS |
582 | file=${outfile}libav.dv |
583 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -ar 48000 -r 25 -s pal -ac 2 $file | |
584 | do_ffmpeg_crc $file -i $file | |
a811de6e | 585 | |
89d5dfd5 FB |
586 | #################### |
587 | # streamed images | |
588 | # mjpeg | |
affd55a1 RS |
589 | #file=${outfile}libav.mjpeg |
590 | #do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file | |
591 | #do_ffmpeg_crc $file -i $file | |
89d5dfd5 | 592 | |
7481e919 FB |
593 | # pbmpipe |
594 | file=${outfile}libav.pbm | |
87c5fbc3 MN |
595 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file |
596 | do_ffmpeg_crc $file -f image2pipe -i $file | |
7481e919 | 597 | |
89d5dfd5 | 598 | # pgmpipe |
7481e919 | 599 | file=${outfile}libav.pgm |
87c5fbc3 MN |
600 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file |
601 | do_ffmpeg_crc $file -f image2pipe -i $file | |
89d5dfd5 FB |
602 | |
603 | # ppmpipe | |
7481e919 | 604 | file=${outfile}libav.ppm |
87c5fbc3 MN |
605 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file |
606 | do_ffmpeg_crc $file -f image2pipe -i $file | |
89d5dfd5 FB |
607 | |
608 | # gif | |
609 | file=${outfile}libav.gif | |
7481e919 FB |
610 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file |
611 | #do_ffmpeg_crc $file -i $file | |
612 | ||
613 | # yuv4mpeg | |
8cf71ead | 614 | file=${outfile}libav.y4m |
7481e919 FB |
615 | do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file |
616 | #do_ffmpeg_crc $file -i $file | |
89d5dfd5 FB |
617 | |
618 | #################### | |
619 | # image formats | |
620 | # pgm (we do not do md5 on image files yet) | |
621 | file=${outfile}libav%d.pgm | |
622 | $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file | |
623 | do_ffmpeg_crc $file -i $file | |
624 | ||
625 | # ppm (we do not do md5 on image files yet) | |
626 | file=${outfile}libav%d.ppm | |
627 | $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file | |
628 | do_ffmpeg_crc $file -i $file | |
629 | ||
d0c30ca5 | 630 | # jpeg (we do not do md5 on image files yet) |
72f89c4c | 631 | file=${outfile}libav%d.jpg |
dd4f8a04 | 632 | $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -bitexact -dct_algo 1 -idct_algo 2 -pix_fmt yuvj420p -f image2 $file |
72f89c4c | 633 | do_ffmpeg_crc $file -f image2 -i $file |
d0c30ca5 | 634 | |
89d5dfd5 FB |
635 | #################### |
636 | # audio only | |
637 | ||
638 | # wav | |
639 | file=${outfile}libav.wav | |
640 | do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file | |
641 | do_ffmpeg_crc $file -i $file | |
642 | ||
643 | # alaw | |
644 | file=${outfile}libav.al | |
645 | do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file | |
646 | do_ffmpeg_crc $file -i $file | |
647 | ||
648 | # mulaw | |
649 | file=${outfile}libav.ul | |
650 | do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file | |
651 | do_ffmpeg_crc $file -i $file | |
652 | ||
653 | # au | |
654 | file=${outfile}libav.au | |
655 | do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file | |
656 | do_ffmpeg_crc $file -i $file | |
657 | ||
affd55a1 RS |
658 | #################### |
659 | # pix_fmt conversions | |
660 | conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \ | |
661 | yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \ | |
662 | monob pal8" | |
663 | for pix_fmt in $conversions ; do | |
664 | file=${outfile}libav-${pix_fmt}.yuv | |
665 | do_ffmpeg_nocheck $file -r 1 -t 1 -y -f pgmyuv -i $raw_src \ | |
666 | -f rawvideo -s 352x288 -pix_fmt $pix_fmt $raw_dst | |
667 | do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $raw_dst \ | |
668 | -f rawvideo -s 352x288 -pix_fmt yuv444p $file | |
669 | done | |
670 | ||
89d5dfd5 FB |
671 | fi |
672 | ||
673 | ||
51133a7d | 674 | |
281a74da | 675 | if $diff_cmd "$logfile" "$reffile" ; then |
51133a7d FB |
676 | echo |
677 | echo Regression test succeeded. | |
678 | exit 0 | |
679 | else | |
680 | echo | |
681 | echo Regression test: Error. | |
682 | exit 1 | |
683 | fi |