You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

303 lines
6.7KB

  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="${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 -i $pcm_src $ENC_OPTS -b:a 64k -t 1 -qscale:v 10 $2
  22. do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3
  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 "$@"
  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 $3 -t 0.5 -y -qscale 10 $target_path/$file
  44. do_md5sum ${outfile}02.$1
  45. do_avconv_crc $file $DEC_OPTS $3 -i $target_path/$file
  46. 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 -ab 64k"
  56. fi
  57. if [ -n "$do_asf" ] ; then
  58. do_lavf asf "-acodec mp2 -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"
  68. fi
  69. if [ -n "$do_mxf" ] ; then
  70. do_lavf_timecode mxf "-ar 48000 -bf 2"
  71. fi
  72. if [ -n "$do_mxf_d10" ]; then
  73. 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 -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_ts" ] ; then
  76. do_lavf ts "-ab 64k -mpegts_transport_stream_id 42"
  77. fi
  78. if [ -n "$do_swf" ] ; then
  79. do_lavf swf -an
  80. fi
  81. if [ -n "$do_ffm" ] ; then
  82. do_lavf ffm "-ab 64k"
  83. fi
  84. if [ -n "$do_flv_fmt" ] ; then
  85. do_lavf flv -an
  86. fi
  87. if [ -n "$do_mov" ] ; then
  88. do_lavf mov "-movflags +rtphint -acodec pcm_alaw -vcodec mpeg4"
  89. do_lavf_timecode mov "-acodec pcm_alaw -vcodec mpeg4"
  90. fi
  91. if [ -n "$do_ismv" ] ; then
  92. do_lavf_timecode ismv "-an -vcodec mpeg4"
  93. fi
  94. if [ -n "$do_dv_fmt" ] ; then
  95. do_lavf_timecode_nodrop dv "-ar 48000 -r 25 -s pal -ac 2"
  96. do_lavf_timecode_drop dv "-ar 48000 -pix_fmt yuv411p -s ntsc -ac 2"
  97. do_lavf dv "-ar 48000 -r 25 -s pal -ac 2"
  98. fi
  99. if [ -n "$do_gxf" ] ; then
  100. do_lavf_timecode_nodrop gxf "-ar 48000 -r 25 -s pal -ac 1"
  101. do_lavf_timecode_drop gxf "-ar 48000 -s ntsc -ac 1"
  102. do_lavf gxf "-ar 48000 -r 25 -s pal -ac 1"
  103. fi
  104. if [ -n "$do_nut" ] ; then
  105. do_lavf nut "-acodec mp2 -ab 64k"
  106. fi
  107. if [ -n "$do_mkv" ] ; then
  108. do_lavf mkv "-acodec mp2 -ab 64k -vcodec mpeg4"
  109. fi
  110. if [ -n "$do_ogg_vp3" ] ; then
  111. # -idct simple causes different results on different systems
  112. DEC_OPTS="$DEC_OPTS -idct auto"
  113. do_lavf_fate ogg "vp3/coeff_level64.mkv"
  114. fi
  115. if [ -n "$do_wtv" ] ; then
  116. do_lavf wtv "-acodec mp2"
  117. fi
  118. # streamed images
  119. # mjpeg
  120. #file=${outfile}lavf.mjpeg
  121. #do_avconv $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
  122. #do_avconv_crc $file -i $target_path/$file
  123. if [ -n "$do_pbmpipe" ] ; then
  124. do_streamed_images pbm
  125. fi
  126. if [ -n "$do_pgmpipe" ] ; then
  127. do_streamed_images pgm
  128. fi
  129. if [ -n "$do_ppmpipe" ] ; then
  130. do_streamed_images ppm
  131. fi
  132. if [ -n "$do_gif" ] ; then
  133. file=${outfile}lavf.gif
  134. do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10 -pix_fmt rgb24
  135. do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
  136. fi
  137. if [ -n "$do_yuv4mpeg" ] ; then
  138. file=${outfile}lavf.y4m
  139. do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10
  140. #do_avconv_crc $file -i $target_path/$file
  141. fi
  142. # image formats
  143. if [ -n "$do_pgm" ] ; then
  144. do_image_formats pgm
  145. fi
  146. if [ -n "$do_ppm" ] ; then
  147. do_image_formats ppm
  148. fi
  149. if [ -n "$do_png" ] ; then
  150. do_image_formats png
  151. do_image_formats png "-pix_fmt gray16be"
  152. do_image_formats png "-pix_fmt rgb48be"
  153. fi
  154. if [ -n "$do_bmp" ] ; then
  155. do_image_formats bmp
  156. fi
  157. if [ -n "$do_tga" ] ; then
  158. do_image_formats tga
  159. fi
  160. if [ -n "$do_tiff" ] ; then
  161. do_image_formats tiff "-pix_fmt rgb24"
  162. fi
  163. if [ -n "$do_sgi" ] ; then
  164. do_image_formats sgi
  165. fi
  166. if [ -n "$do_jpg" ] ; then
  167. do_image_formats jpg "-pix_fmt yuvj420p" "-f image2"
  168. fi
  169. if [ -n "$do_pam" ] ; then
  170. do_image_formats pam
  171. fi
  172. if [ -n "$do_pcx" ] ; then
  173. do_image_formats pcx
  174. fi
  175. if [ -n "$do_dpx" ] ; then
  176. do_image_formats dpx
  177. do_image_formats dpx "-pix_fmt rgb48le"
  178. do_image_formats dpx "-pix_fmt rgb48le -bits_per_raw_sample 10"
  179. fi
  180. if [ -n "$do_xwd" ] ; then
  181. do_image_formats xwd
  182. fi
  183. if [ -n "$do_sunrast" ] ; then
  184. do_image_formats sun
  185. fi
  186. # audio only
  187. if [ -n "$do_wav" ] ; then
  188. do_audio_only wav
  189. fi
  190. if [ -n "$do_alaw" ] ; then
  191. do_audio_only al "" "" "-ar 44100"
  192. fi
  193. if [ -n "$do_mulaw" ] ; then
  194. do_audio_only ul "" "" "-ar 44100"
  195. fi
  196. if [ -n "$do_au" ] ; then
  197. do_audio_only au
  198. fi
  199. if [ -n "$do_mmf" ] ; then
  200. do_audio_only mmf
  201. fi
  202. if [ -n "$do_aiff" ] ; then
  203. do_audio_only aif
  204. fi
  205. if [ -n "$do_voc" ] ; then
  206. do_audio_only voc
  207. fi
  208. if [ -n "$do_voc_s16" ] ; then
  209. do_audio_only s16.voc "-ac 2" "-acodec pcm_s16le"
  210. fi
  211. if [ -n "$do_ogg" ] ; then
  212. do_audio_only ogg
  213. fi
  214. if [ -n "$do_rso" ] ; then
  215. do_audio_only rso
  216. fi
  217. if [ -n "$do_sox" ] ; then
  218. do_audio_only sox
  219. fi
  220. if [ -n "$do_caf" ] ; then
  221. do_audio_only caf
  222. fi
  223. # pix_fmt conversions
  224. if [ -n "$do_pixfmt" ] ; then
  225. outfile="$datadir/pixfmt/"
  226. mkdir -p "$outfile"
  227. conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
  228. yuvj422p yuvj444p rgb24 bgr24 rgb32 rgb565 rgb555 gray monow \
  229. monob yuv440p yuvj440p"
  230. for pix_fmt in $conversions ; do
  231. file=${outfile}${pix_fmt}.yuv
  232. run_avconv $DEC_OPTS -r 1 -f image2 -vcodec pgmyuv -i $raw_src \
  233. $ENC_OPTS -f rawvideo -t 1 -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
  234. do_avconv $file $DEC_OPTS -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
  235. $ENC_OPTS -f rawvideo -s 352x288 -pix_fmt yuv444p
  236. done
  237. fi