def test_encode_success(self):
        """encode test with succeeded"""
        mock('encoder.subprocess.Popen', returns=Mock(
            'proc',
            communicate=Mock(
                'proc.communicate',
                returns=(b'', b'')),
            returncode=0))

        encoder.encode('aaa.m2ts', 'bbb.mp4', reso='1280x720', vb_mbps=2, ab_kbps=256, is_deint=False)
Exemple #2
0
def main():
    """ main routine.
    """
    args = init_args()

    logging.basicConfig(
        level=get_logging_level_from(args.level),
        format='%(asctime)s-%(levelname)s: %(message)s')

    for (source_file, dest_file) in gen_src_dst(args.source, args.dest):
        try:
            if not os.path.isfile(dest_file):
                encode(
                    source_file, dest_file,
                    reso='1280x720', vb_mbps=args.video_bitrate, ab_kbps=args.audio_bitrate,
                    is_deint=args.deinterlace)
        except Exception:
            logging.error("{} has some problem...".format(source_file))
            continue
        else:
            os.remove(source_file)
            logging.error("{} has been removed.".format(source_file))
Exemple #3
0
def main():
    """ main routine.
    """
    args = init_args()

    logging.basicConfig(level=get_logging_level_from(args.level),
                        format='%(asctime)s-%(levelname)s: %(message)s')

    for (source_file, dest_file) in gen_src_dst(args.source, args.dest):
        try:
            if not os.path.isfile(dest_file):
                encode(source_file,
                       dest_file,
                       reso='1280x720',
                       vb_mbps=args.video_bitrate,
                       ab_kbps=args.audio_bitrate,
                       is_deint=args.deinterlace)
        except Exception:
            logging.error("{} has some problem...".format(source_file))
            continue
        else:
            os.remove(source_file)
            logging.error("{} has been removed.".format(source_file))