linux 下载及安装ffmpeg

1545年前 (2020-09-09)站长必知2548

    java项目在压缩视频的时候使用了ffmpeg.exe,在windows系统下可以使用,发布到linux后无法直接调用ffmpeg.exe文件,需要在linux系统下安装ffmpeg。现总结如下:

1线上下载 及解压


wget http://www.ffmpeg.org/releases/ffmpeg-4.3.1.tar.gz
tar -zxvf ffmpeg-4.3.1.tar.gz


2、 进入解压后目录,输入如下命令/usr/local/ffmpeg为自己指定的安装目录.然后安装.如果出现错误,请看最后备注。

cd ffmpeg-4.3.1
./configure --prefix=/usr/local/ffmpeg
make && make install

注意:最后的安装时候需要很长时间,以及出现多个警告warning。没关系,等待即可。

3、配置环境变量(进入vi环境)


vi /etc/profile   然后一直按enter键往下走走到最后
在最后unset i后面添加环境变量(输入:i然后回车进入编辑模式):
export PATH=$PATH:/usr/local/ffmpeg/bin    回车
保存退出(:wq)
查看是否生效
source /ect/profile  设置生效

效果如下:

if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then
            . "$i"
        else
            . "$i" >/dev/null
        fi
    fi
done

unset i
export PATH=$PATH:/usr/local/ffmpeg/bin
"/etc/profile" 79L, 1876C written
[root@izm5e7giopzqoxm6ejeva8z ~]# source
-bash: source: filename argument required
source: usage: source filename [arguments]
[root@izm5e7giopzqoxm6ejeva8z ~]# source /etc/profile
[root@izm5e7giopzqoxm6ejeva8z ~]# ffmpeg
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)
  configuration: --prefix=/usr/local/ffmpeg
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.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@izm5e7giopzqoxm6ejeva8z ~]# ffmpeg -version
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)

4、配置完环境变量后 查看版本

ffmpeg -version    查看版本

环境变量配置完成前 查看版本

cd /usr/local/ffmpeg/bin 到ffmpeg的安装路径下
./ffmpeg -version    查看版本



备注:

如果出现一下错误:

[root@cf1f49f89164 ffmpeg-4.3.1]# ./configure --prefix=/usr/local/ffmpeg
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
则需要安装 yasm

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar -zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make && make install



本文原创,转载必追究版权。

分享给朋友:

相关文章

多说评论框怎么用更好

 1.隐藏屏蔽掉多说评论框的版权链接代码?简单css实现:多说隐藏版权链接,在后台自定义css添加:#ds-thread #ds-reset .ds-powered-by { display...

如何彻底卸载删除oracle数据库

 windows下如何彻底删除Oracle 软件环境: 1、Windows 2000+ORACLE 8.1.7 ,oracle 10g2、ORACLE安装路径为:C:\ORACLE实现方...

js/jquery 日历控件及实例下载

js/jquery 日历控件及实例下载

实现日历控件效果:页面:<link href="${base}/resource/${profile.path}/css/lhgcalendar.css" rel="...

Java 实现用户资料完整度的前端显示(或根据填写资料自动评分)

前端使用 Bootstrap 的进度条组件显示百分比,后台读取权重并计算信息完整度,并将计算的结果返回给前端,供页面显示。CSS1<link href="static/sc/...

谈话让别人舒服的程度,决定你成功的高度

谈话让别人舒服的程度,决定你成功的高度

职场上,有这样两种截然相反的人:有人生怕别人舒服,尽量让别人不舒服,而只要自己舒服就行;还有一类人生怕别人不舒服,尽量让别人舒服,哪怕委屈自己。猎头公司猎聘的老总有几十万年薪的,也有几百万的,甚至有过...

程序员为什么不炫富

程序员为什么不炫富

 提到互联网,尤其是互联网工程师们,人们往往会想到两个词:“高薪”和“高压”。在知乎上“为什么很少见工资高的程序员炫富?”的问题下,一个得票很高的答案是:“乐意炫富的人,不是因为有钱,而是因为付出的少...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。