#!/usr/local/bin/python3 ''' This script cuts a video It will be improved soon ''' import argparse import mediatools.videofile as video import mediatools.utilities as util parser = util.parse_common_args('Cuts a time window of the input video file') kwargs = vars(parser.parse_args()) util.check_environment(kwargs) start = kwargs.pop('start', None) stop = kwargs.pop('stop', None) ifile = kwargs.pop('inputfile') outputfile = video.VideoFile(ifile).cut(start, stop, **kwargs) util.debug(1, 'Generated %s' % outputfile)
targetfname = util.strip_file_extension(targetfname) + r'.' + ext directory = os.path.dirname(targetfname) if not os.path.exists(directory): os.makedirs(directory) if util.is_audio_file(fname): o_file = audio.AudioFile(fname) else: o_file = video.VideoFile(fname) outputfile = o_file.encode(targetfname, args.profile, **options) util.logger.info("File %s generated", outputfile) else: # Simply copy non media files copyfile(fname, targetfname) util.logger.info("Skipping/Plain Copy file %s", fname) i = i + 1 util.logger.info('%05d/%05d : 100%% : Job finished', nbfiles, nbfiles) parser = util.parse_common_args('Audio and Video file (re)encoder') parser = video.add_video_args(parser) myargs = parser.parse_args() myoptions = vars(myargs) util.check_environment(myoptions) myoptions = util.cleanup_options(myoptions) if os.path.isdir(myargs.inputfile): encode_dir(myargs, myoptions) else: encode_file(myargs, myoptions)
#!/usr/local/bin/python3 ''' This scripts adds a shaky effect to an image Effect can be horizontal or vertical Arguments: -c <color> -r <ratio> -n <slices> -d <direction> ''' import argparse import mediatools.utilities as util import mediatools.imagefile as image parser = util.parse_common_args('Image shake effect') parser.add_argument('-n', '--slices', required=False, default=10, help='Number of slices') parser.add_argument('-d', '--direction', required=False, default='vertical', help='Direction to slice') parser.add_argument('-c', '--color', required=False, default='black', help='Blinds color') parser.add_argument('-r', '--shake_ratio', required=False, default=3, help='Size of the shake') args = parser.parse_args() util.check_environment(vars(args)) image.ImageFile(args.inputfile).shake(int(args.slices), float(args.shake_ratio), args.color, args.direction)