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.

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