mirror of https://github.com/python/cpython
Adapted the world to the new VFile.py. Fixed bugs in Vplay.py:
missing -n in help(), bogus frame skipping; and added patch for weird time jumps. Removed colorsys.py (now in std library). Fixed "sys.write" error in vcopy.py. Restructured README.
This commit is contained in:
parent
4045c2fa5b
commit
e1783324ab
|
@ -26,7 +26,10 @@ a version of the Irix video library that supported capturing PAL
|
|||
format (in August 1992), Sjoerd added an interface to the video
|
||||
library to Python (sv) and Guido wrote Vrec.py (based upon a
|
||||
still frame grabber by Sjoerd, in turn based upon SGI demo code in C)
|
||||
to record a movie using it.
|
||||
to record a movie using it. Vrec was soon followed by modernized
|
||||
versions of the other programs (Vinfo, Vplay, Vtime) and an
|
||||
interactive editor (Vedit). Finally, VFile was rewritten for more
|
||||
modularity, functionality and robustness.
|
||||
|
||||
Guido van Rossum
|
||||
Jack Jansen
|
||||
|
@ -36,6 +39,61 @@ to record a movie using it.
|
|||
Overview of files
|
||||
-----------------
|
||||
|
||||
cmif-film.ms description of the CMIF video file format
|
||||
|
||||
|
||||
These are programs with a command line interface:
|
||||
|
||||
Vrec.py record video movies using the Indigo video library and
|
||||
board
|
||||
|
||||
Vplay.py play video movies
|
||||
|
||||
Vinfo.py show statistics on movies
|
||||
|
||||
Vtime.py (unrelated to vtime!!!) Copy a video file,
|
||||
manipulating the time codes (e.g. faster/slower, or
|
||||
regenerate time codes, or drop frames too close apart)
|
||||
|
||||
Vedit.py interactive video editing program
|
||||
|
||||
|
||||
These modules are used by the above programs:
|
||||
|
||||
VFile.py classes that read and write CMIF video files
|
||||
|
||||
Viewer.py two viewer classes used by Vedit
|
||||
|
||||
|
||||
The following are C programs, either for efficiency or because they
|
||||
need to link with a C library:
|
||||
|
||||
squash.c make a movie smaller by averaging pixels
|
||||
usage: squash factor [bits] <moviefile >newmoviefile
|
||||
factor x and y compression factor
|
||||
bits #bits left per sample in result (default 8)
|
||||
|
||||
squash2.c make a movie smaller by dropping pixels
|
||||
usage: squash2 factor <moviefile >newmoviefile
|
||||
factor x and y compression factor
|
||||
|
||||
tomono.c like squash2 but outputs a monochrome movie
|
||||
|
||||
v2i.c convert the first frame of a movie file to SGI .rgb format
|
||||
link with -limage
|
||||
|
||||
i2v.c convert an rgb file to "lrectwrite" format (this was
|
||||
used one time by the CMIF editor)
|
||||
|
||||
|
||||
These programs are obsolete, but kept around for sentimental reasons.
|
||||
Most either don't work any more because they don't use VFile and hence
|
||||
haven't followed the frequent changes in the CMIF video file format;
|
||||
or they are dependent upon hardware we don't have (SGI's previous
|
||||
generation framegrabber). Except for cam.py / tv.py, their
|
||||
functionality is present in the suite of programs whose name begins
|
||||
with 'V' listed above.
|
||||
|
||||
cam.py network real-time tv broadcast; see tv.py
|
||||
usage: cam [packfactor [host]]
|
||||
specifying 'all' for host broadcasts
|
||||
|
@ -54,11 +112,6 @@ camcorder.py record video movies or make snapshots (in movie format)
|
|||
p pause recording (record single frame if paused)
|
||||
ESC quit
|
||||
|
||||
Vrec.py record video movies using the Indigo video library and
|
||||
board
|
||||
|
||||
colorsys.py color conversions, used by video
|
||||
|
||||
statit.py various statistics operations on movie files
|
||||
|
||||
syncaudio.py record audio synchronized with camcorder -a
|
||||
|
@ -84,43 +137,12 @@ video.py player for movies recorded by camcorder.py
|
|||
soundfile default is none (no sound)
|
||||
skipbytes byte offset in soundfile where sound starts
|
||||
|
||||
Vplay.py similar but more modern, using VFile.py
|
||||
|
||||
vinfo.py print summary of movie file(s)
|
||||
usage: vinfo [-d] moviefile ...
|
||||
-d print delta times (default: print abs times)
|
||||
|
||||
Vinfo.py similar but more modern, using VFile.py
|
||||
|
||||
vpregs.py definition of VP registers
|
||||
|
||||
vtime.py virtual time module imported by syncaudio.py and camcorder.py
|
||||
|
||||
Vtime.py (unrelated to vtime!!!) Copy a video file,
|
||||
manipulating the time codes (e.g. faster/slower, or
|
||||
regenerate time codes, or drop frames too close apart)
|
||||
|
||||
Vedit.py interactive video editing program
|
||||
|
||||
Viewer.py two viewer classes used by Vedit
|
||||
|
||||
|
||||
The following are C programs, either for efficiency or because they
|
||||
need to link with a C library:
|
||||
|
||||
squash.c make a movie smaller by averaging pixels
|
||||
usage: squash factor [bits] <moviefile >newmoviefile
|
||||
factor x and y compression factor
|
||||
bits #bits left per sample in result (default 8)
|
||||
|
||||
squash2.c make a movie smaller by dropping pixels
|
||||
usage: squash2 factor <moviefile >newmoviefile
|
||||
factor x and y compression factor
|
||||
|
||||
tomono.c like squash2 but outputs a monochrome movie
|
||||
|
||||
v2i.c convert the first frame of a movie file to SGI .rgb format
|
||||
link with -limage
|
||||
|
||||
i2v.c convert an rgb file to "lrectwrite" format (this was
|
||||
used one time by the CMIF editor)
|
||||
colorsys.py color system conversions (now part of std python lib)
|
||||
|
|
|
@ -65,13 +65,7 @@ def process(filename):
|
|||
sys.stderr.write(filename + ': EOF in video file\n')
|
||||
return 1
|
||||
|
||||
print 'File: ', filename
|
||||
print 'Version: ', vin.version
|
||||
print 'Size: ', vin.width, 'x', vin.height
|
||||
print 'Pack: ', vin.packfactor, '; chrom:', vin.chrompack
|
||||
print 'Bits: ', vin.c0bits, vin.c1bits, vin.c2bits
|
||||
print 'Format: ', vin.format
|
||||
print 'Offset: ', vin.offset
|
||||
vin.printinfo()
|
||||
|
||||
if quick:
|
||||
vin.close()
|
||||
|
|
|
@ -15,6 +15,7 @@ def help():
|
|||
print '-d : write some debug stuff on stderr'
|
||||
print '-l : loop, playing the movie over and over again'
|
||||
print '-m delta : drop frames closer than delta msec (default 0)'
|
||||
print '-n : don\'t wait after each file'
|
||||
print '-q : quiet, no informative messages'
|
||||
print '-r delta : regenerate input time base delta msec apart'
|
||||
print '-s speed : speed change factor (default 1.0)'
|
||||
|
@ -137,13 +138,7 @@ def process(filename):
|
|||
return 1
|
||||
|
||||
if not quiet:
|
||||
print 'File: ', filename
|
||||
print 'Version: ', vin.version
|
||||
print 'Size: ', vin.width, 'x', vin.height
|
||||
print 'Pack: ', vin.packfactor, '; chrom:', vin.chrompack
|
||||
print 'Bits: ', vin.c0bits, vin.c1bits, vin.c2bits
|
||||
print 'Format: ', vin.format
|
||||
print 'Offset: ', vin.offset
|
||||
vin.printinfo()
|
||||
|
||||
gl.foreground()
|
||||
|
||||
|
@ -211,6 +206,8 @@ def playonce(vin):
|
|||
time.millisleep(100)
|
||||
|
||||
tin = 0
|
||||
toffset = 0
|
||||
oldtin = 0
|
||||
told = 0
|
||||
nin = 0
|
||||
nout = 0
|
||||
|
@ -247,11 +244,18 @@ def playonce(vin):
|
|||
except EOFError:
|
||||
break
|
||||
nin = nin+1
|
||||
if tin+toffset < oldtin:
|
||||
print 'Fix reversed time:', oldtin, 'to', tin
|
||||
toffset = oldtin - tin
|
||||
tin = tin + toffset
|
||||
oldtin = tin
|
||||
if regen: tout = nin * regen
|
||||
else: tout = tin
|
||||
tout = int(tout / speed)
|
||||
if tout - told < mindelta:
|
||||
nskipped = nskipped + 1
|
||||
if not threading:
|
||||
vin.skipnextframedata(size, csize)
|
||||
else:
|
||||
if not threading:
|
||||
try:
|
||||
|
|
|
@ -10,7 +10,7 @@ def report(time, iframe):
|
|||
print 'Frame', iframe, ': t =', time
|
||||
|
||||
def usage():
|
||||
sys.write('usage: vcopy infile outfile\n')
|
||||
sys.stderr.write('usage: vcopy infile outfile\n')
|
||||
sys.exit(2)
|
||||
|
||||
def help():
|
||||
|
|
Loading…
Reference in New Issue