# Path: ififuncs.py
# def hashlib_md5(filename):
#     '''
#     uses hashlib to return an MD5 checksum of an input filename
#     '''
#     read_size = 0
#     last_percent_done = 0
#     m = hashlib.md5()
#     total_size = os.path.getsize(filename)
#     with open(str(filename), 'rb') as f:
#         while True:
#             buf = f.read(2**20)
#             if not buf:
#                 break
#             read_size += len(buf)
#             m.update(buf)
#             percent_done = 100 * read_size / total_size
#             if percent_done > last_percent_done:
#                 sys.stdout.write('[%d%%]\r' % percent_done)
#                 sys.stdout.flush()
#                 last_percent_done = percent_done
#     md5_output = m.hexdigest()
#     return md5_output


import argparse
import subprocess
import sys
import os
import ififuncs
from ififuncs import hashlib_md5
        output = filename + "_h264.mov"
    ffmpeg_args = [
        'ffmpeg',
        '-i', filename,
    ]
    if args.logo:
        ffmpeg_args.extend(['-i', args.logo])
    ffmpeg_args += [
        '-c:a', 'aac',
        '-c:v', 'libx264',
        '-pix_fmt', 'yuv420p',
        '-crf', crf_value
    ]
    if args.wide:
        ffmpeg_args.append('-aspect')
        ffmpeg_args.append('16:9')
    if not args.map:
        ffmpeg_args.append('-map')
        ffmpeg_args.append('0:a?')
        ffmpeg_args.append('-map')
        ffmpeg_args.append('0:v')
    if len(filter_list) > 0:
        for _filter in filter_list:
            ffmpeg_args.append(_filter)
    ffmpeg_args.append(output)
    print(ffmpeg_args)
    subprocess.call(ffmpeg_args)
    if args.md5:
        manifest = '%s_manifest.md5' % filename
        print('Generating md5 sidecar...')

# Path: ififuncs.py
# def hashlib_md5(filename):
#     '''
#     uses hashlib to return an MD5 checksum of an input filename
#     '''
#     read_size = 0
#     last_percent_done = 0
#     m = hashlib.md5()
#     total_size = os.path.getsize(filename)
#     with open(str(filename), 'rb') as f:
#         while True:
#             buf = f.read(2**20)
#             if not buf:
#                 break
#             read_size += len(buf)
#             m.update(buf)
#             percent_done = 100 * read_size / total_size
#             if percent_done > last_percent_done:
#                 sys.stdout.write('[%d%%]\r' % percent_done)
#                 sys.stdout.flush()
#                 last_percent_done = percent_done
#     md5_output = m.hexdigest()
#     return md5_output


# Path: bitc.py
import argparse
import subprocess
import sys
import os
import ififuncs
from ififuncs import hashlib_md5

        output = filename + "_h264.mov"
    ffmpeg_args = [
        'ffmpeg',
        '-i', filename,
    ]
    if args.logo:
        ffmpeg_args.extend(['-i', args.logo])
    ffmpeg_args += [
        '-c:a', 'aac',
        '-c:v', 'libx264',
        '-pix_fmt', 'yuv420p',
        '-crf', crf_value
    ]
    if args.wide:
        ffmpeg_args.append('-aspect')
        ffmpeg_args.append('16:9')
    if not args.map:
        ffmpeg_args.append('-map')
        ffmpeg_args.append('0:a?')
        ffmpeg_args.append('-map')
        ffmpeg_args.append('0:v')
    if len(filter_list) > 0:
        for _filter in filter_list:
            ffmpeg_args.append(_filter)
    ffmpeg_args.append(output)
    print(ffmpeg_args)
    subprocess.call(ffmpeg_args)
    if args.md5:
        manifest = '%s_manifest.md5' % filename
        print('Generating md5 sidecar...')

        h264_md5 = hashlib_md5(filename)