Discord.py: ffmpeg/avconv not found in your PATH environment variable... but it is?

Created on 17 Mar 2018  路  6Comments  路  Source: Rapptz/discord.py

I'm writing a bot that joins the voice channel and plays a sound on my PC. Problem is, every time the command is issued, I get a big ol' error ending with: " Command raised an exception: ClientException: ffmpeg/avconv was not found in your PATH environment variable ". Now, I've checked my PATH variable multiple times, and it correctly points to the ffmpeg\bin folder. Any fixes? Thanks.

question

Most helpful comment

If you're on Windows

  1. First, you need to check that you have ffmpeg/avconv installed somewhere, and that you know where it is.

    • The path you need to be concerned about is the one that directly contains ffmpeg.exe or avconv.exe

    • For example, in this situation, I need C:\ffmpeg\bin:

      image

  2. You need to get to your environment variables listing to add ffmpeg or avconv to your PATH.

    • You can press WinKey + Pause/Break to open your system information

    • If you don't have a Pause/Break key (such as if you are on a laptop), you can press WinKey + E to open Explorer. From there, right click on "This PC" in the list on the left and press "Properties" to open your system information.

    • You can then open the environment variables listing by clicking 'Advanced system settings' and pressing the 'Environment variables' button

    • Click the 'PATH' listing and select 'Edit'

    • If your version shows both user and system-related lists, select the one in the system list.

    • Add the path you found before to this list.

    • On newer versions of Windows, you can just press 'New' and give the path from before. Move this entry to the top of the list.

    • On older versions, PATH is a semicolon-separated list. Add the path from before to the start, separating it from everything else with a semicolon (so that it looks like C:\ffmpeg\bin;C:\Windows\..., for example.)

    • Press OK as many times as necessary to exit out of the settings completely.

  3. You need to close all open command prompts (and optionally reboot) to apply the new environment variables for the next command prompt session.

    • Once you've closed everything, open up a new command prompt (cmd).

    • Type ffmpeg or avconv. If you get a bunch of help spam, you've updated your PATH correctly.

  4. Try running your bot from a new command prompt window.

    • If you usually start your bot from an IDE, you may need to close and reopen the IDE to refresh its environment variables (in a similar fashion to the command prompts)

    • If you're using avconv, remember that you need to tell the library you're doing so:

      image

  5. ffmpeg or avconv should now be working and usable by your bot.

If you're on Linux

  1. You need to check you have ffmpeg/avconv installed, and that you know where it is.

    • The path you need to be concerned about is the one that directly contains the avconv or ffmpeg executable (or a symlink to it).

    • For example, in this situation, my path of concern is /home/myuser/ffmpeg/bin:

      image

    • If this path is a standard location such as /bin, /usr/bin, /usr/local/bin then you may not need to edit PATH at all, and can skip directly to 3.

  2. You need to edit one of your shell setup files to add the ffmpeg/avconv directory to PATH.

    • Unlike Windows, PATH isn't a single variable that simply gets spawned into every shell session. It is instead initialized by the various programs that create your shell environment.

    • Bash has two files, ~/.bashrc and ~/.bash_profile that it, and some other shells, use to set up the environment. ~/.bash_profile is the preferred option, as it is used in more cases.

    • You can edit these files using nano or etc to include export PATH=/home/myuser/ffmpeg/bin:$PATH (substitute my example path for your own) to add your ffmpeg/avconv path to PATH whenever your shell loads.

    • You can then use source ~/.bash_profile to immediately apply the effects to the current shell.

    • If you use a shell not compatible with Bash, you may need to look up the alternatives for these files and commands.

  3. Type in ffmpeg or avconv into your shell. If it comes up with a lot of help spam, you've added ffmpeg to your PATH correctly.
  4. Try running your bot from your shell.

    • If you're on a graphical install of Linux, and are using an IDE, you may need to set up additional things in the IDE itself to apply environment variables if restarting doesn't automatically apply them.

    • If you're using avconv, remember that you need to tell the library you're doing so:

      image

  5. ffmpeg or avconv should now be working and usable by your bot.

All 6 comments

Same issue here, If you find a solution can you please post.

Thanks :D

