ubuntu上安装ffmpeg

摘要:
configuremake,makeinstall找到头文件是在/usr/local/include/openjpeg-1.5.1下面,而ffmpeg在连接的时候,其实是/usr/local/include,所以提示说“ERROR:libopenjpegnotfound”。

引用:http://thierry-xing.iteye.com/blog/2017864

安装包和主要步骤:

1. 首先安装系统基础环境

RHEL & CentOS 系列:yum install -y automake autoconf libtool gcc gcc-c++

Debian & Ubuntu 系列:apt-get install automake autoconf libtool gcc gcc-c++

2. 下载最新的FFMpeg源码包

FFMpeg官方下载地址:http://ffmpeg.org/download.html

一般直接使用最新版本,下载完成后解压缩,进入源码文件夹,运行“./configure --help”查看帮助,这里主要是为了确认需要安装的扩展,有些扩展默认是已经开启的,有些是需要单独下载扩展源码包进行编译的。以我的需求为例,需要单独编译yasm、lame、OenCore AMR、AmrNB和AmrWB,其中lame是MP3解码器。

3. 编译所需源码包

从各个官方地址下载上述五种源码包,为了保证兼容最新版本的ffmpeg,请务必也下载最新版本的源码:

yasm:http://yasm.tortall.net/Download.html

lame:http://lame.sourceforge.net/download.php

OenCore AMR:http://sourceforge.net/projects/opencore-amr

AmrNB & AmrWB:http://www.penguin.cz/~utx/amr

分别解压缩并编译上述源码包,直接使用“./configure && make && make install”即可。

4. 编译FFMpef

回到刚才的FFMpeg源码目录,打开所需扩展并且编译FFMpeg:

./configure --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-shared

make && make install

ldconfig

最后写入config后,终端运行ffmpeg命令,出现success和已安装的扩展,则运行成功。

5. 可能遇到的问题

ffmpeg默认安装目录为“/usr/local/lib”,有些64位系统下软件目录则为“/usr/lib64”,编译过程中可能会出现“ffmpeg: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file: No such file or directory”等类似的错误,解决办法是建立软链接或者移动库文件到相应的目录:

ln -s /usr/local/lib/libmp3lame.so.0.0.0 /usr/lib64/libmp3lame.so.0

mv /usr/local/lib/libmp3lame.so.0.0.0 /usr/lib64/libmp3lame.so.0

6. 使用方法

MP3转换AMR: ffmpeg -i 1.mp3 -ac 1 -ar 8000 1.amr

AMR转换MP3: ffmpeg -i 1.amr 1.mp3

遇到问题及解决:

1. ERROR: libopenjpeg not found

http://code.google.com/p/openjpeg/downloads/detail?name=openjpeg-1.5.1.tar.gz&can=2&q=

下载openjpeg-1.5.1的代码,注意不要下载openjpeg-2.0的,否则ffmpeg跟openjpeg的接口不支持,编译会处错误。

configure
make,make install

找到头文件是在/usr/local/include/openjpeg-1.5.1下面,而ffmpeg在连接的时候,其实是/usr/local/include,所以提示说“ERROR: libopenjpeg not found”。将/usr/local/include/openjpeg-1.5.1下面的头文件“openjpeg.h”拷贝到/usr/local/include下面。

1,x264也是有这个问题,x264.h这个文件要放在/usr/local/include下,而不是在/usr/local/下单独建个子目录放。 其他的库都是在makeinstall的时候自己建的子文件夹。

需要将libx264的库文件拷贝到/usr/local/lib下
或者直接在configure的时候,改变路径,如下所示:
./configure --includedir=/usr/local/include --libdir=/usr/local/lib --enable-shared
即可。

2. ERROR:libfdk_aac not found

http://sourceforge.net/projects/opencore-amr/?source=directory

下载fdk-aac-0.1.1.tar.gz

执行

configure

make

make install

3. ERROR:libilbc not found

https://github.com/dekkers/libilbc

git clone git://github.com/dekkers/libilbc.git

解压

安装cmake,如下所示

sudo apt-get install cmake

创建一个build目录,执行:

