lavf-regression.sh 11 KB

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