centos7安装ffmpeg及nasm等各组件

一、安装nasm
下载nasm软件包
wget https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz

解压并安装
tar -xvf nasm-2.14.tar.gz
 
cd nasm-2.14/
 
./configure
 
make && sudo make install

验证是否已安装
nasm -version

[root@x nasm-2.14]# nasm -version
NASM version 2.14 compiled on Aug 30 2022

二、安装yasm
下载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 && sudo make install

验证是否已安装
[root@xyasm-1.3.0]# yasm --version
yasm 1.3.0
Compiled on Aug 30 2022.
Copyright (c) 2001-2014 Peter Johnson and other Yasm developers.
Run yasm --license for licensing overview and summary.

三、安装x264
下载x264

通过git:

git clone https://code.videolan.org/videolan/x264.git

(或)访问官网:

https://www.videolan.org/developers/x264.html

安装

cd x264/
 
./configure --enable-shared --enable-static
 
make && sudo make install验证是否已安装
[root@x x264]# x264 --version
x264 0.164.3095 baee400
built on Aug 30 2022, gcc: 4.8.5 20150623 (Red Hat 4.8.5-44)
x264 configuration: --chroma-format=all
libx264 configuration: --chroma-format=all
x264 license: GPL version 2 or later

四、安装pkg
先检查是否已安装pkg,已安装可跳过,(编译ffmpeg错误:ERROR: x264 not found using pkg-config ---重装pkg   

pkg安装出现这种报错:

configure: error: pkg-config and "glib-2.0 >= 2.16" not found, please set GLIB_CFLAGS and GLIB_LIBS to the correct values or pass --with-internal-glib to configure

使用 ./configure --with-internal-glib

)


[root@x home]# pkg-config --version
0.27.1

下载pkg软件包
wet https://pkg-config.freedesktop.org/releases/pkg-config-0.27.1.tar.gz
 
tar -zxvf pkg-config-0.27.1.tar.gz
 
cd pkg-config-0.27.1

编译
./configure
 
make
 
make check
 
make install

验证是否已安装 (同最初命令)
pkg-config --version
 
0.27.1

五、安装ffmpeg
安装gcc编译器
yum install gcc

下载ffmpeg

6.0版本,快速下载

wget http://ffmpeg.org/releases/ffmpeg-6.0.tar.xz

(或)访问官网选择任意版本

http://ffmpeg.org/download.html#releases

解压

tar -zxvf ffmpeg-6.0.tar.xz
 
mv ffmpeg-6.0/ /usr/local/ffmpeg/

配置ffmpeg
cd /usr/local/ffmpeg
 
./configure --enable-gpl --enable-libx264 --enable-static --disable-shared --enable-encoder=libx264 --extra-libs=-ldl

编译执行
make && sudo make install

查询ffmpeg
[root@x ffmpeg]# ffmpeg
ffmpeg: error while loading shared libraries: libx264.so.164: cannot open shared object file: No such file or directory

如果报错没找到文件,则:

# 先找到缺失文件的位置,例如执行
find / -name ‘libx264.so.164’
# 得到
/home/soft/x264/libx264.so.164
/usr/local/lib/libx264.so.164

# 修改ld.so.conf
vim /etc/ld.so.conf
最后一行添加:/usr/local/lib/

[root@x home]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf

/usr/local/lib/

# 加载改动
ldconfig

检测是否安装成功
[root@x home]# ffmpeg
ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44)
  configuration: --enable-gpl --enable-libx264 --enable-static --disable-shared --enable-encoder=libx264 --extra-libs=-ldl
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.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'

配置环境变量
vim /etc/profile
# 新增
PATH=$PATH:/usr/local/ffmpeg/bin
export PATH

# 加载配置
source /etc/profile

六、测试
选择网络视频连接,进行下载测试,成功即全流程结束。

ffmpeg -i http://xxx.com/x.m3u8 -c:v libx264 -y -t 60 -timeout 100000 /home/test.ts

这些包我好像都上传了,不知道有没有审核过,应该设置了几个积分
 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在CentOS7上安装FFmpeg,可以按照以下步骤进行操作: 1. 首先,从FFmpeg官方网站(https://johnvansickle.com/ffmpeg/release-source/)下载Linux版的FFmpeg源码包。 2. 使用finalshell或其他SSH工具将下载的源码包(例如ffmpeg-4.1.tar.xz)上传到CentOS7主机上的某个目录(例如/soft/ffmpeg目录)。 3. 在CentOS7主机上打开终端,使用以下命令安装编译FFmpeg所需的依赖项: ``` sudo yum install epel-release sudo yum install autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel ``` 4. 解压源码包并切换到解压后的目录: ``` tar -xf ffmpeg-4.1.tar.xz cd ffmpeg-4.1 ``` 5. 使用以下命令配置编译选项: ``` ./configure --enable-shared --disable-static ``` 6. 运行以下命令编译并安装FFmpeg: ``` make sudo make install ``` 7. 安装完成后,可以使用以下命令检查FFmpeg是否成功安装: ``` ffmpeg -version ``` 如果成功安装,将显示FFmpeg的版本信息。 通过以上步骤,您可以在CentOS7上成功安装FFmpeg并开始使用其功能。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Centos7安装FFmpeg](https://blog.csdn.net/weixin_45344950/article/details/118700456)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [开发那些事儿:如何在CentOS7下安装部署ffmpeg?](https://blog.csdn.net/TsingSee/article/details/125395349)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值