cd build
cmake .. (这里的..意思是,如果是一个.表示CMakeLists.txt在当前路径下,两个..表示CMakeLists.txt在上一层目录下)

cmake install ..
make (在build/bin下会找到可执行文件。)

make install (将生成的库拷贝到linux相关目录下) (/usr/local/lib 和 /usr/local/include下)

4. ERROR: libmp3lame >= 3.98.3 not found

sudo apt-get install libmp3lame-dev

5. ERROR: libopencore_amrnb not found

sudo apt-get install libx264-dev libxvidcore-dev libopencore-amrwb-dev libopencore-amrnb-dev libfaad-dev libfaac-dev libmp3lame-dev 
libtwolame-dev liba52-0.7.4-dev libcddb2-dev libcdaudio-dev libcdio-cdda-dev libvorbis-dev libopenjpeg-dev
(5) git chone git://git.videolan.org/x264.git
configure
make && make install
(6) ERROR: libvo_aacenc not found
http://sourceforge.net/projects/opencore-amr/files/vo-aacenc/vo-aacenc-0.1.2.tar.gz/download
(7) ERROR: libvo_amrwbenc not found
http://sourceforge.net/projects/opencore-amr/files/vo-amrwbenc/
(8) ERROR: libvpx decoder version must be >=0.9.1
http://code.google.com/p/webm/downloads/detail?name=libvpx-v1.1.0.tar.bz2&can=2&q=
(9)编译 ffplay 需要 libsdl1.2-dev 库:
sudo apt-get install libsdl1.2-dev (10)ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file

Solution:
Search the file libavdevice.so.52 on the server using the ‘find’ command

1
# find / -name libavdevice.so.52

You need to add the path to the directory the file is in, in the ‘ld.so.conf’ file. If for example the file is located under “/usr/local/lib” directory, execute

1
# vi /etc/ld.so.conf

and add the following at the bottom of the file

/usr/local/lib

7. Encoder (codec id 86017) not found for output stream #0.0

解决方案:http://diogomelo.net/blog/11/encoder-codec-id-86017-not-found-output-stream-00-compile-ffmpeg-yourself

免责声明:文章转载自《ubuntu上安装ffmpeg》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇matlab矩阵旋转任意角度的函数 imrotate串口通信类,WPF下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

ffmpeg编译与移植问题

1、下载ffmpeg。 下载网址:http://www.ffmpeg.org/download.html 2、解压缩 tar -zxvf ffmpeg-2.0.1.tar.gz 3、配置,生成Makefile ./configure --enable-shared --disable-yasm --prefix=/usr/local/ffmpeg 如果...

跟我学机器视觉HALCON学习例程中文详解IC引脚测量

跟我学机器视觉-HALCON学习例程中文详解-IC引脚测量 Lead Measurement: Example for the application of the measure object including a lot of visualization operators. First, the length of the leads is me...

多目标遗传算法 ------ NSGA-II (部分源码解析) 拥挤距离计算 crowddist.c

1 /* Crowding distance computation routines */ 2 3 # include <stdio.h> 4 # include <stdlib.h> 5 # include <math.h> 6 7 # include "global.h" 8 #...

源码分析:若依用户 user_id查询返回除了用户表,为何还带有部门dept和角色role表呢

 通过认真分析SysUser.java 部份源码如下, private SysDept dept; 以下是toString(){ .append("dept", getDept()) .append("roles", getRoles()) } package com.ruoyi.common.core.domain.entity; imp...

QGIS开发(一)——环境配置

https://blog.csdn.net/qq_34357717/article/details/81305084 简介 QGIS是一个免费的、开源的、跨平台(LIN/WIN/Mac)的地理信息系统(GIS),有简单、体积小、硬件要求低等特性,适合用于GIS的开发。作为开源项目,我们可以在GitHub上很轻松的找到QGIS的源码。QGIS和很多开源项目一...

开发ffmpeg/live555常见问题错误及解决方法

#include <iostream>using namespace std;extern "C" {#include <libavcodec/avcodec.h> // required headers#include <libavformat/avformat.h>}int main(int argc, cha...