Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e178332

Browse files
committed
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.
1 parent 4045c2f commit e178332

4 files changed

Lines changed: 73 additions & 53 deletions

File tree

Demo/sgi/video/README

Lines changed: 60 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ a version of the Irix video library that supported capturing PAL
2626
format (in August 1992), Sjoerd added an interface to the video
2727
library to Python (sv) and Guido wrote Vrec.py (based upon a
2828
still frame grabber by Sjoerd, in turn based upon SGI demo code in C)
29-
to record a movie using it.
29+
to record a movie using it. Vrec was soon followed by modernized
30+
versions of the other programs (Vinfo, Vplay, Vtime) and an
31+
interactive editor (Vedit). Finally, VFile was rewritten for more
32+
modularity, functionality and robustness.
3033

3134
Guido van Rossum
3235
Jack Jansen
@@ -36,6 +39,61 @@ to record a movie using it.
3639
Overview of files
3740
-----------------
3841

42+
cmif-film.ms description of the CMIF video file format
43+
44+
45+
These are programs with a command line interface:
46+
47+
Vrec.py record video movies using the Indigo video library and
48+
board
49+
50+
Vplay.py play video movies
51+
52+
Vinfo.py show statistics on movies
53+
54+
Vtime.py (unrelated to vtime!!!) Copy a video file,
55+
manipulating the time codes (e.g. faster/slower, or
56+
regenerate time codes, or drop frames too close apart)
57+
58+
Vedit.py interactive video editing program
59+
60+
61+
These modules are used by the above programs:
62+
63+
VFile.py classes that read and write CMIF video files
64+
65+
Viewer.py two viewer classes used by Vedit
66+
67+
68+
The following are C programs, either for efficiency or because they
69+
need to link with a C library:
70+
71+
squash.c make a movie smaller by averaging pixels
72+
usage: squash factor [bits] <moviefile >newmoviefile
73+
factor x and y compression factor
74+
bits #bits left per sample in result (default 8)
75+
76+
squash2.c make a movie smaller by dropping pixels
77+
usage: squash2 factor <moviefile >newmoviefile
78+
factor x and y compression factor
79+
80+
tomono.c like squash2 but outputs a monochrome movie
81+
82+
v2i.c convert the first frame of a movie file to SGI .rgb format
83+
link with -limage
84+
85+
i2v.c convert an rgb file to "lrectwrite" format (this was
86+
used one time by the CMIF editor)
87+
88+
89+
These programs are obsolete, but kept around for sentimental reasons.
90+
Most either don't work any more because they don't use VFile and hence
91+
haven't followed the frequent changes in the CMIF video file format;
92+
or they are dependent upon hardware we don't have (SGI's previous
93+
generation framegrabber). Except for cam.py / tv.py, their
94+
functionality is present in the suite of programs whose name begins
95+
with 'V' listed above.
96+
3997
cam.py network real-time tv broadcast; see tv.py
4098
usage: cam [packfactor [host]]
4199
specifying 'all' for host broadcasts
@@ -54,11 +112,6 @@ camcorder.py record video movies or make snapshots (in movie format)
54112
p pause recording (record single frame if paused)
55113
ESC quit
56114

57-
Vrec.py record video movies using the Indigo video library and
58-
board
59-
60-
colorsys.py color conversions, used by video
61-
62115
statit.py various statistics operations on movie files
63116

64117
syncaudio.py record audio synchronized with camcorder -a
@@ -84,43 +137,12 @@ video.py player for movies recorded by camcorder.py
84137
soundfile default is none (no sound)
85138
skipbytes byte offset in soundfile where sound starts
86139

87-
Vplay.py similar but more modern, using VFile.py
88-
89140
vinfo.py print summary of movie file(s)
90141
usage: vinfo [-d] moviefile ...
91142
-d print delta times (default: print abs times)
92143

93-
Vinfo.py similar but more modern, using VFile.py
94-
95144
vpregs.py definition of VP registers
96145

97146
vtime.py virtual time module imported by syncaudio.py and camcorder.py
98147

