Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg/avconv not found in your PATH environment variable... but it is? #1149

Closed
TheVortexian opened this issue Mar 17, 2018 · 6 comments
Closed
Labels
question This is a question about the library

Comments

@TheVortexian
Copy link

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.

@JohnReilly70
Copy link

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

Thanks :D

@Gorialis
Copy link
Contributor

Gorialis commented Mar 31, 2018

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
  1. 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.
  1. 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.
  1. 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
  1. 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.
  1. 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.
  1. 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.
  2. 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
  1. ffmpeg or avconv should now be working and usable by your bot.

@Rapptz Rapptz added the question This is a question about the library label Mar 31, 2018
@Rapptz Rapptz closed this as completed Mar 31, 2018
@JohnReilly70
Copy link

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\bin\ffmpeg.exe -codecs it does work so not sure what is going wrong.

@Gorialis
Copy link
Contributor

Gorialis commented Apr 2, 2018

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

@JohnReilly70
Copy link

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!

@Sobiam1
Copy link

Sobiam1 commented Oct 1, 2019

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a question about the library
Projects
None yet
Development

No branches or pull requests

5 participants