lavf-regression.sh 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. do_lavf()
  11. {
  12. file=${outfile}lavf.$1
  13. do_ffmpeg $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 $2
  14. do_ffmpeg_crc $file $DEC_OPTS -i $target_path/$file $3
  15. }
  16. do_streamed_images()
  17. {
  18. file=${outfile}${1}pipe.$1
  19. do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src -f image2pipe $ENC_OPTS -t 1 -qscale 10
  20. do_ffmpeg_crc $file $DEC_OPTS -f image2pipe -i $target_path/$file
  21. }
  22. do_image_formats()
  23. {
  24. outfile="$datadir/images/$1/"
  25. mkdir -p "$outfile"
  26. file=${outfile}%02d.$1
  27. run_ffmpeg $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $2 $ENC_OPTS $3 -t 0.5 -y -qscale 10 $target_path/$file
  28. do_md5sum ${outfile}02.$1 >> $logfile
  29. do_ffmpeg_crc $file $DEC_OPTS $3 -i $target_path/$file
  30. wc -c ${outfile}02.$1 >> $logfile
  31. }
  32. do_audio_only()
  33. {
  34. file=${outfile}lavf.$1
  35. do_ffmpeg $file $DEC_OPTS $2 -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 $3
  36. do_ffmpeg_crc $file $DEC_OPTS $4 -i $target_path/$file
  37. }
  38. rm -f "$logfile"
  39. if [ -n "$do_avi" ] ; then
  40. do_lavf avi
  41. fi
  42. if [ -n "$do_asf" ] ; then
  43. do_lavf asf "-acodec mp2" "-r 25"
  44. fi
  45. if [ -n "$do_rm" ] ; then
  46. file=${outfile}lavf.rm
  47. do_ffmpeg $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
  48. # broken
  49. #do_ffmpeg_crc $file -i $target_path/$file
  50. fi
  51. if [ -n "$do_mpg" ] ; then
  52. do_lavf mpg
  53. fi
  54. if [ -n "$do_mxf" ] ; then
  55. do_lavf mxf "-ar 48000 -bf 2 -timecode_frame_start 264363"
  56. fi
  57. if [ -n "$do_mxf_d10" ]; then
  58. do_lavf mxf_d10 "-ar 48000 -ac 2 -r 25 -s 720x576 -vf pad=720:608:0:32 -vcodec mpeg2video -intra -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"
  59. fi
  60. if [ -n "$do_ts" ] ; then
  61. do_lavf ts
  62. fi
  63. if [ -n "$do_swf" ] ; then
  64. do_lavf swf -an
  65. fi
  66. if [ -n "$do_ffm" ] ; then
  67. do_lavf ffm
  68. fi
  69. if [ -n "$do_flv_fmt" ] ; then
  70. do_lavf flv -an
  71. fi
  72. if [ -n "$do_mov" ] ; then
  73. do_lavf mov "-acodec pcm_alaw"
  74. fi
  75. if [ -n "$do_dv_fmt" ] ; then
  76. do_lavf dv "-ar 48000 -r 25 -s pal -ac 2"
  77. fi
  78. if [ -n "$do_gxf" ] ; then
  79. do_lavf gxf "-ar 48000 -r 25 -s pal -ac 1"
  80. fi
  81. if [ -n "$do_nut" ] ; then
  82. do_lavf nut "-acodec mp2"
  83. fi
  84. if [ -n "$do_mkv" ] ; then
  85. do_lavf mkv
  86. fi
  87. # streamed images
  88. # mjpeg
  89. #file=${outfile}lavf.mjpeg
  90. #do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
  91. #do_ffmpeg_crc $file -i $target_path/$file
  92. if [ -n "$do_pbmpipe" ] ; then
  93. do_streamed_images pbm
  94. fi
  95. if [ -n "$do_pgmpipe" ] ; then
  96. do_streamed_images pgm
  97. fi
  98. if [ -n "$do_ppmpipe" ] ; then
  99. do_streamed_images ppm
  100. fi
  101. if [ -n "$do_gif" ] ; then
  102. file=${outfile}lavf.gif
  103. do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10 -pix_fmt rgb24
  104. do_ffmpeg_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
  105. fi
  106. if [ -n "$do_yuv4mpeg" ] ; then
  107. file=${outfile}lavf.y4m
  108. do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10
  109. #do_ffmpeg_crc $file -i $target_path/$file
  110. fi
  111. # image formats
  112. if [ -n "$do_pgm" ] ; then
  113. do_image_formats pgm
  114. fi
  115. if [ -n "$do_ppm" ] ; then
  116. do_image_formats ppm
  117. fi
  118. if [ -n "$do_png" ] ; then
  119. do_image_formats png
  120. fi
  121. if [ -n "$do_bmp" ] ; then
  122. do_image_formats bmp
  123. fi
  124. if [ -n "$do_tga" ] ; then
  125. do_image_formats tga
  126. fi
  127. if [ -n "$do_tiff" ] ; then
  128. do_image_formats tiff "-pix_fmt rgb24"
  129. fi
  130. if [ -n "$do_sgi" ] ; then
  131. do_image_formats sgi
  132. fi
  133. if [ -n "$do_jpg" ] ; then
  134. do_image_formats jpg "-pix_fmt yuvj420p" "-f image2"
  135. fi
  136. if [ -n "$do_pcx" ] ; then
  137. do_image_formats pcx
  138. fi
  139. # audio only
  140. if [ -n "$do_wav" ] ; then
  141. do_audio_only wav
  142. fi
  143. if [ -n "$do_alaw" ] ; then
  144. do_audio_only al "" "" "-ar 44100"
  145. fi
  146. if [ -n "$do_mulaw" ] ; then
  147. do_audio_only ul "" "" "-ar 44100"
  148. fi
  149. if [ -n "$do_au" ] ; then
  150. do_audio_only au
  151. fi
  152. if [ -n "$do_mmf" ] ; then
  153. do_audio_only mmf
  154. fi
  155. if [ -n "$do_aiff" ] ; then
  156. do_audio_only aif
  157. fi
  158. if [ -n "$do_voc" ] ; then
  159. do_audio_only voc
  160. fi
  161. if [ -n "$do_voc_s16" ] ; then
  162. do_audio_only s16.voc "-ac 2" "-acodec pcm_s16le"
  163. fi
  164. if [ -n "$do_ogg" ] ; then
  165. do_audio_only ogg
  166. fi
  167. if [ -n "$do_rso" ] ; then
  168. do_audio_only rso
  169. fi
  170. # pix_fmt conversions
  171. if [ -n "$do_pixfmt" ] ; then
  172. outfile="$datadir/pixfmt/"
  173. mkdir -p "$outfile"
  174. conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
  175. yuvj422p yuvj444p rgb24 bgr24 rgb32 rgb565 rgb555 gray monow \
  176. monob yuv440p yuvj440p"
  177. for pix_fmt in $conversions ; do
  178. file=${outfile}${pix_fmt}.yuv
  179. run_ffmpeg $DEC_OPTS -r 1 -t 1 -f image2 -vcodec pgmyuv -i $raw_src \
  180. $ENC_OPTS -f rawvideo -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
  181. do_ffmpeg $file $DEC_OPTS -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
  182. $ENC_OPTS -f rawvideo -s 352x288 -pix_fmt yuv444p
  183. done
  184. fi