linux下载源码并编译x264,x265并引用进FFmpeg

    技术2022-07-13  65

    x264源码下载地址:https://www.videolan.org/developers/x264.html

    x265源码下载地址:https://www.videolan.org/developers/x265.html

    FFmpeg官网源码下载地址:http://ffmpeg.org/download.html

    FFmpeg默认支持H264的解码,但是并不支持H264的编码,如果想要让FFmpeg支持H264编码就要从外部引入X264进FFmpeg,如果想要支持H265的编解码,就要从外部引入X265的静态库进FFmpeg。FFmpeg使用的是静态链接,所以,引入的x264、x265都要先编译成静态库.

    1.下载并编译x264:

    git clone git://git.videolan.org/x264.git ./configure --enable-shared --enable-static --prefix=/home/jake/ffmpeg/ffmpeg-4.3/external-lib/x264/static make -j8 make install

    生产的静态库就会在/home/jake/ffmpeg/ffmpeg-4.3/external-lib/x264/static这个目录下:

    后续,需要将static下的静态库的路径配置给FFmpeg,然后编译FFmpeg,使得FFmpeg中有x264的支持。 2.把libx264编译到ffmpeg:

    ./configure --enable-gpl --enable-libx264 --prefix=/home/jake/ffmpeg/ffmpeg-4.3 make -j8 make instal

    到底有没有成功把x264添加进FFmpeg,使用FFmpeg命令查看一下:

    Processed: 0.021, SQL: 9