class GrabbingVoutFile(VFile.VoutFile, VGrabber.VGrabber):
    pass


def main():
    foreground()
    try:
        opts, args = getopt.getopt(sys.argv[1:], 't:am:d')
    except getopt.error, msg:
        print msg
        usage()
    if len(args) <> 2:
        usage()
    [ifile, ofile] = args
    print 'open film ', ifile
    ifilm = VFile.VinFile(ifile)
    print 'open output ', ofile
    ofilm = GrabbingVoutFile(ofile)

    ofilm.setinfo(ifilm.getinfo())

    use_grabber = 0
    continuous = 0
    tomono = 0
    tomonodither = 0
    for o, a in opts:
        if o == '-t':
            ofilm.format = a
            use_grabber = 1
        if o == '-a':
            continuous = 1
示例#2
0
#! /usr/bin/env python
# Copy a video file, interactively, frame-by-frame.
import sys
import getopt
from gl import *
from DEVICE import *
import VFile
import VGrabber
import string
import imageop

def report(time, iframe):
    print 'Frame', iframe, ': t =', time

def usage():
    sys.stderr.write(
        'usage: Vcopy [-t type] [-m threshold] [-a] infile outfile\n')
    sys.stderr.write('-t Convert to other type\n')
    sys.stderr.write('-a Automatic\n')
    sys.stderr.write('-m Convert grey to mono with threshold\n')
    sys.stderr.write('-d Convert grey to mono with dithering\n')
    sys.exit(2)

def help():
    print 'Command summary:'
    print 'n   get next image from input'
    print 'w   write current image to output'

class GrabbingVoutFile(VFile.VoutFile, VGrabber.VGrabber):
    pass
示例#3
0
        usage()

    if len(args) > 2:
        usage()

    if args: videofile = args[0]
    if args[1:]: audiofile = args[1]

    if not os.path.exists(videofile) and \
     os.path.exists(videofile + '.video'):
        if not args[1:] and os.path.exists(videofile + '.aiff'):
            audiofile = videofile + '.aiff'
        videofile = videofile + '.video'

    print 'Opening video input file..'
    vin = VFile.VinFile(videofile)

    print 'Opening audio input file..'
    ain = aifc.open(audiofile, 'r')
    print 'rate    :', ain.getframerate()
    print 'channels:', ain.getnchannels()
    print 'frames  :', ain.getnframes()
    print 'width   :', ain.getsampwidth()
    print 'kbytes  :', \
       ain.getnframes() * ain.getnchannels() * ain.getsampwidth()

    print 'Opening audio output port..'
    c = al.newconfig()
    c.setchannels(ain.getnchannels())
    c.setwidth(ain.getsampwidth())
    nullsample = '\0' * ain.getsampwidth()
示例#4
0
def process(filename):
    try:
        vin = VFile.VinFile(filename)
    except IOError, msg:
        sys.stderr.write(filename + ': I/O error: ' + ` msg ` + '\n')
        return 1