linux 下载及安装ffmpeg

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

    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



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

分享给朋友:

相关文章

使用Myeclipse 8.5开发基于JAX-WS的Web service实例

 本文为Web service 开发入门篇,主要介绍在Myeclipse 8.5环境下开发Web service的服务程序和客户端程序的基本流程。 在Weblogic 11g...

freemarker 判断日期变量为空处理 及InvalidReferenceException异常处理

at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98);InvalidR...

我差不多是个废人了,感觉身体被掏空

林心如跟霍建华都结婚了,滴滴跟优步都在一起了。我们也应该抱住了吧? 终于8月了,超吃点吧,再一咬牙,坚持一下吧,马上秋天到了,就可以又能马上把肥肉藏起来了。 在这里迫不及待教大家一个夏天过后...

jquery 获取焦点

当文本框或下拉等必填时,如果没有输入就给予提示并使该文本框获得焦点!如果是js,对象.focus()即可。可是如果是jQuery, 这样$("#aa") 返回的就不是DOM对象而是...

共享单车已经过时了!!!共享汽车要来了!比私家车和打车都便宜!

共享单车已经过时了!!!共享汽车要来了!比私家车和打车都便宜!

继共享单车后共享汽车也要来济南啦!无车一族!刚拿到驾照想练手的新手!以及想换个方式开车兜风的你们!还有讨厌打车又讨厌停车的你们!福音啊!10日,济南市人大代表、济南市停车集团董事长兼总经理白冰说济南市...

UUID 生成方法

import java.util.UUID;/**     * UUID 生成方法     * @return uuid &nbs...

发表评论

访客

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