【发布时间】:2019-03-20 10:55:39
【问题描述】:
我有专用服务器。我已经在我的根目录上安装了 FFmpeg。如果我以 root 身份登录,则与 FFmpeg 相关的所有命令都有效,但如果我以用户身份登录,则没有命令有效。我也尝试将一个用户添加到 sudoers。我还想在 PHP shell_exec() 或 exec() 中使用 FFmpeg 命令。谁能告诉我解决方案。提前致谢。
用户命令:
$ ffmpeg
输出:
-bash: ffmpeg: command not found
根命令:
$ ffmpeg
输出
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'
【问题讨论】:
-
命令在什么情况下不起作用?请输入您使用的确切命令行并粘贴整个输出/错误响应消息。
-
当我尝试以非 root 用户身份登录来触发 FFmpeg 时,我收到错误 -bash: ffmpeg: command not found
-
这意味着它不在用户的路径中。检查 PATH 设置并确保它包括 /usr/local/bin 或安装 ffmpeg 的任何位置。 (另外:编辑您的问题以包含此信息)
-
我使用命令 $ whereis ffmpeg 找到了 PATH,我得到了 PATH /usr/include/ffmpeg。使用此路径后,我遇到了同样的错误。感谢重播。
-
你如何“使用这条路径”? “包含”通常不是保存二进制文件的地方。以 root 身份运行时显示
which ffmpeg的输出。然后以其他用户的身份使用该完整行(完整路径加上 ffmpeg)。
标签: ffmpeg root centos6 shell-exec ffmpeg-php