]> git.sesse.net Git - ffmpeg/blob - tests/lavf-regression.sh
Merge remote-tracking branch 'qatar/master'
[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()
17 {
18     file=${outfile}lavf.$1
19     do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -b:a 64k -t 1 -qscale:v 10 $2
20     do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3
21 }
22
23 do_streamed_images()
24 {
25     file=${outfile}${1}pipe.$1
26     do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src -f image2pipe $ENC_OPTS -t 1 -qscale 10
27     do_avconv_crc $file $DEC_OPTS -f image2pipe -i $target_path/$file
28 }
29
30 do_image_formats()
31 {
32     outfile="$datadir/images/$1/"
33     mkdir -p "$outfile"
34     file=${outfile}%02d.$1
35     run_avconv $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $2 $ENC_OPTS $3 -t 0.5 -y -qscale 10 $target_path/$file
36     do_md5sum ${outfile}02.$1
37     do_avconv_crc $file $DEC_OPTS $3 -i $target_path/$file
38     wc -c ${outfile}02.$1
39 }
40
41 do_audio_only()
42 {
43     file=${outfile}lavf.$1
44     do_avconv $file $DEC_OPTS $2 -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 $3
45     do_avconv_crc $file $DEC_OPTS $4 -i $target_path/$file
46 }
47
48 if [ -n "$do_avi" ] ; then
49 do_lavf avi "-acodec mp2 -ab 64k"
50 fi
51
52 if [ -n "$do_asf" ] ; then
53 do_lavf asf "-acodec mp2 -ab 64k" "-r 25"
54 fi
55
56 if [ -n "$do_rm" ] ; then
57 file=${outfile}lavf.rm
58 do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 -acodec ac3_fixed -ab 64k
59 # broken
60 #do_avconv_crc $file -i $target_path/$file
61 fi
62
63 if [ -n "$do_mpg" ] ; then
64 do_lavf mpg "-ab 64k"
65 fi
66
67 if [ -n "$do_mxf" ] ; then
68 do_lavf mxf "-ar 48000 -bf 2 -timecode 02:56:14:13"
69 fi
70
71 if [ -n "$do_mxf_d10" ]; then
72 do_lavf mxf_d10 "-ar 48000 -ac 2 -r 25 -s 720x576 -vf pad=720:608:0:32 -vcodec mpeg2video -g 0 -flags +ildct+low_delay -dc 10 -flags2 +ivlc+non_linear_q -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"
73 fi
74
75 if [ -n "$do_ts" ] ; then
76 do_lavf ts "-ab 64k -mpegts_transport_stream_id 42"
77 fi
78
79 if [ -n "$do_swf" ] ; then
80 do_lavf swf -an
81 fi
82
83 if [ -n "$do_ffm" ] ; then
84 do_lavf ffm "-ab 64k"
85 fi
86
87 if [ -n "$do_flv_fmt" ] ; then
88 do_lavf flv -an
89 fi
90
91 if [ -n "$do_mov" ] ; then
92 do_lavf mov "-acodec pcm_alaw -vcodec mpeg4"
93 fi
94
95 if [ -n "$do_dv_fmt" ] ; then
96 do_lavf dv "-ar 48000 -r 25 -s pal -ac 2"
97 fi
98
99 if [ -n "$do_gxf" ] ; then
100 do_lavf gxf "-ar 48000 -r 25 -s pal -ac 1"
101 fi
102
103 if [ -n "$do_nut" ] ; then
104 do_lavf nut "-acodec mp2 -ab 64k"
105 fi
106
107 if [ -n "$do_mkv" ] ; then
108 do_lavf mkv "-acodec mp2 -ab 64k -vcodec mpeg4"
109 fi
110
111 if [ -n "$do_wtv" ] ; then
112 do_lavf wtv "-acodec mp2"
113 fi
114
115
116 # streamed images
117 # mjpeg
118 #file=${outfile}lavf.mjpeg
119 #do_avconv $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
120 #do_avconv_crc $file -i $target_path/$file
121
122 if [ -n "$do_pbmpipe" ] ; then
123 do_streamed_images pbm
124 fi
125
126 if [ -n "$do_pgmpipe" ] ; then
127 do_streamed_images pgm
128 fi
129
130 if [ -n "$do_ppmpipe" ] ; then
131 do_streamed_images ppm
132 fi
133
134 if [ -n "$do_gif" ] ; then
135 file=${outfile}lavf.gif
136 do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10 -pix_fmt rgb24
137 do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
138 fi
139
140 if [ -n "$do_yuv4mpeg" ] ; then
141 file=${outfile}lavf.y4m
142 do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10
143 #do_avconv_crc $file -i $target_path/$file
144 fi
145
146 # image formats
147
148 if [ -n "$do_pgm" ] ; then
149 do_image_formats pgm
150 fi
151
152 if [ -n "$do_ppm" ] ; then
153 do_image_formats ppm
154 fi
155
156 if [ -n "$do_png" ] ; then
157 do_image_formats png
158 fi
159
160 if [ -n "$do_bmp" ] ; then
161 do_image_formats bmp
162 fi
163
164 if [ -n "$do_tga" ] ; then
165 do_image_formats tga
166 fi
167
168 if [ -n "$do_tiff" ] ; then
169 do_image_formats tiff "-pix_fmt rgb24"
170 fi
171
172 if [ -n "$do_sgi" ] ; then
173 do_image_formats sgi
174 fi
175
176 if [ -n "$do_jpg" ] ; then
177 do_image_formats jpg "-pix_fmt yuvj420p" "-f image2"
178 fi
179
180 if [ -n "$do_pcx" ] ; then
181 do_image_formats pcx
182 fi
183
184 # audio only
185
186 if [ -n "$do_wav" ] ; then
187 do_audio_only wav
188 fi
189
190 if [ -n "$do_alaw" ] ; then
191 do_audio_only al "" "" "-ar 44100"
192 fi
193
194 if [ -n "$do_mulaw" ] ; then
195 do_audio_only ul "" "" "-ar 44100"
196 fi
197
198 if [ -n "$do_au" ] ; then
199 do_audio_only au
200 fi
201
202 if [ -n "$do_mmf" ] ; then
203 do_audio_only mmf
204 fi
205
206 if [ -n "$do_aiff" ] ; then
207 do_audio_only aif
208 fi
209
210 if [ -n "$do_voc" ] ; then
211 do_audio_only voc
212 fi
213
214 if [ -n "$do_voc_s16" ] ; then
215 do_audio_only s16.voc "-ac 2" "-acodec pcm_s16le"
216 fi
217
218 if [ -n "$do_ogg" ] ; then
219 do_audio_only ogg
220 fi
221
222 if [ -n "$do_rso" ] ; then
223 do_audio_only rso
224 fi
225
226 if [ -n "$do_sox" ] ; then
227 do_audio_only sox
228 fi
229
230 if [ -n "$do_caf" ] ; then
231 do_audio_only caf
232 fi
233
234 # pix_fmt conversions
235
236 if [ -n "$do_pixfmt" ] ; then
237 outfile="$datadir/pixfmt/"
238 mkdir -p "$outfile"
239 conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
240              yuvj422p yuvj444p rgb24 bgr24 rgb32 rgb565 rgb555 gray monow \
241              monob yuv440p yuvj440p"
242 for pix_fmt in $conversions ; do
243     file=${outfile}${pix_fmt}.yuv
244     run_avconv $DEC_OPTS -r 1 -f image2 -vcodec pgmyuv -i $raw_src \
245                $ENC_OPTS -f rawvideo -t 1 -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
246     do_avconv $file $DEC_OPTS -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
247                     $ENC_OPTS -f rawvideo -s 352x288 -pix_fmt yuv444p
248 done
249 fi