杰克工作室 发表于 2023-4-27 10:41

centos7.9安装ffmpeg去水印

老天爷对我简直是太友好了,别人在centos7.9上安装ffmpeg,直接 yum install -y ffmpeg 就行,轮到我执行此命令时,给我了一个惊喜:
<pre>
Error: Package: ffmpeg-libs-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libzvbi.so.0()(64bit)
Error: Package: ffmpeg-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libOpenCL.so.1()(64bit)
Error: Package: ffmpeg-libs-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libmodplug.so.1()(64bit)
Error: Package: ffmpeg-libs-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libmfx.so.0()(64bit)
Error: Package: libavdevice-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libjack.so.0()(64bit)
Error: Package: ffmpeg-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libSDL2-2.0.so.0()(64bit)
Error: Package: ffmpeg-libs-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libass.so.5()(64bit)
Error: Package: ffmpeg-libs-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libOpenCL.so.1(OPENCL_1.0)(64bit)
Error: Package: ffmpeg-libs-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libOpenCL.so.1()(64bit)
Error: Package: ffmpeg-libs-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libmp3lame.so.0()(64bit)
Error: Package: libavdevice-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libSDL2-2.0.so.0()(64bit)
Error: Package: ffmpeg-libs-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libsoxr.so.0()(64bit)
Error: Package: ffmpeg-libs-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libvidstab.so.1.1()(64bit)
Error: Package: libavdevice-3.4.12-1.el7.x86_64 (rpmfusion-free-updates)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Requires: libopenal.so.1()(64bit)

</pre>

<p>至于这样对我吗?明明yum search ffmpeg 有的呀,为啥就是不给我安装呢?<br />
<img alt="" src="data/attachment/forum/202304/27/104048a84v8z94o4dmvu88.jpg" style="height:539px; width:633px" /></p>

杰克工作室 发表于 2023-4-27 10:50

似乎只有编译安装了:<br />
<u><strong>也可以在http://ffmpeg.org/releases/下载最新版进行编译,我选择的是一个有点旧的版本,毕竟centos不适合新版本,包括下面安装的yasm都需要升级。</strong></u><br />
<br />
yum install -y yasm
<pre>
-------结果来了一个:
<img alt="" src="data/attachment/forum/202304/27/104414ah1s6hekhk6ehlsf.jpg" style="height:199px; width:422px" />
Error:Nothing to do, 法克</pre>

<div style="background:#eeeeee; border:1px solid #cccccc; padding:5px 10px">编译安装yasm吧:<br />
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz<br />
tar zxvf yasm-1.3.0.tar.gz<br />
./configure<br />
make &amp;&amp; make install</div>
<br />
编译安装ffmpeg:
<div style="background:#eeeeee; border:1px solid #cccccc; padding:5px 10px">wget http://ffmpeg.org/releases/ffmpeg-4.2.4.tar.bz2<br />
tar -jxf ffmpeg-4.2.4.tar.bz2<br />
cd ffmpeg-4.2.4<br />
./configure <span style="color:#e74c3c">--enable-gpl</span><br />
make&nbsp;<br />
make install</div>
ffmpeg -version<br />
<img alt="" src="data/attachment/forum/202304/27/104732we1ii15h6f55p1f5.jpg" style="height:237px; width:602px" /><br />
<br />
参考网址:<br />
https://www.cnblogs.com/flying607/p/13153246.html<br />
https://learnku.com/articles/54342

杰克工作室 发表于 2023-4-27 10:51

接2楼贴讲一个报错:<br />
<br />
如果./configure 没有 --enable-gpl,处理图片时会报错:
<div style="background:#eeeeee; border:1px solid #cccccc; padding:5px 10px">Input #0, image2, from &#39;/www/wwwroot/www.xxx.com/htdocs/data/attachment/forum/202304/27/aaa.jpg&#39;:<br />
&nbsp; Duration: 00:00:00.04, start: 0.000000, bitrate: 33888 kb/s<br />
&nbsp; &nbsp; Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1280x960 , 25 tbr, 25 tbn, 25 tbc<br />
Stream mapping:<br />
&nbsp; Stream #0:0 -&gt; #0:0 (mjpeg (native) -&gt; mjpeg (native))<br />
Press to stop, [?] for help<br />
No such filter: &#39;delogo&#39;<br />
Error reinitializing filters!<br />
Failed to inject frame into filter network: Invalid argument<br />
Error while processing the decoded data for stream #0:0<br />
Conversion failed!</div>
<br />
<br />
<br />
看人家安装的多顺利呀:https://blog.csdn.net/lovequanquqn/article/details/102959537,基本上一步到位,唉。

