10 |
import getopt |
import getopt |
11 |
|
|
12 |
(opts, args) = getopt.getopt(sys.argv[1:], |
(opts, args) = getopt.getopt(sys.argv[1:], |
13 |
"s:d:o:f:p:h", |
"s:d:o:f:p:t:h", |
14 |
["framestem=", "dirname=", "output=", "format=", "pad=", "help"], |
["framestem=", "dirname=", "output=", "format=", "pad=", "pattern=", |
15 |
|
"help"], |
16 |
) |
) |
17 |
|
|
18 |
def usage(): |
def usage(): |
24 |
print " -o/--output: Output mpeg filename (optional)" |
print " -o/--output: Output mpeg filename (optional)" |
25 |
print " -f/--format: Input frame image format (optional)" |
print " -f/--format: Input frame image format (optional)" |
26 |
print " -p/--pad: How many frames to pad the movie (optional)" |
print " -p/--pad: How many frames to pad the movie (optional)" |
27 |
|
print " -h/--help: Display this information (optional)" |
28 |
|
|
29 |
dirname = "./" |
dirname = "./" |
30 |
mpegName = None |
mpegName = None |
31 |
fnameStem = None |
fnameStem = None |
32 |
format = "pnm" # if format not specified assume pnm |
format = "pnm" # if format not specified assume pnm |
33 |
pad = 1 |
pad = 1 |
34 |
|
pattern = "IBBPBBPBB" |
35 |
|
|
36 |
for option, arg in opts: |
for option, arg in opts: |
37 |
if option in ('-s', '--stem'): |
if option in ('-s', '--stem'): |
44 |
format = arg |
format = arg |
45 |
elif option in ('-p', '--pad'): |
elif option in ('-p', '--pad'): |
46 |
pad = int(arg) |
pad = int(arg) |
47 |
|
elif option in ('-t', '--pattern'): |
48 |
|
pattern = arg |
49 |
elif option in ('-h', '--help'): |
elif option in ('-h', '--help'): |
50 |
usage() |
usage() |
51 |
sys.exit(0) |
sys.exit(0) |
97 |
paramsFileString = """REFERENCE_FRAME DECODED |
paramsFileString = """REFERENCE_FRAME DECODED |
98 |
FRAME_RATE 24 |
FRAME_RATE 24 |
99 |
OUTPUT %s |
OUTPUT %s |
100 |
PATTERN IBBPBBPBB |
PATTERN %s |
101 |
FORCE_ENCODE_LAST_FRAME |
FORCE_ENCODE_LAST_FRAME |
102 |
GOP_SIZE 20 |
GOP_SIZE 20 |
103 |
BSEARCH_ALG CROSS2 |
BSEARCH_ALG CROSS2 |
111 |
INPUT_DIR . |
INPUT_DIR . |
112 |
INPUT_CONVERT * |
INPUT_CONVERT * |
113 |
INPUT |
INPUT |
114 |
""" % (mpegName) |
""" % (mpegName, pattern) |
115 |
|
|
116 |
# need to determine the first number and last number of the list of files |
# need to determine the first number and last number of the list of files |
117 |
# sort the files first just in case |
# sort the files first just in case |