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.

772 lines
21KB

  1. #!/bin/sh
  2. #
  3. # automatic regression test for ffmpeg
  4. #
  5. #
  6. #set -x
  7. # Even in the 21st century some diffs are not supporting -u.
  8. diff -u "$0" "$0" > /dev/null 2>&1
  9. if [ $? -eq 0 ]; then
  10. diff_cmd="diff -u"
  11. else
  12. diff_cmd="diff"
  13. fi
  14. diff -w "$0" "$0" > /dev/null 2>&1
  15. if [ $? -eq 0 ]; then
  16. diff_cmd="$diff_cmd -w"
  17. fi
  18. set -e
  19. datadir="./data"
  20. logfile="$datadir/ffmpeg.regression"
  21. outfile="$datadir/a-"
  22. # tests to do
  23. if [ "$1" = "mpeg4" ] ; then
  24. do_mpeg4=y
  25. elif [ "$1" = "mpeg" ] ; then
  26. do_mpeg=y
  27. do_mpeg2=y
  28. elif [ "$1" = "ac3" ] ; then
  29. do_ac3=y
  30. elif [ "$1" = "huffyuv" ] ; then
  31. do_huffyuv=y
  32. elif [ "$1" = "mpeg2thread" ] ; then
  33. do_mpeg2thread=y
  34. elif [ "$1" = "snow" ] ; then
  35. do_snow=y
  36. elif [ "$1" = "snowll" ] ; then
  37. do_snowll=y
  38. elif [ "$1" = "libavtest" ] ; then
  39. do_libav=y
  40. logfile="$datadir/libav.regression"
  41. outfile="$datadir/b-"
  42. else
  43. do_mpeg=y
  44. do_mpeg2=y
  45. do_mpeg2thread=y
  46. do_msmpeg4v2=y
  47. do_msmpeg4=y
  48. do_wmv1=y
  49. do_wmv2=y
  50. do_h261=y
  51. do_h263=y
  52. do_h263p=y
  53. do_mpeg4=y
  54. do_mp4psp=y
  55. do_huffyuv=y
  56. do_mjpeg=y
  57. do_ljpeg=y
  58. do_jpegls=y
  59. do_rv10=y
  60. do_rv20=y
  61. do_mp2=y
  62. do_ac3=y
  63. do_g726=y
  64. do_adpcm_ima_wav=y
  65. do_adpcm_ms=y
  66. do_rc=y
  67. do_mpeg4adv=y
  68. do_mpeg4thread=y
  69. do_mpeg4nr=y
  70. do_mpeg1b=y
  71. do_asv1=y
  72. do_asv2=y
  73. do_flv=y
  74. do_ffv1=y
  75. do_error=y
  76. do_svq1=y
  77. do_snow=y
  78. do_snowll=y
  79. do_adpcm_yam=y
  80. do_dv=y
  81. do_dv50=y
  82. fi
  83. # various files
  84. ffmpeg="../ffmpeg_g"
  85. tiny_psnr="./tiny_psnr"
  86. reffile="$2"
  87. benchfile="$datadir/ffmpeg.bench"
  88. raw_src="$3/%02d.pgm"
  89. raw_dst="$datadir/out.yuv"
  90. raw_ref="$datadir/ref.yuv"
  91. pcm_src="asynth1.sw"
  92. pcm_dst="$datadir/out.wav"
  93. pcm_ref="$datadir/ref.wav"
  94. if [ X"`echo | md5sum 2> /dev/null`" != X ]; then
  95. do_md5sum() { md5sum -b $1; }
  96. elif [ -x /sbin/md5 ]; then
  97. do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
  98. else
  99. do_md5sum() { echo No md5sum program found; }
  100. fi
  101. # create the data directory if it does not exists
  102. mkdir -p $datadir
  103. do_ffmpeg()
  104. {
  105. f="$1"
  106. shift
  107. echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $*
  108. $ffmpeg -y -flags +bitexact -dct fastint -idct simple -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
  109. egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
  110. rm -f /tmp/ffmpeg$$
  111. do_md5sum $f >> $logfile
  112. if [ $f = $raw_dst ] ; then
  113. $tiny_psnr $f $raw_ref >> $logfile
  114. elif [ $f = $pcm_dst ] ; then
  115. $tiny_psnr $f $pcm_ref 2 >> $logfile
  116. else
  117. wc -c $f >> $logfile
  118. fi
  119. expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
  120. echo `cat $datadir/bench2.tmp` $f >> $benchfile
  121. }
  122. do_ffmpeg_crc()
  123. {
  124. f="$1"
  125. shift
  126. echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $* -f crc $datadir/ffmpeg.crc
  127. $ffmpeg -y -flags +bitexact -dct fastint -idct simple $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1
  128. egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:|ffmpeg version| configuration| built)" /tmp/ffmpeg$$ || true
  129. rm -f /tmp/ffmpeg$$
  130. echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile
  131. }
  132. do_ffmpeg_nocheck()
  133. {
  134. f="$1"
  135. shift
  136. echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $*
  137. $ffmpeg -y -flags +bitexact -dct fastint -idct simple -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
  138. egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
  139. rm -f /tmp/ffmpeg$$
  140. expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
  141. echo `cat $datadir/bench2.tmp` $f >> $benchfile
  142. }
  143. echo "ffmpeg regression test" > $logfile
  144. echo "ffmpeg benchmarks" > $benchfile
  145. ###################################
  146. # generate reference for quality check
  147. do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
  148. do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
  149. ###################################
  150. if [ -n "$do_mpeg" ] ; then
  151. # mpeg1 encoding
  152. file=${outfile}mpeg1.mpg
  153. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file
  154. # mpeg1 decoding
  155. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  156. fi
  157. ###################################
  158. if [ -n "$do_mpeg2" ] ; then
  159. # mpeg2 encoding
  160. file=${outfile}mpeg2.mpg
  161. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video $file
  162. # mpeg2 decoding
  163. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  164. # mpeg2 encoding using intra vlc
  165. file=${outfile}mpeg2ivlc.mpg
  166. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -flags2 +ivlc $file
  167. # mpeg2 decoding
  168. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  169. # mpeg2 encoding
  170. file=${outfile}mpeg2.mpg
  171. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -idct int -dct int -f mpeg1video $file
  172. # mpeg2 decoding
  173. do_ffmpeg $raw_dst -y -idct int -i $file -f rawvideo $raw_dst
  174. # mpeg2 encoding interlaced
  175. file=${outfile}mpeg2i.mpg
  176. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -flags +ildct+ilme $file
  177. # mpeg2 decoding
  178. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  179. fi
  180. ###################################
  181. if [ -n "$do_mpeg2thread" ] ; then
  182. # mpeg2 encoding interlaced
  183. file=${outfile}mpeg2thread.mpg
  184. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2 $file
  185. # mpeg2 decoding
  186. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  187. # mpeg2 encoding interlaced using intra vlc
  188. file=${outfile}mpeg2threadivlc.mpg
  189. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2 $file
  190. # mpeg2 decoding
  191. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  192. # mpeg2 encoding interlaced
  193. file=${outfile}mpeg2reuse.mpg
  194. do_ffmpeg $file -y -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4 $file
  195. # mpeg2 decoding
  196. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  197. fi
  198. ###################################
  199. if [ -n "$do_msmpeg4v2" ] ; then
  200. # msmpeg4 encoding
  201. file=${outfile}msmpeg4v2.avi
  202. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file
  203. # msmpeg4v2 decoding
  204. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  205. fi
  206. ###################################
  207. if [ -n "$do_msmpeg4" ] ; then
  208. # msmpeg4 encoding
  209. file=${outfile}msmpeg4.avi
  210. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
  211. # msmpeg4 decoding
  212. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  213. fi
  214. ###################################
  215. if [ -n "$do_wmv1" ] ; then
  216. # wmv1 encoding
  217. file=${outfile}wmv1.avi
  218. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file
  219. # wmv1 decoding
  220. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  221. fi
  222. ###################################
  223. if [ -n "$do_wmv2" ] ; then
  224. # wmv2 encoding
  225. file=${outfile}wmv2.avi
  226. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv2 $file
  227. # wmv2 decoding
  228. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  229. fi
  230. ###################################
  231. if [ -n "$do_h261" ] ; then
  232. # h261 encoding
  233. file=${outfile}h261.avi
  234. do_ffmpeg $file -y -qscale 11 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h261 $file
  235. # h261 decoding
  236. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  237. fi
  238. ###################################
  239. if [ -n "$do_h263" ] ; then
  240. # h263 encoding
  241. file=${outfile}h263.avi
  242. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
  243. # h263 decoding
  244. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  245. fi
  246. ###################################
  247. if [ -n "$do_h263p" ] ; then
  248. # h263p encoding
  249. file=${outfile}h263p.avi
  250. do_ffmpeg $file -y -qscale 2 -flags +umv+aiv+aic -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file
  251. # h263p decoding
  252. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  253. fi
  254. ###################################
  255. if [ -n "$do_mpeg4" ] ; then
  256. # mpeg4
  257. file=${outfile}odivx.mp4
  258. do_ffmpeg $file -y -flags +mv4 -mbd bits -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  259. # mpeg4 decoding
  260. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  261. fi
  262. ###################################
  263. if [ -n "$do_huffyuv" ] ; then
  264. # huffyuv
  265. file=${outfile}huffyuv.avi
  266. do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec huffyuv -pix_fmt yuv422p $file
  267. # huffyuv decoding
  268. do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -2 -pix_fmt yuv420p $raw_dst
  269. fi
  270. ###################################
  271. if [ -n "$do_rc" ] ; then
  272. # mpeg4 rate control
  273. file=${outfile}mpeg4-rc.avi
  274. do_ffmpeg $file -y -b 400 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  275. # mpeg4 rate control decoding
  276. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  277. fi
  278. ###################################
  279. if [ -n "$do_mpeg4adv" ] ; then
  280. # mpeg4
  281. file=${outfile}mpeg4-adv.avi
  282. do_ffmpeg $file -y -qscale 9 -flags +mv4+part+aic+trell -mbd bits -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  283. # mpeg4 decoding
  284. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  285. fi
  286. ###################################
  287. if [ -n "$do_mpeg4thread" ] ; then
  288. # mpeg4
  289. file=${outfile}mpeg4-thread.avi
  290. do_ffmpeg $file -y -b 500 -flags +mv4+part+aic+trell -mbd bits -ps 200 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file
  291. # mpeg4 decoding
  292. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  293. fi
  294. ###################################
  295. if [ -n "$do_mpeg4adv" ] ; then
  296. # mpeg4
  297. file=${outfile}mpeg4-Q.avi
  298. do_ffmpeg $file -y -qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  299. # mpeg4 decoding
  300. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  301. fi
  302. ###################################
  303. if [ -n "$do_mp4psp" ] ; then
  304. # mp4 PSP style
  305. file=${outfile}mpeg4-PSP.mp4
  306. do_ffmpeg $file -y -b 768 -s 320x240 -f psp -ar 24000 -ab 32 -i $raw_src $file
  307. fi
  308. ###################################
  309. if [ -n "$do_error" ] ; then
  310. # damaged mpeg4
  311. file=${outfile}error-mpeg4-adv.avi
  312. do_ffmpeg $file -y -qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  313. # damaged mpeg4 decoding
  314. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  315. fi
  316. ###################################
  317. if [ -n "$do_mpeg4nr" ] ; then
  318. # noise reduction
  319. file=${outfile}mpeg4-nr.avi
  320. do_ffmpeg $file -y -qscale 8 -flags +mv4 -mbd rd -nr 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  321. # mpeg4 decoding
  322. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  323. fi
  324. ###################################
  325. if [ -n "$do_mpeg1b" ] ; then
  326. # mpeg1
  327. file=${outfile}mpeg1b.mpg
  328. do_ffmpeg $file -y -qscale 8 -bf 3 -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg1video -f mpeg1video $file
  329. # mpeg1 decoding
  330. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  331. fi
  332. ###################################
  333. if [ -n "$do_mjpeg" ] ; then
  334. # mjpeg
  335. file=${outfile}mjpeg.avi
  336. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg -pix_fmt yuvj420p $file
  337. # mjpeg decoding
  338. do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
  339. fi
  340. ###################################
  341. if [ -n "$do_ljpeg" ] ; then
  342. # ljpeg
  343. file=${outfile}ljpeg.avi
  344. do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec ljpeg -strict -1 $file
  345. # ljpeg decoding
  346. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  347. fi
  348. ###################################
  349. if [ -n "$do_jpegls" ] ; then
  350. # jpeg ls
  351. file=${outfile}jpegls.avi
  352. do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec jpegls -vtag MJPG $file
  353. # jpeg ls decoding
  354. do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
  355. fi
  356. ###################################
  357. if [ -n "$do_rv10" ] ; then
  358. # rv10 encoding
  359. file=${outfile}rv10.rm
  360. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file
  361. # rv10 decoding
  362. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  363. fi
  364. ###################################
  365. if [ -n "$do_rv20" ] ; then
  366. # rv20 encoding
  367. file=${outfile}rv20.rm
  368. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec rv20 -an $file
  369. # rv20 decoding
  370. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  371. fi
  372. ###################################
  373. if [ -n "$do_asv1" ] ; then
  374. # asv1 encoding
  375. file=${outfile}asv1.avi
  376. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv1 $file
  377. # asv1 decoding
  378. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  379. fi
  380. ###################################
  381. if [ -n "$do_asv2" ] ; then
  382. # asv2 encoding
  383. file=${outfile}asv2.avi
  384. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv2 $file
  385. # asv2 decoding
  386. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  387. fi
  388. ###################################
  389. if [ -n "$do_flv" ] ; then
  390. # flv encoding
  391. file=${outfile}flv.flv
  392. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec flv $file
  393. # flv decoding
  394. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  395. fi
  396. ###################################
  397. if [ -n "$do_ffv1" ] ; then
  398. # ffv1 encoding
  399. file=${outfile}ffv1.avi
  400. do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec ffv1 $file
  401. # ffv1 decoding
  402. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  403. fi
  404. ###################################
  405. if [ -n "$do_snow" ] ; then
  406. # snow encoding
  407. file=${outfile}snow.avi
  408. do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -qscale 2 -flags +qpel -me iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64 $file
  409. # snow decoding
  410. do_ffmpeg $raw_dst -y -i $file -f rawvideo -s 352x288 $raw_dst
  411. fi
  412. ###################################
  413. if [ -n "$do_snowll" ] ; then
  414. # snow encoding
  415. file=${outfile}snow53.avi
  416. do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel $file
  417. # snow decoding
  418. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  419. fi
  420. ###################################
  421. if [ -n "$do_dv" ] ; then
  422. # dv encoding
  423. file=${outfile}dv.dv
  424. do_ffmpeg $file -dct int -y -f pgmyuv -i $raw_src -s pal -an $file
  425. # dv decoding
  426. do_ffmpeg $raw_dst -y -i $file -f rawvideo -s cif $raw_dst
  427. fi
  428. ###################################
  429. if [ -n "$do_dv50" ] ; then
  430. # dv50 encoding
  431. file=${outfile}dv.dv
  432. do_ffmpeg $file -dct int -y -f pgmyuv -i $raw_src -s pal -pix_fmt yuv422p -an $file
  433. # dv50 decoding
  434. do_ffmpeg $raw_dst -y -i $file -f rawvideo -s cif -pix_fmt yuv420p $raw_dst
  435. fi
  436. ###################################
  437. if [ -n "$do_svq1" ] ; then
  438. # svq1 encoding
  439. file=${outfile}svq1.mov
  440. do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec svq1 -qscale 3 -pix_fmt yuv410p $file
  441. # svq1 decoding
  442. do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
  443. fi
  444. ###################################
  445. if [ -n "$do_mp2" ] ; then
  446. # mp2 encoding
  447. file=${outfile}mp2.mp2
  448. do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
  449. # mp2 decoding
  450. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  451. $tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
  452. fi
  453. ###################################
  454. if [ -n "$do_ac3" ] ; then
  455. # ac3 encoding
  456. file=${outfile}ac3.rm
  457. do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file
  458. # ac3 decoding
  459. #do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  460. fi
  461. ###################################
  462. if [ -n "$do_g726" ] ; then
  463. # g726 encoding
  464. file=${outfile}g726.wav
  465. do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -ab 32 -ac 1 -ar 8000 -acodec g726 $file
  466. # g726 decoding
  467. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  468. fi
  469. ###################################
  470. if [ -n "$do_adpcm_ima_wav" ] ; then
  471. # encoding
  472. file=${outfile}adpcm_ima.wav
  473. do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ima_wav $file
  474. # decoding
  475. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  476. fi
  477. ###################################
  478. if [ -n "$do_adpcm_ms" ] ; then
  479. # encoding
  480. file=${outfile}adpcm_ms.wav
  481. do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ms $file
  482. # decoding
  483. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  484. fi
  485. ###################################
  486. if [ -n "$do_adpcm_yam" ] ; then
  487. # encoding
  488. file=${outfile}adpcm_yam.wav
  489. do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_yamaha $file
  490. # decoding
  491. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  492. fi
  493. ###################################
  494. # libav testing
  495. ###################################
  496. if [ -n "$do_libav" ] ; then
  497. # avi
  498. file=${outfile}libav.avi
  499. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
  500. do_ffmpeg_crc $file -i $file
  501. # asf
  502. file=${outfile}libav.asf
  503. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
  504. do_ffmpeg_crc $file -i $file -r 25
  505. # rm
  506. file=${outfile}libav.rm
  507. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
  508. # broken
  509. #do_ffmpeg_crc $file -i $file
  510. # mpegps
  511. file=${outfile}libav.mpg
  512. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
  513. do_ffmpeg_crc $file -i $file
  514. # mpegts
  515. file=${outfile}libav.ts
  516. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
  517. do_ffmpeg_crc $file -i $file
  518. # swf (decode audio only)
  519. file=${outfile}libav.swf
  520. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
  521. do_ffmpeg_crc $file -i $file
  522. # ffm
  523. file=${outfile}libav.ffm
  524. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
  525. do_ffmpeg_crc $file -i $file
  526. # flv
  527. file=${outfile}libav.flv
  528. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -an $file
  529. do_ffmpeg_crc $file -i $file
  530. # mov
  531. file=${outfile}libav.mov
  532. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec pcm_alaw $file
  533. do_ffmpeg_crc $file -i $file
  534. # nut
  535. file=${outfile}libav.nut
  536. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
  537. do_ffmpeg_crc $file -i $file
  538. # dv
  539. file=${outfile}libav.dv
  540. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -ar 48000 -r 25 -s pal -ac 2 $file
  541. do_ffmpeg_crc $file -i $file
  542. ####################
  543. # streamed images
  544. # mjpeg
  545. #file=${outfile}libav.mjpeg
  546. #do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
  547. #do_ffmpeg_crc $file -i $file
  548. # pbmpipe
  549. file=${outfile}libav.pbm
  550. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
  551. do_ffmpeg_crc $file -f image2pipe -i $file
  552. # pgmpipe
  553. file=${outfile}libav.pgm
  554. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
  555. do_ffmpeg_crc $file -f image2pipe -i $file
  556. # ppmpipe
  557. file=${outfile}libav.ppm
  558. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
  559. do_ffmpeg_crc $file -f image2pipe -i $file
  560. # gif
  561. file=${outfile}libav.gif
  562. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
  563. #do_ffmpeg_crc $file -i $file
  564. # yuv4mpeg
  565. file=${outfile}libav.y4m
  566. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
  567. #do_ffmpeg_crc $file -i $file
  568. ####################
  569. # image formats
  570. # pgm (we do not do md5 on image files yet)
  571. file=${outfile}libav%02d.pgm
  572. $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
  573. do_ffmpeg_crc $file -i $file
  574. # ppm (we do not do md5 on image files yet)
  575. file=${outfile}libav%02d.ppm
  576. $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
  577. do_ffmpeg_crc $file -i $file
  578. # jpeg (we do not do md5 on image files yet)
  579. file=${outfile}libav%02d.jpg
  580. $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p -f image2 $file
  581. do_ffmpeg_crc $file -f image2 -i $file
  582. ####################
  583. # audio only
  584. # wav
  585. file=${outfile}libav.wav
  586. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  587. do_ffmpeg_crc $file -i $file
  588. # alaw
  589. file=${outfile}libav.al
  590. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  591. do_ffmpeg_crc $file -i $file
  592. # mulaw
  593. file=${outfile}libav.ul
  594. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  595. do_ffmpeg_crc $file -i $file
  596. # au
  597. file=${outfile}libav.au
  598. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  599. do_ffmpeg_crc $file -i $file
  600. # mmf
  601. file=${outfile}libav.mmf
  602. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  603. do_ffmpeg_crc $file -i $file
  604. # aiff
  605. file=${outfile}libav.aif
  606. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  607. do_ffmpeg_crc $file -i $file
  608. # voc
  609. file=${outfile}libav.voc
  610. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  611. do_ffmpeg_crc $file -i $file
  612. ####################
  613. # pix_fmt conversions
  614. conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
  615. yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
  616. monob pal8"
  617. for pix_fmt in $conversions ; do
  618. file=${outfile}libav-${pix_fmt}.yuv
  619. do_ffmpeg_nocheck $file -r 1 -t 1 -y -f pgmyuv -i $raw_src \
  620. -f rawvideo -s 352x288 -pix_fmt $pix_fmt $raw_dst
  621. do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $raw_dst \
  622. -f rawvideo -s 352x288 -pix_fmt yuv444p $file
  623. done
  624. fi
  625. if $diff_cmd "$logfile" "$reffile" ; then
  626. echo
  627. echo Regression test succeeded.
  628. exit 0
  629. else
  630. echo
  631. echo Regression test: Error.
  632. exit 1
  633. fi