yum安装ffmpeg最新版

﹏ヽ暗。殇╰゛Y 2023-06-13 15:27 92阅读 0赞

安装方法

1.安装编译环境,如果系统有就不用装了

  1. yum install -y automake autoconf libtool gcc gcc-c++
  2. yum install make
  3. yum install svn
  4. yum install git

2.如果还需要其他的软件就按照下面的方式安装

  1. yum search **
  2. yum install **

3.安装SDL2开发库(没有该库支持,后面安装ffmpeg时ffplay将装不了)
查看系统匹配的版本:

  1. yum search SDL2

安装SDL2开发库:

  1. yum install SDL2-devel.x86_64

4.安装libx264(没有该库支持,后面执行ffmpeg推流命令时可能报错)

5.通过git命令拉取最新的ffmpeg
方式一:官方地址下载用tar -xjvf ffmpeg-4.2.1.tar.bz2命令解压
方式二:直接通过git命令clone下载

  1. git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

国内git下载速度较慢,如果不需要最新版本,可以考虑通过svn下载(FFmpeg 2.8.5版本)
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

6.切换到下载的ffmpeg源码目录下执行以下命令

  1. ./configure --prefix=/usr/softinstall/ffmpeg --enable-gpl --enable-shared --enable-libx264

libx264未安装报错则需先行安装(libx264安装)

  1. make
  2. make install

7.配置环境变量(参考:安装linux下tar.gz包)

  1. vim /etc/profile
  2. export FFMPEG_PATH=/usr/softinstall/ffmpeg
  3. export CLASSPATH=$FFMPEG_PATH/lib:$CLASSPATH
  4. PATH=$FFMPEG_PATH/bin:$PATH
  5. source /etc/profile

测试

  1. ffmpeg -version

在这里插入图片描述

问题一

执行./configure --prefix=/usr/softinstall/ffmpeg命令时报错:

  1. [root@localhost ffmpeg]# ./configure --prefix=/usr/softinstall/ffmpeg
  2. nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
  3. If you think configure made a mistake, make sure you are using the latest
  4. version from Git. If the latest version fails, report the problem to the
  5. ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
  6. Include the log file "ffbuild/config.log" produced by configure as this will help
  7. solve the problem.

解决方案
缺失yasm,安装yasm(具体安装方式)

问题二

执行./configure --prefix=/usr/softinstall/ffmpeg命令时报错:

  1. libavcodec/x86/h264_qpel_mmx.c: Assembler messages:
  2. libavcodec/x86/h264_qpel_mmx.c:1294: Error: operand type mismatch for `cmp'
  3. libavcodec/x86/h264_qpel_mmx.c:1294: Error: operand type mismatch for `cmp'
  4. libavcodec/x86/h264_qpel_mmx.c:964: Error: operand type mismatch for `cmp'
  5. make: *** [libavcodec/x86/dsputil_mmx.o] Error 1

解决方案
libavcodec/x86/h264_qpel_mmx.c中的"g"替换为"rm"即可。
可以采用gedit使用批量替换。使用vim,进入命令行模式,输入:%s/"g"/"rm"/g即可全部替换。执行后就可以重新执行./configure命令了。

发表评论

表情:
评论列表 (有 0 条评论,92人围观)

还没有评论,来说两句吧...

相关阅读