问题: FFMPEG系列二:linux下下载编译安装ffmpeg(超详细附采坑完整版)|ffmpeg编码解码|在线助手-您的在线生成制作工具箱!
问题关键字: ffmpeg,ffmpeg编码解码,ffmpeg编译安装,linux下下载编译安装ffmpeg,在线生成制作工具,在线助手!
问题详细描述: FFMPEG系列二:linux下下载编译安装ffmpeg(超详细附采坑完整版)是在线助手博客-您的在线生成制作工具箱,系列文章之一,主要记录了linux下ffmpeg编译报错问题。!
二三九九
FFMPEG系列二:linux下下载编译安装ffmpeg(超详细附采坑完整版)
在线助手博客首页
###Hello world!
####一、[官网下载linux版本的ffmpeg源码包 ffmpeg-4.0.tar.xz](https://johnvansickle.com/ffmpeg/release-source/) **此步骤也可以使用git clone下载源码包,本质上是一样的** ![图片.png](https://upload-images.jianshu.io/upload_images/2704327-c5c8e9b83896bf35.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ####二、使用xftp将源码包ffmpeg-4.0.tar.xz上传至linux主机(直接使用linux命令下载到linux也可以) ![图片.png](https://upload-images.jianshu.io/upload_images/2704327-a03012dc601129f0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ####三、将上传至/usr/local/ffmpeg的源码包解压 ```java cd /usr/local/ffmpeg tar xvJf ffmpeg-4.0.tar.xz ``` ####四、 进入解压后目录,输入如下命令/usr/local/ffmpeg为自己指定的安装目录 ```java cd ffmpeg-4.0 ./configure --enable-shared --prefix=/usr/local/ffmpeg ``` **报错:**[gcc is unable to create an executable file C compiler test failed.此错误解决办法查看](https://www.it399.com/blog/ffmpeg/201807011602) ```java gcc is unable to create an executable file. If gcc is a cross-compiler, use the --enable-cross-compile option. Only do this if you know what cross compiling means. C compiler test failed. If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net. Include the log file "ffbuild/config.log" produced by configure as this will help solve the problem. [csy@root@instance-m4tjyg0q ffmpeg-4.0]# ``` ####五、解决报错gcc is unable to create an executable file C compiler test failed.之后再次执行之前的命令 ```java cd ffmpeg-4.0 ./configure --enable-shared --prefix=/usr/local/ffmpeg ``` **回车之后,可能会等待一段时间,耐心等候** ![10481529851712_.pic_hd.jpg](https://upload-images.jianshu.io/upload_images/2704327-4d50c6a11b2519d6.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/800) ####六、执行make(编译) ```java make ``` **此过程有点久,会编译各个库文件** ####七、执行make install(安装) ![10521529852247_.pic_hd.jpg](https://upload-images.jianshu.io/upload_images/2704327-3049411674efcfb9.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ####八、安装之后,执行 `/usr/local/ffmpeg/installlocation/bin/ffmpeg --version` 此时又报错:`ffmpeg -bash: ffmpeg: command not found` [linux下ffmpeg -bash: ffmpeg: command not found解决办法](https://www.it399.com/blog/ffmpeg/201807011604) ####九、解决上述问题之后 再次输入`/usr/local/ffmpeg/installlocation/bin/ffmpeg --version` 又报错 `/usr/local/ffmpeg/installlocation/bin/ffmpeg: error while loading shared libraries: libavdevice.so.58: cannot open shared object file: No such file or directory` **提示库文件找不到** 修改文件/etc/ld.so.conf 内容增加/usr/local/ffmpeg/lib/ `vim /etc/ld.so.conf` **输入i才能插入编辑** 最后文件内容是 ```java include ld.so.conf.d/*.conf /usr/local/ffmpeg/lib/ ``` 添加之后按esc再:wq保存退出。 再输入ldconfig使修改生效。 **这样错误就解决了,再回答第八步输入** `/usr/local/ffmpeg/installlocation/bin/ffmpeg --version` ![图片.png](https://upload-images.jianshu.io/upload_images/2704327-30da8b96de0f6404.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) **可见ffmpeg安装成功,接下来配置环境变量 path(不配置的haul只能每次cd /usr/local/ffmpeg/installlocation/bin/ 才能执行命令)** ####第十步:配置ffmpeg环境变量 详细查看:[linux下ffmpeg -bash: ffmpeg: command not found及环境变量设置]() ###十一步:测试 **cd到有gif文件的目录** `cd /usr/local/java/apache-tomcat-8.5.24/webapps/it399/src/ffmpeg/temp/gif2video` **输入命令** `ffmpeg -f gif -i test.gif test.mp4` **回车之后输入命令或者xftp客户端查看该目录下文件,可见已经成功将test.gif转成了test.mp4** ![图片.png](https://upload-images.jianshu.io/upload_images/2704327-6cbf45c63b15ead4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1000) >转载请注明:本文转载自[在线助手|在线工具](https://www.it399.com/)博客,原文链接:https://www.it399.com/blog/ffmpeg/201807011600
返回顶部
下载Android客户端
Copyright © 2017-2018 . All Rights Reserved.
粤ICP备18008506号