Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102074347
gmkmpeg
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 16, 20:37
Size
1 KB
Mime Type
text/x-python
Expires
Tue, Feb 18, 20:37 (2 d)
Engine
blob
Format
Raw Data
Handle
24275917
Attached To
rGTOOLS Gtools
gmkmpeg
View Options
#!/usr/bin/env python
'''
Make mpeg movie from a directory containing .ppm images
mer oct 25 15:40:17 CEST 2006
'''
import
os
import
sys
import
glob
from
optparse
import
OptionParser
def
parse_options
():
usage
=
"usage: %prog [options] file"
parser
=
OptionParser
(
usage
=
usage
)
parser
.
add_option
(
"--directory"
,
action
=
"store"
,
dest
=
"directory"
,
type
=
"string"
,
default
=
"./tmp"
,
help
=
"directory"
,
metavar
=
" STRING"
)
parser
.
add_option
(
"-o"
,
action
=
"store"
,
dest
=
"fout"
,
type
=
"string"
,
default
=
None
,
help
=
"output file"
,
metavar
=
" FILE"
)
(
options
,
args
)
=
parser
.
parse_args
()
files
=
args
return
files
,
options
#############################
# main
#############################
# get options
files
,
options
=
parse_options
()
#inputfile = options.inputfile
fout
=
options
.
fout
directory
=
options
.
directory
files
=
glob
.
glob
(
'
%s
/*.ppm'
%
(
directory
))
files
.
sort
()
n
=
len
(
files
)
-
1
# new version from Benoit
line
=
"""
PATTERN IBBPBBPBBPBB
IQSCALE 4
PQSCALE 5
BQSCALE 12
SLICES_PER_FRAME 1
PIXEL FULL
OUTPUT
%s
INPUT_DIR ./
%s
INPUT
*.ppm [
%000005d
-
%000005d
]
END_INPUT
BASE_FILE_FORMAT PPM
INPUT_CONVERT *
GOP_SIZE 1
RANGE 1
PSEARCH_ALG EXHAUSTIVE
BSEARCH_ALG CROSS2
REFERENCE_FRAME DECODED
"""
%
(
fout
,
directory
,
1
,
n
)
f
=
open
(
'param.mpg'
,
'w'
)
f
.
write
(
line
)
f
.
close
()
os
.
system
(
'ppmtompeg param.mpg'
)
#os.remove('param.mpg')
#for file in listim:
# os.remove(file)
#os.rmdir('tmp')
Event Timeline
Log In to Comment