OSDN Git Service

import 0.9.4
[handbrake-jp/handbrake-jp.git] / scripts / tst.aspect
1 #!/bin/tcsh
2 #
3 # generate aspect ratio & cropping regression test data
4 # from a set of HandBrake input files
5 #
6 # usage: tst.aspect [file ...]
7 #
8 # if no file names are supplied a default set of inputs is used (see the
9 # variable 'inputs' below). Each file is encoded multiple times using
10 # different options each time. The options to use are the elements of
11 # the 'options' variable below.
12 #
13 # One line is printed for each HB run. It has the input dimensions,
14 # output dimensions, crop, PAR, filename & options for the encode.
15 # Since PAR is only output for anamorphic encodes, an omitted PAR
16 # is indicated by "1:1" (to distinguish it from the explicit PAR "1/1").
17
18 set options=('-w 480' '-l 368' '-p' '-P')
19
20 if ($#argv) then
21     set inputs=($argv:q)
22 else
23     set inputs=(~/Movies/DVD/* ~/tst/*.{ts,mpg,mkv,avi,vob})
24 endif
25
26 foreach i ($inputs:q)
27     foreach o ($options:q)
28         (sleep 5; echo q) | ./HandBrakeCLI -v -L -i "$i" -o /dev/null -f mp4 -e x264 $o |& \
29         awk -v fnm="$i" -v opts="$o" '/ storage dimensions: / { dimen = $5 "*" $7 " -> " $9 "*" $11 " " $13 }\
30         $3=="dimensions:" { dimen = $4 "*" $6 " -> " $8 "*" $10 " " $12 }\
31         / pixel aspect ratio: / { par=$6 "/" $8 }\
32         /encx264: opening libx264/ { if(! par) par="1:1";printf "%s %s  %s %s\n", dimen, par, fnm, opts }'
33     end
34 end