Пример #1
0
import sys
Пример #2
0
	if vinfmt == 'compress':
		if not newtype or newtype == 'compress':
			# compressed->compressed: copy compression header
			vout.setcompressheader(vin.getcompressheader())
		else:
			# compressed->something else: go via rgb-24
			decompress = 1
			vinfmt = 'rgb'
	elif newtype == 'compress':
		# something else->compressed: not implemented
		sys.stderr.write('Sorry, conversion to compressed not yet implemented\n')
		return 1
	if newtype:
		vout.setformat(newtype)
		try:
			convert = imgconv.getconverter(vinfmt, vout.format)
		except imgconv.error, msg:
			sys.stderr.write(str(msg) + '\n')
			return 1

	if newpf:
		xpf, ypf = newpf
		if not xpf: xpf = vin.xpf
		if not ypf: ypf = vout.ypf
		newpf = (xpf, ypf)
		vout.setpf(newpf)

	if newwidth and newheight:
		scale = 1

	if vin.upside_down <> vout.upside_down or \
Пример #3
0
#! /usr/bin/env python
# Convert CMIF movie file(s) to a sequence of rgb images

# Help function
def help():
	print 'Usage: video2rgb [options] [file] ...'
	print
	print 'Options:'
	print '-q         : quiet, no informative messages'
	print '-m         : create monochrome (greyscale) image files'
	print '-f prefix  : create image files with names "prefix0000.rgb"'
	print 'file ...   : file(s) to convert; default film.video'

# Imported modules
import sys
sys.path.append('/ufs/jack/src/av/video') # Increase chance of finding VFile
import VFile
import time
import getopt
import string
import imgfile
import imgconv

# Global options
quiet = 0
prefix = 'film'
seqno = 0
mono = 0

# Main program -- mostly command line parsing
Пример #4
0
import sys
Пример #5
0
        return 1
    except VFile.Error, msg:
        sys.stderr.write(msg + '\n')
        return 1
    except EOFError:
        sys.stderr.write(filename + ': EOF in video header\n')
        return 1

    if not quiet:
        vin.printinfo()

    width, height = int(vin.width), int(vin.height)

    try:
        if mono:
            cf = imgconv.getconverter(vin.format, 'grey')
        else:
            cf = imgconv.getconverter(vin.format, 'rgb')
    except imgconv.error:
        print 'Sorry, no converter available for type', vin.format
        return

    if mono:
        depth = 1
        bpp = 1
    else:
        depth = 3
        bpp = 4

    convert(vin, cf, width, height, depth, bpp, vin.packfactor)
Пример #6
0
		return 1
	except VFile.Error, msg:
		sys.stderr.write(msg + '\n')
		return 1
	except EOFError:
		sys.stderr.write(filename + ': EOF in video header\n')
		return 1

	if not quiet:
		vin.printinfo()
	
	width, height = int(vin.width), int(vin.height)

	try:
		if mono:
			cf = imgconv.getconverter(vin.format, 'grey')
		else:
			cf = imgconv.getconverter(vin.format, 'rgb')
	except imgconv.error:
		print 'Sorry, no converter available for type',vin.format
		return

	if mono:
		depth = 1
		bpp = 1
	else:
		depth = 3
		bpp = 4

	convert(vin, cf, width, height, depth, bpp, vin.packfactor)
Пример #7
0
#! /usr/bin/env python
# Convert CMIF movie file(s) to a sequence of rgb images
# Help function

def help():
    print 'Usage: video2rgb [options] [file] ...'
    print
    print 'Options:'
    print '-q         : quiet, no informative messages'
    print '-m         : create monochrome (greyscale) image files'
    print '-f prefix  : create image files with names "prefix0000.rgb"'
    print 'file ...   : file(s) to convert; default film.video'

# Imported modules
import sys
sys.path.append('/ufs/jack/src/av/video')  # Increase chance of finding VFile
import VFile
import time
import getopt
import string
import imgfile
import imgconv
# Global options
quiet = 0
prefix = 'film'
seqno = 0
mono = 0
# Main program -- mostly command line parsing

def main():
Пример #8
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'