def _get_or_fetch_platform_executables_else_raise_no_lock(fix_permissions=True):
    """Either get the executable or raise an error, internal api"""
    exe_dir = get_platform_dir()
    installed_crumb = os.path.join(exe_dir, "installed.crumb")
    if not os.path.exists(installed_crumb):
        print("\n===========ffmpeg is missing, fetching it now.=============\n")
        # All zip files store their platform executables in a folder
        # like "win32" or "darwin" or "linux" inside the executable. So root
        # the install one level up from that same directory.
        install_dir = os.path.dirname(exe_dir)
        try:
            os.makedirs(exe_dir)#, exist_ok=True)
        except:
            pass
        local_zip = exe_dir + ".zip"
        url = get_platform_http_zip()
        download_file(url, local_zip)
        print("Extracting %s -> %s"%(local_zip, install_dir))
        with zipfile.ZipFile(local_zip, mode="r") as zipf:
            zipf.extractall(install_dir)
        try:
            os.remove(local_zip)
        except OSError as err:
            print("%s: Error could not remove %s because of %s"%(__file__, local_zip, err))
        with open(installed_crumb, "wt") as filed:  # pylint: disable=W1514
            filed.write("installed from %s on %s"%(url, datetime.now().__str__()))
        print("=============================================================\n")
    ffmpeg_exe = os.path.join(exe_dir, "ffmpeg")
    ffprobe_exe = os.path.join(exe_dir, "ffprobe")
    if sys.platform == "win32":
        ffmpeg_exe = "%s.exe"%ffmpeg_exe
        ffprobe_exe = "%s.exe"%ffprobe_exe
    for exe in [ffmpeg_exe, ffprobe_exe]:
        if (
            fix_permissions
            and sys.platform != "win32"
            and (not os.access(exe, os.X_OK) or not os.access(exe, os.R_OK))
        ):
            # Set bits for execution and read for all users.
            exe_bits = stat.S_IXOTH | stat.S_IXUSR | stat.S_IXGRP
            read_bits = stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP
            os.chmod(exe, exe_bits | read_bits)
            assert os.access(exe, os.X_OK), "Could not execute %s"%exe
            assert os.access(exe, os.R_OK), "Could not get read bits of %s"%exe
    return ffmpeg_exe, ffprobe_exe
Either get the executable or raise an error, internal api
airtest/utils/ffmpeg/ffmpeg_setter.py