1、官网下载ffmpeg4.1。
2、进入ffmpeg4.1根目录执行./configure --enable-shared --enable-gpl --enable-libx264 --enable-libspeex
3、执行make和make install。如果出现类似make: Warning: File `ffbuild/config.mak' has modification time 8011 s in the future的警告执行find . -type f | xargs -n 5 touch。
4、执行ldconfig加载。
5、执行ffmpeg -codecs如果能返回编码,表示编译成功。
备注:先要安装libx264。
如果无法执行有可能是路径错误,尝试设置环境变量LD_LIBRARY_PATH={安装路径},查找安装路径的方法:find / -name ffmpeg。