From 7268c93c5536471d544a5249a0c275a9f208c2c6 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 18 Aug 1992 21:11:18 +0000 Subject: Minor improvements, comments; fix Vinfo -d. --- Demo/sgi/video/README | 54 +++++++++++++++++++++++++++++++-------------- Demo/sgi/video/VFile.py | 5 +++-- Demo/sgi/video/Vinfo.py | 23 ++++++++++++++----- Demo/sgi/video/makemovie.py | 2 +- 4 files changed, 59 insertions(+), 25 deletions(-) diff --git a/Demo/sgi/video/README b/Demo/sgi/video/README index 39f63b5..4995f58 100644 --- a/Demo/sgi/video/README +++ b/Demo/sgi/video/README @@ -1,24 +1,41 @@ -This directory contains Python and C code for video stuff. +CMIF video tools +================ -History: +This directory contains Python and C programs to manipulate files +containing digitized video in the "CMIF video format". -We started this in October 1991, when we had a large framegrabber -board on loan from SGI for a few weeks. -Later, when we started processing the recorded film fragments, the -"CMIF video format" was revised several times, and we finally created -an object-oriented interface for reading and writing various -incarnations of these files, called VFile. +History +------- -When we finally got our own Indigo entry-level video board (in June -1992) and a version of the Irix video library that supported capturing -PAL format (August 1992) Sjoerd added an interface to the video +We started this in October 1991, when we had a large framegrabber +board on loan from SGI for a few weeks: we developed a movie recording +program (camcorder.py) and added numerous features, including still +frame capture and synchronous sound recording using a second machine +(the machine holding the framegrabber board didn't have audio). + +During the following months, when we started using and processing the +recorded film fragments, the "CMIF video format" was revised several +times, and we eventually created an object-oriented interface for +reading and writing various incarnations of these files, called VFile. +(This module is also used by our flagship application, the CMIF +editor, not in this directory but in /ufs/guido/mm/.) + +When we got our own Indigo entry-level video board (in June 1992) and +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 makemovie.py (based upon a -still frame grabber by Sjoerd) to record a movie using it. +still frame grabber by Sjoerd, in turn based upon SGI demo code in C) +to record a movie using it. - --Guido, Jack and Sjoerd + Guido van Rossum + Jack Jansen + Sjoerd Mullender +Overview of files +----------------- + cam.py network real-time tv broadcast; see tv.py usage: cam [packfactor [host]] specifying 'all' for host broadcasts @@ -67,21 +84,21 @@ 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 same but using VFile.py +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 same but using VFile.py +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 -These are C programs, either for efficiency or because they need to -link with a C library. +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] newmoviefile @@ -96,3 +113,6 @@ 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) diff --git a/Demo/sgi/video/VFile.py b/Demo/sgi/video/VFile.py index 2febd5a..5b9cd01 100755 --- a/Demo/sgi/video/VFile.py +++ b/Demo/sgi/video/VFile.py @@ -33,8 +33,9 @@ def conv_rgb8(rgb,d1,d2): # init(filename) # initfp(fp, filename) # rewind() -# getframe() -# skipframe() +# getnextframe() +# skipnextframe() +# (and many more) # # The following read-only data members provide public information: # version diff --git a/Demo/sgi/video/Vinfo.py b/Demo/sgi/video/Vinfo.py index 2aec803..d20d93f 100755 --- a/Demo/sgi/video/Vinfo.py +++ b/Demo/sgi/video/Vinfo.py @@ -26,19 +26,19 @@ import getopt short = 0 quick = 0 -diffs = 0 +delta = 0 # Main program -- mostly command line parsing def main(): - global short, quick, diffs + global short, quick, delta opts, args = getopt.getopt(sys.argv[1:], 'dqs') for opt, arg in opts: if opt == '-q': quick = 1 elif opt == '-d': - diffs = 1 + delta = 1 elif opt == '-s': short = 1 if not args: @@ -50,7 +50,17 @@ def main(): # Process one file def process(filename): - vin = VFile.VinFile().init(filename) + try: + vin = VFile.VinFile().init(filename) + except IOError, msg: + sys.stderr.write(filename + ': I/O error: ' + `msg` + '\n') + return + except VFile.Error, msg: + sys.stderr.write(msg + '\n') + return + except EOFError: + sys.stderr.write(filename + ': EOF in video file\n') + return print 'File: ', filename print 'Version: ', vin.version print 'Size: ', vin.width, 'x', vin.height @@ -62,7 +72,10 @@ def process(filename): vin.close() return if not short: - print 'Frame times:', + if delta: + print 'Frame time deltas:', + else: + print 'Frame times:', n = 0 t = 0 told = 0 diff --git a/Demo/sgi/video/makemovie.py b/Demo/sgi/video/makemovie.py index 983e5ed..5cb41cd 100755 --- a/Demo/sgi/video/makemovie.py +++ b/Demo/sgi/video/makemovie.py @@ -1,5 +1,5 @@ +#! /ufs/guido/bin/sgi/python #! /ufs/guido/src/video/py -# XXX for now, you need this special version of Python # Capture a CMIF movie using the Indigo video library and board -- cgit v0.12