99-
Vtime.py (unrelated to vtime!!!) Copy a video file,
100-
manipulating the time codes (e.g. faster/slower, or
101-
regenerate time codes, or drop frames too close apart)
102-
103-
Vedit.py interactive video editing program
104-
105-
Viewer.py two viewer classes used by Vedit
106-
107-
108-
The following are C programs, either for efficiency or because they
109-
need to link with a C library:
110-
111-
squash.c make a movie smaller by averaging pixels
112-
usage: squash factor [bits] <moviefile >newmoviefile
113-
factor x and y compression factor
114-
bits #bits left per sample in result (default 8)
115-
116-
squash2.c make a movie smaller by dropping pixels
117-
usage: squash2 factor <moviefile >newmoviefile
118-
factor x and y compression factor
119-
120-
tomono.c like squash2 but outputs a monochrome movie
121-
122-
v2i.c convert the first frame of a movie file to SGI .rgb format
123-
link with -limage
124-
125-
i2v.c convert an rgb file to "lrectwrite" format (this was
126-
used one time by the CMIF editor)
148+
colorsys.py color system conversions (now part of std python lib)

Demo/sgi/video/Vinfo.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,7 @@ def process(filename):
6565
sys.stderr.write(filename + ': EOF in video file\n')
6666
return 1
6767

68-
print 'File: ', filename
69-
print 'Version: ', vin.version
70-
print 'Size: ', vin.width, 'x', vin.height
71-
print 'Pack: ', vin.packfactor, '; chrom:', vin.chrompack
72-
print 'Bits: ', vin.c0bits, vin.c1bits, vin.c2bits
73-
print 'Format: ', vin.format
74-
print 'Offset: ', vin.offset
68+
vin.printinfo()
7569

7670
if quick:
7771
vin.close()

Demo/sgi/video/Vplay.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def help():
1515
print '-d : write some debug stuff on stderr'
1616
print '-l : loop, playing the movie over and over again'
1717
print '-m delta : drop frames closer than delta msec (default 0)'
18+
print '-n : don\'t wait after each file'
1819
print '-q : quiet, no informative messages'
1920
print '-r delta : regenerate input time base delta msec apart'
2021
print '-s speed : speed change factor (default 1.0)'
@@ -137,13 +138,7 @@ def process(filename):
137138
return 1
138139

139140
if not quiet:
140-
print 'File: ', filename
141-
print 'Version: ', vin.version
142-
print 'Size: ', vin.width, 'x', vin.height
143-
print 'Pack: ', vin.packfactor, '; chrom:', vin.chrompack
144-
print 'Bits: ', vin.c0bits, vin.c1bits, vin.c2bits
145-
print 'Format: ', vin.format
146-
print 'Offset: ', vin.offset
141+
vin.printinfo()
147142

148143
gl.foreground()
149144

@@ -211,6 +206,8 @@ def playonce(vin):
211206
time.millisleep(100)
212207

213208
tin = 0
209+
toffset = 0
210+
oldtin = 0
214211
told = 0
215212
nin = 0
216213
nout = 0
@@ -247,11 +244,18 @@ def playonce(vin):
247244
except EOFError:
248245
break
249246
nin = nin+1
247+
if tin+toffset < oldtin:
248+
print 'Fix reversed time:', oldtin, 'to', tin
249+
toffset = oldtin - tin
250+
tin = tin + toffset
251+
oldtin = tin
250252
if regen: tout = nin * regen
251253
else: tout = tin
252254
tout = int(tout / speed)
253255
if tout - told < mindelta:
254256
nskipped = nskipped + 1
257+
if not threading:
258+
vin.skipnextframedata(size, csize)
255259
else:
256260
if not threading:
257261
try:

Demo/sgi/video/vcopy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def report(time, iframe):
1010
print 'Frame', iframe, ': t =', time
1111

1212
def usage():
13-
sys.write('usage: vcopy infile outfile\n')
13+
sys.stderr.write('usage: vcopy infile outfile\n')
1414
sys.exit(2)
1515

1616
def help():

0 commit comments

Comments
 (0)