5

FFMPEG编译支持x264及x265

 3 years ago
source link: https://blog.csdn.net/weixin_42955871/article/details/111915249
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

FFMPEG编译支持H264及H265

1、FFMPEG简介

官网地址:http://www.ffmpeg.org

FFmpeg是视频处理领域的瑞士军刀,可以用来记录、转换数字音频、视频,并能将其转化为流的开源程序,采用LGPL或GPL许可证。包含的核心库如下:

  • libavformat:用于各种音视频封装格式的生成和解析,包括获取解码所需信息以生成解码上下文结构
    和读取音视频帧等功能;
  • libavcodec:用于各种类型声音/图像编解码;
  • libavutil:包含一些公共的工具函数;
  • libswscale:用于视频场景比例缩放、色彩映射转换;
  • libpostproc:用于后期效果处理;
  • ffmpeg:该项目提供的一个工具,可用于格式转换、解码或电视卡即时编码等;
  • ffsever:一个 HTTP 多媒体即时广播串流服务器;
  • ffplay:是一个简单的播放器,使用ffmpeg 库解析和解码,通过SDL显示;

2、FFMPEG下载及编译

下载地址: http://www.ffmpeg.org/download.html

2.1 版本选择

4.3.1

2.2 版本编译

(1)将ffmpeg源码ffmpeg-4.3.1.tar.xz copy到avtest里
在这里插入图片描述
(2)解压
解压命令:

tar xvJf ./ffmpeg-4.3.1.tar.xz

解压后如下:
在这里插入图片描述
(3)编译
首先进入ffmpeg-4.3.1根目录,并创建build.sh文件,内容如下:

x264_install="/home/eric/av/x264_install"
x265_install="/home/eric/av/x265_install"

export PATH=$x264_install/bin:$PATH

export PATH=$x265_install/bin:$PATH

export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
export PKG_CONFIG_PATH=$x264_install/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=$x265_install/lib/pkgconfig:$PKG_CONFIG_PATH

echo $PKG_CONFIG_PATH

./configure --prefix="/home/eric/avtest/ffmpeg_install" --pkg-config-flags="--static"  --disable-asm --enable-gpl --enable-libx264 --enable-libx265 --enable-ffplay

注意:这里依赖x264和x265的库路径。这两个库如何编译,在前边的博文有说明,大家可参考。
大家可以根据自己x264和x265的时间安装位置修改该路径,这里只是博哥的本机路径。

然后 在build.sh当前目录下运行:

sh build.sh
make
make install

若是一切顺利,将在指定目录(–prefix="/home/eric/avtest/ffmpeg_install" )下生成相关文件,如下图所示:
在这里插入图片描述
若是你也看到如下目录的内容,恭喜您,可以开启ffmpeg之旅了。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK