summaryrefslogtreecommitdiff
path: root/tests/lavf-regression.sh (plain)
blob: eda40f25dbb5f576797342a24e723ad57a0a2841
1#!/bin/sh
2#
3# automatic regression test for libavformat
4#
5#
6#set -x
7
8set -e
9
10. $(dirname $0)/regression-funcs.sh
11
12eval do_$test=y
13
14ENC_OPTS="$ENC_OPTS -metadata title=lavftest"
15
16do_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
24do_lavf()
25{
26 file=${outfile}lavf.$1
27 do_avconv $file $DEC_OPTS -f image2 -vcodec 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 do_avconv_crc $file $DEC_OPTS -i $target_path/$file $4
29}
30
31do_lavf_timecode_nodrop() { do_lavf $1 "" "$2 -timecode 02:56:14:13"; }
32do_lavf_timecode_drop() { do_lavf $1 "" "$2 -timecode 02:56:14.13 -r 30000/1001"; }
33
34do_lavf_timecode()
35{
36 do_lavf_timecode_nodrop "$@"
37 do_lavf_timecode_drop "$@"
38 do_lavf $1 "" "$2"
39}
40
41do_streamed_images()
42{
43 file=${outfile}${1}pipe.$1
44 do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src -f image2pipe $ENC_OPTS -t 1 -qscale 10
45 do_avconv_crc $file $DEC_OPTS -f image2pipe -i $target_path/$file
46}
47
48do_image_formats()
49{
50 outfile="$datadir/images/$1/"
51 mkdir -p "$outfile"
52 file=${outfile}%02d.$1
53 run_avconv $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $2 $ENC_OPTS -frames 13 -y -qscale 10 $target_path/$file
54 do_md5sum ${outfile}02.$1
55 do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3
56 echo $(wc -c ${outfile}02.$1)
57}
58
59do_audio_only()
60{
61 file=${outfile}lavf.$1
62 do_avconv $file $DEC_OPTS $2 -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 $3
63 do_avconv_crc $file $DEC_OPTS $4 -i $target_path/$file
64}
65
66if [ -n "$do_avi" ] ; then
67do_lavf avi "" "-acodec mp2 -ar 44100 -ab 64k -threads 1"
68fi
69
70if [ -n "$do_asf" ] ; then
71do_lavf asf "" "-acodec mp2 -ar 44100 -ab 64k" "-r 25"
72fi
73
74if [ -n "$do_rm" ] ; then
75file=${outfile}lavf.rm
76do_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
77# broken
78#do_avconv_crc $file -i $target_path/$file
79fi
80
81if [ -n "$do_mpg" ] ; then
82do_lavf_timecode mpg "-ab 64k -ar 44100 -threads 1"
83fi
84
85if [ -n "$do_mxf" ] ; then
86do_lavf_timecode mxf "-ar 48000 -bf 2 -threads 1"
87fi
88
89if [ -n "$do_mxf_d10" ]; then
90do_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"
91fi
92
93if [ -n "$do_mxf_opatom" ]; then
94do_lavf mxf_opatom "" "-s 1920x1080 -vcodec dnxhd -pix_fmt yuv422p -vb 36M -f mxf_opatom -map 0"
95fi
96
97if [ -n "$do_mxf_opatom_audio" ]; then
98do_lavf mxf_opatom_audio "-ar 48000 -ac 1" "-f mxf_opatom -mxf_audio_edit_rate 25 -map 1"
99fi
100
101if [ -n "$do_ts" ] ; then
102do_lavf ts "" "-ab 64k -mpegts_transport_stream_id 42 -ar 44100 -threads 1"
103fi
104
105if [ -n "$do_swf" ] ; then
106do_lavf swf "" "-an"
107fi
108
109if [ -n "$do_ffm" ] ; then
110do_lavf ffm "" "-ar 44100 -threads 1"
111fi
112
113if [ -n "$do_flm" ] ; then
114do_lavf flm "" "-pix_fmt rgba"
115fi
116
117if [ -n "$do_flv_fmt" ] ; then
118do_lavf flv "" "-an"
119fi
120
121if [ -n "$do_mov" ] ; then
122mov_common_opt="-acodec pcm_alaw -vcodec mpeg4 -threads 1"
123do_lavf mov "" "-movflags +rtphint $mov_common_opt"
124do_lavf_timecode mov "-movflags +faststart $mov_common_opt"
125do_lavf_timecode mp4 "-vcodec mpeg4 -an -threads 1"
126fi
127
128if [ -n "$do_ismv" ] ; then
129do_lavf_timecode ismv "-an -vcodec mpeg4 -threads 1"
130fi
131
132if [ -n "$do_dv_fmt" ] ; then
133do_lavf_timecode_nodrop dv "-ar 48000 -r 25 -s pal -ac 2"
134do_lavf_timecode_drop dv "-ar 48000 -pix_fmt yuv411p -s ntsc -ac 2"
135do_lavf dv "-ar 48000 -channel_layout stereo" "-r 25 -s pal"
136fi
137
138if [ -n "$do_gxf" ] ; then
139do_lavf_timecode_nodrop gxf "-ar 48000 -r 25 -s pal -ac 1 -threads 1"
140do_lavf_timecode_drop gxf "-ar 48000 -s ntsc -ac 1 -threads 1"
141do_lavf gxf "-ar 48000" "-r 25 -s pal -ac 1 -threads 1"
142fi
143
144if [ -n "$do_nut" ] ; then
145do_lavf nut "" "-acodec mp2 -ab 64k -ar 44100 -threads 1"
146fi
147
148if [ -n "$do_mka" ] ; then
149do_audio_only mka "" "-c:a tta"
150fi
151
152if [ -n "$do_mkv" ] ; then
153do_lavf mkv "" "-acodec mp2 -ab 64k -vcodec mpeg4 \
154 -attach ${raw_src%/*}/00.pgm -metadata:s:t mimetype=image/x-portable-greymap -threads 1"
155do_lavf mkv "" "-acodec mp2 -ab 64k -vcodec mpeg4 -ar 44100 -threads 1"
156fi
157
158if [ -n "$do_mp3" ] ; then
159do_lavf_fate mp3 "mp3-conformance/he_32khz.bit" "-acodec copy"
160fi
161
162if [ -n "$do_latm" ] ; then
163do_lavf_fate latm "aac/al04_44.mp4" "-acodec copy"
164fi
165
166if [ -n "$do_ogg_vp3" ] ; then
167# -idct simple causes different results on different systems
168DEC_OPTS="$DEC_OPTS -idct auto"
169do_lavf_fate ogg "vp3/coeff_level64.mkv"
170fi
171
172if [ -n "$do_ogg_vp8" ] ; then
173do_lavf_fate ogv "vp8/RRSF49-short.webm" "-acodec copy"
174fi
175
176if [ -n "$do_mov_qtrle_mace6" ] ; then
177DEC_OPTS="$DEC_OPTS -idct auto"
178do_lavf_fate mov "qtrle/Animation-16Greys.mov"
179fi
180
181if [ -n "$do_avi_cram" ] ; then
182DEC_OPTS="$DEC_OPTS -idct auto"
183do_lavf_fate avi "cram/toon.avi"
184fi
185
186if [ -n "$do_wtv" ] ; then
187do_lavf wtv "" "-acodec mp2 -threads 1"
188fi
189
190
191# streamed images
192# mjpeg
193#file=${outfile}lavf.mjpeg
194#do_avconv $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
195#do_avconv_crc $file -i $target_path/$file
196
197if [ -n "$do_pbmpipe" ] ; then
198do_streamed_images pbm
199fi
200
201if [ -n "$do_pgmpipe" ] ; then
202do_streamed_images pgm
203fi
204
205if [ -n "$do_ppmpipe" ] ; then
206do_streamed_images ppm
207fi
208
209if [ -n "$do_gif" ] ; then
210file=${outfile}lavf.gif
211do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10 -pix_fmt rgb24
212do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
213fi
214
215if [ -n "$do_apng" ] ; then
216file=${outfile}lavf.apng
217do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -pix_fmt rgb24
218do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
219file_copy=${outfile}lavf.copy.apng
220do_avconv $file_copy $DEC_OPTS -i $file $ENC_OPTS -c copy
221do_avconv_crc $file_copy $DEC_OPTS -i $target_path/$file_copy
222file=${outfile}lavf.png
223do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -pix_fmt rgb24 -frames:v 1 -f apng
224do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
225fi
226
227if [ -n "$do_yuv4mpeg" ] ; then
228file=${outfile}lavf.y4m
229do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10
230#do_avconv_crc $file -i $target_path/$file
231fi
232
233# image formats
234
235if [ -n "$do_pgm" ] ; then
236do_image_formats pgm
237fi
238
239if [ -n "$do_ppm" ] ; then
240do_image_formats ppm
241fi
242
243if [ -n "$do_png" ] ; then
244do_image_formats png
245do_image_formats png "-pix_fmt gray16be"
246do_image_formats png "-pix_fmt rgb48be"
247fi
248
249if [ -n "$do_xbm" ] ; then
250do_image_formats xbm
251fi
252
253if [ -n "$do_bmp" ] ; then
254do_image_formats bmp
255fi
256
257if [ -n "$do_tga" ] ; then
258do_image_formats tga
259fi
260
261if [ -n "$do_tiff" ] ; then
262do_image_formats tiff "-pix_fmt rgb24"
263fi
264
265if [ -n "$do_sgi" ] ; then
266do_image_formats sgi
267fi
268
269if [ -n "$do_jpg" ] ; then
270do_image_formats jpg "-pix_fmt yuvj420p"
271fi
272
273if [ -n "$do_pam" ] ; then
274do_image_formats pam
275do_image_formats pam "-pix_fmt rgba"
276do_image_formats pam "-pix_fmt gray"
277do_image_formats pam "-pix_fmt gray16be" "-pix_fmt gray16be"
278do_image_formats pam "-pix_fmt rgb48be" "-pix_fmt rgb48be"
279do_image_formats pam "-pix_fmt monob"
280fi
281
282if [ -n "$do_pcx" ] ; then
283do_image_formats pcx
284fi
285
286if [ -n "$do_dpx" ] ; then
287do_image_formats dpx
288do_image_formats dpx "-pix_fmt gbrp10le" "-pix_fmt gbrp10le"
289do_image_formats dpx "-pix_fmt gbrp12le" "-pix_fmt gbrp12le"
290do_image_formats dpx "-pix_fmt rgb48le"
291do_image_formats dpx "-pix_fmt rgb48le -bits_per_raw_sample 10" "-pix_fmt rgb48le"
292do_image_formats dpx "-pix_fmt rgba64le"
293fi
294
295if [ -n "$do_xwd" ] ; then
296do_image_formats xwd
297do_image_formats xwd "-pix_fmt rgba"
298do_image_formats xwd "-pix_fmt rgb565be"
299do_image_formats xwd "-pix_fmt rgb555be"
300do_image_formats xwd "-pix_fmt rgb8"
301do_image_formats xwd "-pix_fmt rgb4_byte"
302do_image_formats xwd "-pix_fmt gray"
303do_image_formats xwd "-pix_fmt monow"
304fi
305
306if [ -n "$do_sunrast" ] ; then
307do_image_formats sun
308fi
309
310# audio only
311
312if [ -n "$do_wav" ] ; then
313do_audio_only wav
314fi
315
316if [ -n "$do_wav_peak" ] ; then
317do_audio_only peak.wav "" "-write_peak on"
318fi
319
320if [ -n "$do_wav_peak_only" ] ; then
321file=${outfile}lavf.peak_only.wav
322do_avconv $file $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 -write_peak only
323fi
324
325if [ -n "$do_alaw" ] ; then
326do_audio_only al "" "" "-ar 44100"
327fi
328
329if [ -n "$do_mulaw" ] ; then
330do_audio_only ul "" "" "-ar 44100"
331fi
332
333if [ -n "$do_au" ] ; then
334do_audio_only au
335fi
336
337if [ -n "$do_mmf" ] ; then
338do_audio_only mmf
339fi
340
341if [ -n "$do_aiff" ] ; then
342do_audio_only aif
343fi
344
345if [ -n "$do_voc" ] ; then
346do_audio_only voc "" "-acodec pcm_u8"
347fi
348
349if [ -n "$do_voc_s16" ] ; then
350do_audio_only s16.voc "-ac 2" "-acodec pcm_s16le"
351fi
352
353if [ -n "$do_ogg" ] ; then
354do_audio_only ogg "" "-c:a flac"
355fi
356
357if [ -n "$do_rso" ] ; then
358do_audio_only rso
359fi
360
361if [ -n "$do_smjpeg" ] ; then
362do_lavf smjpeg "" "-f smjpeg"
363fi
364
365if [ -n "$do_sox" ] ; then
366do_audio_only sox
367fi
368
369if [ -n "$do_tta" ] ; then
370do_audio_only tta
371fi
372
373if [ -n "$do_caf" ] ; then
374do_audio_only caf
375fi
376
377if [ -n "$do_ast" ] ; then
378do_audio_only ast "-ac 2" "-loopstart 1 -loopend 10"
379fi
380
381if [ -n "$do_ircam" ] ; then
382do_audio_only ircam
383fi
384
385if [ -n "$do_w64" ] ; then
386do_audio_only w64
387fi
388
389if [ -n "$do_wv" ] ; then
390do_audio_only wv
391fi
392
393# pix_fmt conversions
394
395if [ -n "$do_pixfmt" ] ; then
396outfile="$datadir/pixfmt/"
397mkdir -p "$outfile"
398conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
399 yuvj422p yuvj444p rgb24 bgr24 rgb32 rgb565 rgb555 gray monow \
400 monob yuv440p yuvj440p"
401for pix_fmt in $conversions ; do
402 file=${outfile}${pix_fmt}.yuv
403 run_avconv $DEC_OPTS -r 1 -f image2 -vcodec pgmyuv -i $raw_src \
404 $ENC_OPTS -f rawvideo -t 1 -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
405 do_avconv $file $DEC_OPTS -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
406 $ENC_OPTS -f rawvideo -s 352x288 -pix_fmt yuv444p
407done
408fi
409