If you're on Windows

  1. First, you need to check that you have ffmpeg/avconv installed somewhere, and that you know where it is.

    • The path you need to be concerned about is the one that directly contains ffmpeg.exe or avconv.exe

    • For example, in this situation, I need C:\ffmpeg\bin:

      image

  2. You need to get to your environment variables listing to add ffmpeg or avconv to your PATH.

    • You can press WinKey + Pause/Break to open your system information

    • If you don't have a Pause/Break key (such as if you are on a laptop), you can press WinKey + E to open Explorer. From there, right click on "This PC" in the list on the left and press "Properties" to open your system information.

    • You can then open the environment variables listing by clicking 'Advanced system settings' and pressing the 'Environment variables' button

    • Click the 'PATH' listing and select 'Edit'

    • If your version shows both user and system-related lists, select the one in the system list.

    • Add the path you found before to this list.

    • On newer versions of Windows, you can just press 'New' and give the path from before. Move this entry to the top of the list.

    • On older versions, PATH is a semicolon-separated list. Add the path from before to the start, separating it from everything else with a semicolon (so that it looks like C:\ffmpeg\bin;C:\Windows\..., for example.)

    • Press OK as many times as necessary to exit out of the settings completely.

  3. You need to close all open command prompts (and optionally reboot) to apply the new environment variables for the next command prompt session.

    • Once you've closed everything, open up a new command prompt (cmd).

    • Type ffmpeg or avconv. If you get a bunch of help spam, you've updated your PATH correctly.

  4. Try running your bot from a new command prompt window.

    • If you usually start your bot from an IDE, you may need to close and reopen the IDE to refresh its environment variables (in a similar fashion to the command prompts)

    • If you're using avconv, remember that you need to tell the library you're doing so:

      image

  5. ffmpeg or avconv should now be working and usable by your bot.

If you're on Linux

  1. You need to check you have ffmpeg/avconv installed, and that you know where it is.

    • The path you need to be concerned about is the one that directly contains the avconv or ffmpeg executable (or a symlink to it).

    • For example, in this situation, my path of concern is /home/myuser/ffmpeg/bin:

      image

    • If this path is a standard location such as /bin, /usr/bin, /usr/local/bin then you may not need to edit PATH at all, and can skip directly to 3.

  2. You need to edit one of your shell setup files to add the ffmpeg/avconv directory to PATH.

    • Unlike Windows, PATH isn't a single variable that simply gets spawned into every shell session. It is instead initialized by the various programs that create your shell environment.

    • Bash has two files, ~/.bashrc and ~/.bash_profile that it, and some other shells, use to set up the environment. ~/.bash_profile is the preferred option, as it is used in more cases.

    • You can edit these files using nano or etc to include export PATH=/home/myuser/ffmpeg/bin:$PATH (substitute my example path for your own) to add your ffmpeg/avconv path to PATH whenever your shell loads.

    • You can then use source ~/.bash_profile to immediately apply the effects to the current shell.

    • If you use a shell not compatible with Bash, you may need to look up the alternatives for these files and commands.

  3. Type in ffmpeg or avconv into your shell. If it comes up with a lot of help spam, you've added ffmpeg to your PATH correctly.
  4. Try running your bot from your shell.

    • If you're on a graphical install of Linux, and are using an IDE, you may need to set up additional things in the IDE itself to apply environment variables if restarting doesn't automatically apply them.

    • If you're using avconv, remember that you need to tell the library you're doing so:

      image

  5. ffmpeg or avconv should now be working and usable by your bot.

Hi I've followed the guide for windows all the way up to the path variable and I've put the exact location of the path "C:ffmpeg\bin" and I still get the 'ffmpeg' is not a recognised as an internal or external command.....

If I enter C:ffmpeg\binffmpeg.exe -codecs it does work so not sure what is going wrong.

@JohnReilly70 Could you show what your PATH looks like, and through what method you're starting your bot?

sorry for late reply but I realised my issue was a missing semi-colon in one of the other programs which meant anything after it did not run.

Its now all working correctly. Apologise for my idiocy!

Hi,

I have an issue about ffmpeg
this is my command :

pydub.AudioSegment.converter = r"C:\Program Files\ffmpeg\bin\ffmpeg.exe"

I have added the Path as in the docs, but I am still not able to find my mp3 file.

Any thoughts ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcoshuck picture marcoshuck  路  16Comments

Mercurial picture Mercurial  路  22Comments

ThePiGuy24 picture ThePiGuy24  路  17Comments

Chicchi73930 picture Chicchi73930  路  17Comments

ams2990 picture ams2990  路  14Comments