How to make ffmpeg executable everywhere?

I have installed ffmpeg by following this tutorial on trac.ffmpeg.org

Now, ffmpeg works if I cd to bin and execute it with ./ffmpeg

I wonder if I could execute ffmpeg just by typing ffmpeg in a terminal from anywhere.

0

2 Answers

You don't need to edit your PATH or ~/.bashrc

  • The guide "installs" ffmpeg inside ~/bin so it does not potentially interfere with conflicting repository packages.

  • There is no need to edit your PATH or ~/.bashrc as shown in the accepted answer. ~/bin is already in the PATH by default (take a look at ~/.profile), but ~/bin is not included when you login if it does not exist (and it did not exist before you compiled), but you can easily "refresh" it as shown below.

All you need to do is this:

hash -r
. ~/.profile

Alternatively you can simply log out then log in.

Now you can run ffmpeg from any directory and it will automatically execute the ffmpeg binary in ~/bin (for the particular user who compiled ffmpeg). All of this is explained in the guide you linked to.

Getting it to work for all users

The above instructions are for the single user who compiled ffmpeg. If you have multiple users you can just move or copy the compiled ffmpeg binary into /usr/local/bin.

You can simply add ffmpeg directory to your $PATH. Assuming you're using bash open ~/.bashrc file and add at the bottom:

export PATH=$PATH:<path where you installed ffmpeg>

and reload bash ( close and open terminal again or type 'bash' ).

edit: PATH represents list of directories that your shell is using to find binary files. So you need to add directory, not the file, path to that variable. Assuming that you executed everything exactly the way that manual said you need to add to you .bashrc that command:

export PATH=$PATH:$HOME/bin
4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like