杰克工作室 发表于 2023-4-27 20:52

<h1>使用静态ffmpeg二进制文件秒安装ffmpeg</h1>

<p>说明:我们安装很多视频程序的时候都需要用到ffmpeg,差不多都喜欢用编译安装,过程很慢,而且有的系统会因为一些依赖出现很多问题,导致安装失败。有时候就算ffmpeg编译安装成功了,也会因为一些因素导致某些视频程序自动转码失败,比如博主之前发的AVS和PlayTube,不过还好的是被这个静态ffmpeg给拯救了,这里就说下ffmpeg最简单安装方法,就是直接使用编译好的静态ffmpeg二进制文件,无需安装即可使用,间接的可以说是秒安装了。</p>

<p>安装</p>

<p>安装文档:https://www.johnvansickle.com/ffmpeg/faq</p>

<p>系统要求:CentOS、Debian、Ubuntu等内核至少为2.6.32的Linux系统(内核查看命令uname -r)。</p>

<p>首先我们找到适合自己VPS服务器架构的ffmpeg二进制文件,文件地址:https://www.johnvansickle.com/ffmpeg/,建议优先使用git版本,毕竟更新快,如果git没有对应的版本就使用release版本。</p>

<p>安装命令:</p>

<pre>
#x86下载二进制文件
wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-static.tar.xz
#x86_64下载二进制文件
wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-static.tar.xz

#解压文件
tar xvf ffmpeg-git-*-static.tar.xz &amp;&amp; rm -rf ffmpeg-git-*-static.tar.xz

#将ffmpeg和ffprobe可执行文件移至/usr/bin方便系统直接调用
mv ffmpeg-git-*/ffmpegffmpeg-git-*/ffprobe /usr/bin/

#查看版本
ffmpeg
ffprobe</pre>

<p>最后基本上算安装完成了。</p>

<p>一般我们除了视频程序需要用到ffmpeg外,还可以直接拿来使用,比如转换视频格式、提取音频、合并视频等等,具体命令可以自行百度/谷歌。<br />
<br />
源文地址:<br />
https://cloud.tencent.com/developer/article/1358626?from=15425&amp;areaSource=102001.19&amp;traceId=75v9fFkJ2R4ujjlajnSU2<br />
https://cloud.tencent.com/developer/article/1757463?from=15425&amp;areaSource=102001.8&amp;traceId=75v9fFkJ2R4ujjlajnSU2</p>

杰克工作室 发表于 2023-4-27 21:13


重点是 不同点:
命令名称                         是否将标准输出输出到终端         返回结果
exec                                  否                                                   shell命令输出结果的最后一行
shell_exec                        否                                                   shell命令全部的输出
system                              是                                                   shell命令输出结果的最后一行
passthru                           是                                                   NULL


以上只是我个人测试出的最明显的差别,
当然还会有一些疑问,比如他们是否都会阻塞php脚本
答案是:一般情况是的


但是如果你想非阻塞的话,也是有办法的
例如 exec("sleep 2>test.log 2>&1 &");
把shell放到后台执行,这里一定注意光是把作业放到后台是不行的,而且必须把标准输出重定向(标准错误不一定需要,但是建议习惯性这样做)

杰克工作室 发表于 2024-2-13 11:47

<h3>在debian 11.6上安装超级简单:</h3>
<br />
apt update<br />
apt install ffmpeg<br />
<br />
查看安装的ffmpeg版本:ffmpeg -version<br />
<br />
注:如果安装过程中提示缺少依赖项,您可以尝试以下解决方案:
<p>- 执行`sudo apt --fix-broken install`命令修复依赖关系。</p>

<p>- 检查软件源配置是否正确,并更新软件包列表。</p>

<p>- 执行`sudo apt-get build-dep ffmpeg`命令安装构建依赖项。</p>
页: [1]
查看完整版本: centos7.9安装ffmpeg去水印