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.

146 lines
3.1KB

  1. #!/bin/sh
  2. #
  3. # automatic regression test for ffmpeg
  4. #
  5. #
  6. #set -x
  7. set -e
  8. # tests to do
  9. if [ "$1" = "mpeg4" ] ; then
  10. do_mpeg4=y
  11. elif [ "$1" = "mpeg" ] ; then
  12. do_mpeg=y
  13. else
  14. do_mpeg=y
  15. do_msmpeg4=y
  16. do_h263=y
  17. do_mpeg4=y
  18. do_mjpeg=y
  19. #do_rv10=y #broken!
  20. do_mp2=y
  21. do_ac3=y
  22. fi
  23. # various files
  24. ffmpeg="../ffmpeg"
  25. outfile="/tmp/a-"
  26. reffile="$2"
  27. logfile="/tmp/ffmpeg.regression"
  28. benchfile="/tmp/ffmpeg.bench"
  29. raw_src="vsynth1/%d.pgm"
  30. raw_dst="/tmp/out.yuv"
  31. pcm_src="asynth1.sw"
  32. pcm_dst="/tmp/out.wav"
  33. function do_ffmpeg ()
  34. {
  35. f="$1"
  36. shift
  37. echo $ffmpeg $*
  38. $ffmpeg -benchmark $* > /tmp/bench.tmp
  39. md5sum $f >> $logfile
  40. expr match "`cat /tmp/bench.tmp`" '.*utime=\(.*s\)' > /tmp/bench2.tmp
  41. echo `cat /tmp/bench2.tmp` $f >> $benchfile
  42. }
  43. echo "ffmpeg regression test" > $logfile
  44. echo "ffmpeg benchmarks" > $benchfile
  45. ###################################
  46. if [ -n "$do_mpeg" ] ; then
  47. # mpeg1 encoding
  48. file=${outfile}mpeg1.mpg
  49. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpegvideo $file
  50. # mpeg1 decoding
  51. do_ffmpeg $raw_dst -y -f mpegvideo -i $file -f rawvideo $raw_dst
  52. # mpeg2 decoding
  53. #do_ffmpeg /tmp/out-mpeg2.yuv -y -f mpegvideo -i a.vob \
  54. # -f rawvideo /tmp/out-mpeg2.yuv
  55. fi
  56. ###################################
  57. if [ -n "$do_msmpeg4" ] ; then
  58. # msmpeg4 encoding
  59. file=${outfile}msmpeg4.avi
  60. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
  61. # msmpeg4 decoding
  62. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  63. fi
  64. ###################################
  65. if [ -n "$do_h263" ] ; then
  66. # h263 encoding
  67. file=${outfile}h263.avi
  68. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
  69. # h263p decoding
  70. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  71. fi
  72. ###################################
  73. if [ -n "$do_mpeg4" ] ; then
  74. # mpeg4
  75. file=${outfile}odivx.avi
  76. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  77. # mpeg4 decoding
  78. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  79. fi
  80. ###################################
  81. if [ -n "$do_mjpeg" ] ; then
  82. # mjpeg
  83. file=${outfile}mjpeg.avi
  84. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg $file
  85. # mjpeg decoding
  86. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  87. fi
  88. ###################################
  89. if [ -n "$do_rv10" ] ; then
  90. # rv10 encoding
  91. file=${outfile}rv10.rm
  92. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file
  93. # rv10 decoding
  94. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  95. fi
  96. ###################################
  97. if [ -n "$do_mp2" ] ; then
  98. # mp2 encoding
  99. file=${outfile}mp2.mp2
  100. do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
  101. # mp2 decoding
  102. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  103. fi
  104. ###################################
  105. if [ -n "$do_ac3" ] ; then
  106. # ac3 encoding
  107. file=${outfile}ac3.rm
  108. do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file
  109. # ac3 decoding
  110. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  111. fi
  112. if diff -u $logfile $reffile ; then
  113. echo
  114. echo Regression test succeeded.
  115. exit 0
  116. else
  117. echo
  118. echo Regression test: Error.
  119. exit 1
  120. fi