0
votes

Before enter data, I import a lib, but this lib give an error like this /

Warning (from warnings module): File "C:\Users\Samuel\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pydub\utils.py", line 165 warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning) RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work

Warning (from warnings module): File "C:\Users\Samuel\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pydub\utils.py", line 179 warn("Couldn't find ffplay or avplay - defaulting to ffplay, but may not work", RuntimeWarning) RuntimeWarning: Couldn't find ffplay or avplay - defaulting to ffplay, but may not work

1

1 Answers

0
votes

TL;DR: As the source code indicates, you should install ffmpeg add it to your %PATH%. Since ffplay comes with ffmpeg, this should solve your problem.

You can install ffmpeg here: http://ffmpeg.org/

After installation, you can open your control panel, and then search environment. There you can adjust your %PATH% variable. Add the ffmpeg installation's binary path to the %PATH%.

And here's why from source code:

def get_encoder_name():
    """
    Return enconder default application for system, either avconv or ffmpeg
    """
    if which("avconv"):
        return "avconv"
    elif which("ffmpeg"):
        return "ffmpeg"
    else:
        # should raise exception
        warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
        return "ffmpeg"

def get_player_name():
    """
    Return enconder default application for system, either avconv or ffmpeg
    """
    if which("avplay"):
        return "avplay"
    elif which("ffplay"):
        return "ffplay"
    else:
        # should raise exception
        warn("Couldn't find ffplay or avplay - defaulting to ffplay, but may not work", RuntimeWarning)
        return "ffplay"

def which(program):
    """
    Mimics behavior of UNIX which command.
    """
    # Add .exe program extension for windows support
    if os.name == "nt" and not program.endswith(".exe"):
        program += ".exe"

    envdir_list = [os.curdir] + os.environ["PATH"].split(os.pathsep)

    for envdir in envdir_list:
        program_path = os.path.join(envdir, program)
        if os.path.isfile(program_path) and os.access(program_path, os.X_OK):
            return program_path

From this we can know that it looks up those programs from your environment variable %PATH%. And that's why installing those softwares and adding them to your %PATH% should solve the problem.