Ejemplo n.º 1
0
def process(infilename, outfilename):
    try:
        vin = VFile.BasicVinFile(infilename)
    except IOError, msg:
        sys.stderr.write(infilename + ': I/O error: ' + ` msg ` + '\n')
        return 1
    except VFile.Error, msg:
        sys.stderr.write(msg + '\n')
        return 1
    except EOFError:
        sys.stderr.write(infilename + ': EOF in video file\n')
        return 1

    try:
        vout = VFile.BasicVoutFile(outfilename)
    except IOError, msg:
        sys.stderr.write(outfilename + ': I/O error: ' + ` msg ` + '\n')
        return 1

    vout.setinfo(vin.getinfo())
    vout.writeheader()

    told = 0
    nin = 0
    nout = 0
    tin = 0
    tout = 0

    while 1:
        try:
Ejemplo n.º 2
0
#! /usr/bin/env python
# Copy a video file, fixing the line width to be a multiple of 4

# Usage:
#
# Vfix [infile [outfile]]

# Options:
#
# infile     : input file (default film.video)
# outfile    : output file (default out.video)

import sys
import imageop
sys.path.append('/ufs/guido/src/video')
import VFile

# Main program -- mostly command line parsing
def main():
	args = sys.argv[1:]
	if len(args) < 1:
		args.append('film.video')
	if len(args) < 2:
		args.append('out.video')
	if len(args) > 2:
		sys.stderr.write('usage: Vfix [infile [outfile]]\n')
		sys.exit(2)
	sts = process(args[0], args[1])
	sys.exit(sts)
Ejemplo n.º 3
0
#! /usr/bin/env python
# Manipulate the time base of CMIF movies

# Possibilities:
#
# - resample at a fixed rate
# - divide the time codes by a speed factor (to make it go faster/slower)
# - drop frames that are less than n msec apart (to accommodate slow players)

# Usage:
#
# Vtime [-m msec] [-r msec] [-s speed] [infile [outfile]]

# Options:
#
# -m n       : drop frames closer than n msec (default 0)
# -r n       : regenerate input time base n msec apart
# -s speed   : speed change factor after other processing (default 1.0)
# infile     : input file (default film.video)
# outfile    : output file (default out.video)

import sys
sys.path.append('/ufs/guido/src/video')
import VFile
import getopt
import string

# Global options
speed = 1.0
mindelta = 0
Ejemplo n.º 4
0
#! /usr/bin/env python
# Compress an rgb or grey video file to jpeg format
# Usage:
#
# Vmkjpeg [infile [outfile]]
# Options:
#
# infile     : input file (default film.video)
# outfile    : output file (default out.video)
import sys
import jpeg
sys.path.append('/ufs/guido/src/video')
import VFile
# Main program -- mostly command line parsing

def main():
    args = sys.argv[1:]
    if len(args) < 1:
        args.append('film.video')
    if len(args) < 2:
        args.append('out.video')
    if len(args) > 2:
        sys.stderr.write('usage: Vmkjpeg [infile [outfile]]\n')
        sys.exit(2)
    sts = process(args[0], args[1])
    sys.exit(sts)

# Copy one file to another

def process(infilename, outfilename):
Ejemplo n.º 5
0
#! /usr/bin/env python
# Universal (non-interactive) CMIF video file copier.

# Possibilities:
#
# - Manipulate the time base:
#   = resample at a fixed rate
#   = divide the time codes by a speed factor (to make it go faster/slower)
#   = drop frames that are less than n msec apart (to accommodate slow players)
# - Convert to a different format
# - Magnify (scale) the image

# Usage function (keep this up-to-date if you change the program!)
def usage():
	print 'Usage: Vcopy [options] [infile [outfile]]'
	print
	print 'Options:'
	print
	print '-t type    : new image type (default unchanged)'
	print
	print '-M magnify : image magnification factor (default unchanged)'
	print '-w width   : output image width (default height*4/3 if -h used)'
	print '-h height  : output image height (default width*3/4 if -w used)'
	print
	print '-p pf      : new x and y packfactor (default unchanged)'
	print '-x xpf     : new x packfactor (default unchanged)'
	print '-y ypf     : new y packfactor (default unchanged)'
	print
	print '-m delta   : drop frames closer than delta msec (default 0)'
	print '-r delta   : regenerate input time base delta msec apart'