I have dedicated server. I have installed FFmpeg on my root. All commands related to FFmpeg works if I logged in as root but no command is working if I logged in as user. I have tried adding one user to sudoers also. Also I want to use FFmpeg commands in PHP shell_exec() or exec(). Can someone tell me the solution. Thanks in advance.
user command:
$ ffmpeg
output:
-bash: ffmpeg: command not found
root command:
$ ffmpeg
output
ffmpeg version N-93394-g14eea7c Copyright (c) 2000-2019 the FFmpeg
developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-23)
configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --
extra-cflags=-I/root/ffmpeg_build/include -
-extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs=-lpthread --extra-
libs=-lm --bindir=/root/bin --enable-gpl --enab
le-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --
enable-libvpx --enable-libx264 --enable-libx
265 --enable-nonfree
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 47.103 / 58. 47.103
libavformat 58. 26.101 / 58. 26.101
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options]
outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
Ensure that the user's PATH includes the directory in which the ffmpeg binaries are located (usually /usr/local/bin
or /opt/local/bin
).
If you can't find it, you can ask the system which one it uses when you're logged in as root with the command:
which ffmpeg
In your case, per the info you've added to the question, it looks like the binaries are in /root/bin
Which may be a problem in itself, if /root/bin is not world readable and the contents world executable.