def main(argv): import getopt, re def usage(): print 'usage: %s [-d] [-r framerate] [-C WxH+X+Y] [-s scaling] file1 file2 ...' % argv[0] return 100 try: (opts, args) = getopt.getopt(argv[1:], 'dr:C:s:') except getopt.GetoptError: return usage() # debug = 0 info = SWFInfo() for (k, v) in opts: if k == '-d': debug += 1 elif k == '-r': info.set_framerate(float(v)) elif k == '-C': m = re.match(r'^(\d+)x(\d+)\+(\d+)\+(\d+)$', v) if not m: print >>stderr, 'Invalid clipping specification:', v return usage() x = map(int, m.groups()) info.clipping = (x[2],x[3], x[0],x[1]) elif k == '-s': info.scaling = float(v) if not args: print >>stderr, 'Specify at least one input movie.' return usage() return play(args, info, debug=debug)
def main(argv): import getopt, re def usage(): print "usage: %s [-d] [-r framerate] [-C WxH+X+Y] [-s scaling] file1 file2 ..." % argv[0] return 100 try: (opts, args) = getopt.getopt(argv[1:], "dr:C:s:") except getopt.GetoptError: return usage() # debug = 0 info = SWFInfo() for (k, v) in opts: if k == "-d": debug += 1 elif k == "-r": info.set_framerate(float(v)) elif k == "-C": m = re.match(r"^(\d+)x(\d+)\+(\d+)\+(\d+)$", v) if not m: print >> stderr, "Invalid clipping specification:", v return usage() x = map(int, m.groups()) info.clipping = (x[2], x[3], x[0], x[1]) elif k == "-s": info.scaling = float(v) if not args: print >> stderr, "Specify at least one input movie." return usage() return play(args, info, debug=debug)
def main(argv): import getopt def usage(): print >>stderr, '''usage: edit.py [-d] [-c] [-V] [-f|-F frames] [-a mp3file] [-r framerate] [-S mp3sampleskip] [-C WxH+X+Y] [-B blocksize] [-K keyframe] [-R framestep] [-s scaling] -o outfile.swf file1 file2 ... Specify one output filename from the following: *.swf: generate a reorganized and/or augmented movie. *.png|*.bmp: save snapshots of given frames as "X-nnn.png" *.mp3: extract an MP3 audio stream from a movie. -d: debug mode. -c: compression. -V: generate a movie in ScreenVideo format. (Flash version7 or above only) -f(-F) frames: frames to extract. e.g. 1-2,100-300,310,500- -F disables seeking audio. -R framestep: frame resampling step (default: 1) -s scaling: scale factor (default: 1) -a filename: attach MP3 file(s). (multiple files can be specified) -r framerate: override framerate. -B blocksize: (Video mode only) blocksize of video packet (must be a multiple of 16) -K keyframe: keyframe interval -S N: skip the first N samples of the sound when the movie starts. -C WxH+X+Y: crop a specific area of the movie. ''' sys.exit(2) try: (opts, args) = getopt.getopt(argv, 'dr:o:VcHa:S:C:B:K:f:F:R:s:') except getopt.GetoptError: usage() # debug = 0 info = SWFInfo() range_str = '-' step = 1 is_video = False kfinterval = 0 mp3skip = 0 mp3seek = True for (k, v) in opts: if k == '-d': debug += 1 elif k == '-r': info.set_framerate(float(v)) elif k == '-o': info.filename = v elif k == '-a': fp = file(v) print 'Reading mp3 file: %s...' % v info.reg_mp3blocks(fp) fp.close() elif k == '-S': mp3skip = int(v) assert 0 <= mp3skip elif k == '-C': m = re.match(r'^(\d+)x(\d+)\+(\d+)\+(\d+)$', v) if not m: print >>stderr, 'Invalid clipping specification:', v usage() x = map(int, m.groups()) info.clipping = (x[2],x[3], x[0],x[1]) elif k == '-B': blocksize = int(v) assert 0 < blocksize and blocksize <= 256 and blocksize % 16 == 0 info.blocksize = blocksize elif k == '-K': kfinterval = int(v) elif k == '-V': is_video = True elif k == '-c': info.compression = True elif k == '-f': range_str = v elif k == '-F': range_str = v mp3seek = False elif k == '-R': step = int(v) mp3seek = False elif k == '-s': info.scaling = float(v) if not args: print >>stderr, 'Specify at least one input movie.' usage() if not info.filename: print >>stderr, 'Specify exactly one output file.' usage() try: reorganize(info, args, range_str, step=step, is_video=is_video, kfinterval=kfinterval, mp3seek=mp3seek, mp3skip=mp3skip) except RangeError, e: print >>stderr, 'RangeError:', e