]> git.sesse.net Git - ffmpeg/blob - tests/lavf-regression.sh
Merge commit 'eb8a8115994434b548523cf0bca6a4a74784e79c'
[ffmpeg] / tests / lavf-regression.sh
1 #!/bin/sh
2 #
3 # automatic regression test for libavformat
4 #
5 #
6 #set -x
7
8 set -e
9
10 . $(dirname $0)/regression-funcs.sh
11
12 eval do_$test=y
13
14 ENC_OPTS="$ENC_OPTS -metadata title=lavftest"
15
16 do_lavf_fate()
17 {
18     file=${outfile}lavf.$1
19     input="${target_samples}/$2"
20     do_avconv $file $DEC_OPTS -i "$input" $ENC_OPTS -vcodec copy -acodec copy
21     do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3
22 }
23
24 do_lavf()
25 {
26     file=${outfile}lavf.$1
27     do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le $2 -i $pcm_src $ENC_OPTS -b:a 64k -t 1 -qscale:v 10 $3
28     test $5 = "disable_crc" ||
29         do_avconv_crc $file $DEC_OPTS -i $target_path/$file $4
30 }
31
32 do_lavf_timecode_nodrop() { do_lavf $1 "" "$2 -timecode 02:56:14:13"; }
33 do_lavf_timecode_drop()   { do_lavf $1 "" "$2 -timecode 02:56:14.13 -r 30000/1001"; }
34
35 do_lavf_timecode()
36 {
37     do_lavf_timecode_nodrop "$@"
38     do_lavf_timecode_drop "$@"
39     do_lavf $1 "" "$2"
40 }
41
42 do_image_formats()
43 {
44     outfile="$datadir/images/$1/"
45     mkdir -p "$outfile"
46     file=${outfile}%02d.$1
47     run_avconv $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $2 $ENC_OPTS -frames 13 -y -qscale 10 $target_path/$file
48     do_md5sum ${outfile}02.$1
49     do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3
50     echo $(wc -c ${outfile}02.$1)
51 }
52
53 if [ -n "$do_avi" ] ; then
54 do_lavf avi "" "-acodec mp2 -ar 44100 -ab 64k -threads 1"
55 fi
56
57 if [ -n "$do_asf" ] ; then
58 do_lavf asf "" "-acodec mp2 -ar 44100 -ab 64k" "-r 25"
59 fi
60
61 if [ -n "$do_rm" ] ; then
62 file=${outfile}lavf.rm
63 # The RealMedia muxer is broken.
64 do_lavf rm "" "-c:a ac3_fixed" "" disable_crc
65 fi
66
67 if [ -n "$do_mpg" ] ; then
68 do_lavf_timecode mpg "-ab 64k -ar 44100 -threads 1"
69 fi
70
71 if [ -n "$do_mxf" ] ; then
72 do_lavf_timecode mxf "-ar 48000 -bf 2 -threads 1"
73 fi
74
75 if [ -n "$do_mxf_d10" ]; then
76 do_lavf mxf_d10 "-ar 48000 -ac 2" "-r 25 -vf scale=720:576,pad=720:608:0:32 -vcodec mpeg2video -g 0 -flags +ildct+low_delay -dc 10 -non_linear_quant 1 -intra_vlc 1 -qscale 1 -ps 1 -qmin 1 -rc_max_vbv_use 1 -rc_min_vbv_use 1 -pix_fmt yuv422p -minrate 30000k -maxrate 30000k -b 30000k -bufsize 1200000 -top 1 -rc_init_occupancy 1200000 -qmax 12 -f mxf_d10"
77 fi
78
79 if [ -n "$do_mxf_dv25" ]; then
80 do_lavf mxf_dv25 "-ar 48000 -ac 2" "-r 25 -vf scale=720:576,setdar=4/3 -vcodec dvvideo -pix_fmt yuv420p -b 25000k -top 0 -f mxf"
81 fi
82
83 if [ -n "$do_mxf_dvcpro50" ]; then
84 do_lavf mxf_dvcpro50 "-ar 48000 -ac 2" "-r 25 -vf scale=720:576,setdar=16/9 -vcodec dvvideo -pix_fmt yuv422p -b 50000k -top 0 -f mxf"
85 fi
86
87 if [ -n "$do_mxf_opatom" ]; then
88 do_lavf mxf_opatom "" "-s 1920x1080 -vcodec dnxhd -pix_fmt yuv422p -vb 36M -f mxf_opatom -map 0"
89 fi
90
91 if [ -n "$do_mxf_opatom_audio" ]; then
92 do_lavf mxf_opatom_audio "-ar 48000 -ac 1" "-f mxf_opatom -mxf_audio_edit_rate 25 -map 1"
93 fi
94
95 if [ -n "$do_ts" ] ; then
96 do_lavf ts "" "-ab 64k -mpegts_transport_stream_id 42 -ar 44100 -threads 1"
97 fi
98
99 if [ -n "$do_swf" ] ; then
100 do_lavf swf "" "-an"
101 fi
102
103 if [ -n "$do_ffm" ] ; then
104 do_lavf ffm "" "-ar 44100 -threads 1"
105 fi
106
107 if [ -n "$do_flm" ] ; then
108 do_lavf flm "" "-pix_fmt rgba"
109 fi
110
111 if [ -n "$do_flv_fmt" ] ; then
112 do_lavf flv "" "-an"
113 fi
114
115 if [ -n "$do_mov" ] ; then
116 mov_common_opt="-acodec pcm_alaw -vcodec mpeg4 -threads 1"
117 do_lavf mov "" "-movflags +rtphint $mov_common_opt"
118 do_lavf_timecode mov "-movflags +faststart $mov_common_opt"
119 do_lavf_timecode mp4 "-vcodec mpeg4 -an -threads 1"
120 fi
121
122 if [ -n "$do_ismv" ] ; then
123 do_lavf_timecode ismv "-an -vcodec mpeg4 -threads 1"
124 fi
125
126 if [ -n "$do_dv_fmt" ] ; then
127 do_lavf_timecode_nodrop dv "-ar 48000 -r 25 -s pal -ac 2"
128 do_lavf_timecode_drop   dv "-ar 48000 -pix_fmt yuv411p -s ntsc -ac 2"
129 do_lavf dv "-ar 48000 -channel_layout stereo" "-r 25 -s pal"
130 fi
131
132 if [ -n "$do_gxf" ] ; then
133 do_lavf_timecode_nodrop gxf "-ar 48000 -r 25 -s pal -ac 1 -threads 1"
134 do_lavf_timecode_drop   gxf "-ar 48000 -s ntsc -ac 1 -threads 1"
135 do_lavf gxf "-ar 48000" "-r 25 -s pal -ac 1 -threads 1"
136 fi
137
138 if [ -n "$do_nut" ] ; then
139 do_lavf nut "" "-acodec mp2 -ab 64k -ar 44100 -threads 1"
140 fi
141
142 if [ -n "$do_mkv" ] ; then
143 do_lavf mkv "" "-acodec mp2 -ab 64k -vcodec mpeg4 \
144  -attach ${raw_src%/*}/00.pgm -metadata:s:t mimetype=image/x-portable-greymap -threads 1"
145 do_lavf mkv "" "-acodec mp2 -ab 64k -vcodec mpeg4 -ar 44100 -threads 1"
146 fi
147
148 if [ -n "$do_mp3" ] ; then
149 do_lavf_fate mp3 "mp3-conformance/he_32khz.bit" "-acodec copy"
150 fi
151
152 if [ -n "$do_latm" ] ; then
153 do_lavf_fate latm "aac/al04_44.mp4" "-acodec copy"
154 fi
155
156 if [ -n "$do_ogg_vp3" ] ; then
157 # -idct simple causes different results on different systems
158 DEC_OPTS="$DEC_OPTS -idct auto"
159 do_lavf_fate ogg "vp3/coeff_level64.mkv"
160 fi
161
162 if [ -n "$do_ogg_vp8" ] ; then
163 do_lavf_fate ogv "vp8/RRSF49-short.webm" "-acodec copy"
164 fi
165
166 if [ -n "$do_mov_qtrle_mace6" ] ; then
167 DEC_OPTS="$DEC_OPTS -idct auto"
168 do_lavf_fate mov "qtrle/Animation-16Greys.mov"
169 fi
170
171 if [ -n "$do_avi_cram" ] ; then
172 DEC_OPTS="$DEC_OPTS -idct auto"
173 do_lavf_fate avi "cram/toon.avi"
174 fi
175
176 if [ -n "$do_wtv" ] ; then
177 do_lavf wtv "" "-acodec mp2 -threads 1"
178 fi
179
180
181 # streamed images
182 # mjpeg
183 #file=${outfile}lavf.mjpeg
184 #do_avconv $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
185 #do_avconv_crc $file -i $target_path/$file
186
187 if [ -n "$do_gif" ] ; then
188 file=${outfile}lavf.gif
189 do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10 -pix_fmt rgb24
190 do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
191 fi
192
193 if [ -n "$do_apng" ] ; then
194 file=${outfile}lavf.apng
195 do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -pix_fmt rgb24
196 do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
197 file_copy=${outfile}lavf.copy.apng
198 do_avconv $file_copy $DEC_OPTS -i $file $ENC_OPTS -c copy
199 do_avconv_crc $file_copy $DEC_OPTS -i $target_path/$file_copy
200 file=${outfile}lavf.png
201 do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -pix_fmt rgb24 -frames:v 1 -f apng
202 do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
203 fi
204
205 if [ -n "$do_yuv4mpeg" ] ; then
206 file=${outfile}lavf.y4m
207 do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10
208 do_avconv_crc $file -i $target_path/$file
209 fi
210
211 if [ -n "$do_fits" ] ; then
212 pix_fmts="gray gray16be gbrp gbrap gbrp16be gbrap16be"
213 for pix_fmt in $pix_fmts ; do
214     file=${outfile}${pix_fmt}lavf.fits
215     do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -pix_fmt $pix_fmt
216     do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt $pix_fmt
217 done
218 fi
219
220 # image formats
221
222 if [ -n "$do_pgm" ] ; then
223 do_image_formats pgm
224 fi
225
226 if [ -n "$do_ppm" ] ; then
227 do_image_formats ppm
228 fi
229
230 if [ -n "$do_png" ] ; then
231 do_image_formats png
232 do_image_formats png "-pix_fmt gray16be"
233 do_image_formats png "-pix_fmt rgb48be"
234 fi
235
236 if [ -n "$do_xbm" ] ; then
237 do_image_formats xbm
238 fi
239
240 if [ -n "$do_bmp" ] ; then
241 do_image_formats bmp
242 fi
243
244 if [ -n "$do_tga" ] ; then
245 do_image_formats tga
246 fi
247
248 if [ -n "$do_tiff" ] ; then
249 do_image_formats tiff "-pix_fmt rgb24"
250 fi
251
252 if [ -n "$do_sgi" ] ; then
253 do_image_formats sgi
254 fi
255
256 if [ -n "$do_jpg" ] ; then
257 do_image_formats jpg "-pix_fmt yuvj420p"
258 fi
259
260 if [ -n "$do_pam" ] ; then
261 do_image_formats pam
262 do_image_formats pam "-pix_fmt rgba"
263 do_image_formats pam "-pix_fmt gray"
264 do_image_formats pam "-pix_fmt gray16be" "-pix_fmt gray16be"
265 do_image_formats pam "-pix_fmt rgb48be" "-pix_fmt rgb48be"
266 do_image_formats pam "-pix_fmt monob"
267 fi
268
269 if [ -n "$do_pcx" ] ; then
270 do_image_formats pcx
271 fi
272
273 if [ -n "$do_dpx" ] ; then
274 do_image_formats dpx
275 do_image_formats dpx "-pix_fmt gbrp10le" "-pix_fmt gbrp10le"
276 do_image_formats dpx "-pix_fmt gbrp12le" "-pix_fmt gbrp12le"
277 do_image_formats dpx "-pix_fmt rgb48le"
278 do_image_formats dpx "-pix_fmt rgb48le -bits_per_raw_sample 10" "-pix_fmt rgb48le"
279 do_image_formats dpx "-pix_fmt rgba64le"
280 fi
281
282 if [ -n "$do_xwd" ] ; then
283 do_image_formats xwd
284 do_image_formats xwd "-pix_fmt rgba"
285 do_image_formats xwd "-pix_fmt rgb565be"
286 do_image_formats xwd "-pix_fmt rgb555be"
287 do_image_formats xwd "-pix_fmt rgb8"
288 do_image_formats xwd "-pix_fmt rgb4_byte"
289 do_image_formats xwd "-pix_fmt gray"
290 do_image_formats xwd "-pix_fmt monow"
291 fi
292
293 if [ -n "$do_sunrast" ] ; then
294 do_image_formats sun
295 fi
296
297 if [ -n "$do_smjpeg" ] ; then
298 do_lavf smjpeg "" "-f smjpeg"
299 fi
300
301 # pix_fmt conversions
302
303 if [ -n "$do_pixfmt" ] ; then
304 outfile="$datadir/pixfmt/"
305 conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
306              yuvj422p yuvj444p rgb24 bgr24 rgb32 rgb565 rgb555 gray monow \
307              monob yuv440p yuvj440p"
308 for pix_fmt in $conversions ; do
309     file=${outfile}${pix_fmt}.yuv
310     run_avconv $DEC_OPTS -r 1 -f image2 -vcodec pgmyuv -i $raw_src \
311                $ENC_OPTS -f rawvideo -t 1 -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
312     do_avconv $file $DEC_OPTS -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
313                     $ENC_OPTS -f rawvideo -s 352x288 -pix_fmt yuv444p
314 done
315 fi