FFMPEG编译问题记录

一、ffmpeg下载与配置

下载地址 FFmpeg/FFmpeg (https://github.com/FFmpeg/FFmpeg)

~$ git clone https://github.com/FFmpeg/FFmpeg.git 

 

二、根据应用场景编译安装

配置时如果需要支持 H.264 视频编码格式,需要在编译ffmpeg时在命令行打开编译选项 --enable-gpl --enable-libx264 

1. 编译安装x264

可以直接利用系统安装包

~$ apt install libx264-dev

也可以自行从源码编译,官方网站 VideoLAN, a project and a non-profit organization. (https://www.videolan.org/developers/x264.html)

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

然后进入 x264 目录

~$ cd x264

~$ mkdir x264-bin

~$ ./configure --enable-shared --enable-static --prefix=./x264-bin

~$ make install

2. 配置安装 ffmpeg

x264配置完成后开始配置ffmpeg

~$ mkdir ffmpeg-bin

~$ ./configure --prefix=./ffmpeg-bin --enable-gpl --enable-libx264 --disable-ffplay --disable-ffserver --enable-nonfree --disable-shared --enable-cudacc \
--extra-cflags="-I/usr/local/cuda-11.0/targets/x86_64-linux/include/ -I../x264/x264-bin/include" \
--extra-ldflags="-L../x264/x264-bin/lib"

~$ make -j && make install

3. 编译过程遇到的问题及解决方案

查了一下,找到一个相同的问题,大概是ffmpeg与x264版本不对应引起的

error: ‘x264_bit_depth’ undeclared (first use in this function)

截图如下

改一下版本重新编译x264即可,然后再次编译 ffmpeg 就没问题了。

安装完成后即可使用

~$ ./ffmpeg -i test.mp4 -f null -
posted @ 2021-01-20 15:02  coffee_tea_or_me  阅读(956)  评论(0编辑  收藏  举报