def unzip_snap_mp4(abspath, quiet=False):
    zipped_snap = ZipFile(abspath)

    # unzip /path/to/zipfile.mp4 to /path/to/zipfile
    unzip_dir = os.path.splitext(abspath)[0]
    zipped_snap.extractall(unzip_dir)

    # move /path/to/zipfile.mp4 to /path/to/zipfile.zip
    os.rename(abspath, unzip_dir + '.zip')

    for f in os.listdir(unzip_dir):
        # mv /path/to/zipfile/media~* /path/to/zipfile.mp4
        if f.split('~')[0] == 'media':
            os.rename(os.path.join(unzip_dir, f), unzip_dir + '.mp4')

        # mv /path/to/zipfile/overlay~* /path/to/zipfile_overlay.png
        elif f.split('~')[0] == 'overlay':
            os.rename(os.path.join(unzip_dir, f),
                      unzip_dir + '_overlay.png')

    try:
        os.rmdir(unzip_dir)
    except __HOLE__:
        print('Something other than a video or overlay was in {0}. \
               Cannot remove directory, not empty.'
              .format(unzip_dir + '.zip'))

    if not quiet:
        print('Unzipped {0}'.format(abspath))
dataset/ETHPy150Open rxw/snapy/snapy/utils.py/unzip_snap_mp4