FFmpeg 命令仅适用于 root (centos 6.10)

标签 ffmpeg root centos6 shell-exec ffmpeg-php

我有专门的服务器。我已经在我的根目录上安装了 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'

最佳答案

确保用户的 PATH 包含 ffmpeg 二进制文件所在的目录(通常为 /usr/local/bin/opt/local/bin )。

如果找不到,可以在以 root 用户身份登录时使用以下命令询问系统使用的是哪一个:

which ffmpeg

在您的情况下,根据您添加到问题中的信息,看起来二进制文件位于/root/bin

如果/root/bin 不是世界可读且内容世界可执行,这本身可能是一个问题。

关于FFmpeg 命令仅适用于 root (centos 6.10),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55259080/

相关文章:

android - Android 中多次调用 ffmpeg main 失败

ffmpeg - DirectShow RTSP SourceFilter 与 MPEG-4 视频流

Windows 服务器上的 FFMPEG "Unknown encoder ' libfaac'"

ffmpeg - 使用 FFMPEG 将流从网站流式传输到 Twitch

python - 无法在运行 CentOS v6 的 Cloudera 快速启动 VM v5.13 中安装 pyhive

centOS 上的 Python netadd 模块

c - 用于求平方根的最快汇编代码。需要解释

python - 如何在没有 root 的情况下在 Python 中挂载共享驱动器?

ios - 越狱后,iOS 应用程序会以 root 权限运行吗?

linux - 如何在同一台服务器上混合使用基于 IP 和名称的虚拟主机?