安装包和主要步骤:

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/下单独建个子目录放。 其他的库都是在make install的时候自己建的子文件夹。

需要将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相关目录下)

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的更多相关文章

  1. 【FFMPEG】Ubuntu上安装FFMPEG

    在之前,我们成功地使用mingw+msys在Windows平台下编译FFmpeg(见 http://www.linuxidc.com/Linux/2014-11/109839.htm),并生成了ffp ...

  2. [异常解决] ubuntu上安装JLink驱动遇到的坑及给后来者的建议

    一.前言 最近将整个电脑格式化,改成了linux操作系统 希望这样能让自己在一个新的世界探索技术.提升自己吧- win上的工具用多了,就不想变化了- 继上一篇<ubuntu上安装虚拟机遇到的问题 ...

  3. Ubuntu上安装Robomongo及添加到启动器

    到目前为止,Robomongo仍是MongoDB最好的客户端管理工具,如需在Ubuntu上安装Robomongo,可直接从官网下载.tar.gz压缩包进行解压,然后直接运行bin目录下的robomon ...

  4. 在 Ubuntu 上安装 Android Studio

    在 Ubuntu 上安装 Android Studio http://www.linuxidc.com/Linux/2013-05/84812.htm 打开terminal,输入以下命令 sudo a ...

  5. Ubuntu上安装Karma失败对策

    在Ubuntu上安装Karma遇到超时 timeout 错误.Google了一下,国外的码农给了一个快捷的解决方案,实测可行,贴在这里: sudo apt-get install npm nodejs ...

  6. 在Ubuntu上安装LAMP服务器

    1.安装Ubuntu上安装LAMP apt-get install lamp-server^ 2.安装过程中设置MySql密码 3.测试 创建index.php var/www/html/index. ...

  7. [译]How to Setup Sync Gateway on Ubuntu如何在ubuntu上安装sync-gateway

    参考文章https://hidekiitakura.com/2015/03/21/how-to-setup-sync-gateway-on-ubuntudigitalocean/ 在此对作者表示感谢 ...

  8. 在Ubuntu上安装JDK、Ant、Jmeter和Jenkins

    一.前期准备 1. 在win7下载VMware.Ubuntu(用迅雷下比较快) 2. 安装完VMware后新建虚拟机,选择iso: 3. 具体配置参考如下,至此Ubantu安装完成 二.在Ubuntu ...

  9. Ubuntu上安装MongoDB(译)

    add by zhj:直接从第四步开始就可以了,而且安装好MongoDB后会自动启动的,不必自己去执行启动命令 原文:https://docs.mongodb.com/manual/tutorial/ ...

随机推荐

  1. 柱状图多系列php动态实现(ec)

    <?php require_once 'data.php'; $arr1=$a->sum('answer','ask_id=1'); $arr2=$a->sum('answer',' ...

  2. 实例讲解如何利用jQuery设置图片居中放大或者缩小

    大家有没有见过其他网站的图片只要鼠标放上去就能放大,移出去的时候就能缩小,而且一直保持居中显示!其实jQuery提供一个animate函数可以使图片放大和缩小,只要改变图片的长和高就OK啦!但是ani ...

  3. ospf几种lsa

    ospf网络类型 1.点到点 点到点网段 2.广播网络 transit网段(至少有两台路由器的广播型网段) 3.NBMA transit网段 4.点到多点 ospf网段的类型(网段的类型只与网络的类型 ...

  4. 1,MongoDB简介和安装

    一.初识MongoDB MongoDB 是一个基于分布式文件存储的数据库.由 C++ 语言编写.旨在为 WEB 应用提供可扩展的高性能数据存储解决方案. MongoDB 是一个介于关系数据库和非关系数 ...

  5. SpringMVC---applicationContext.xml配置详解

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  6. java前台传参json,后台用map或者实体对象接收

    (一)前台传js对象,里面包含数组,后台用map接收 (1)第一种情况:数组里不包含js对象 var param ={}: param.id=id; param.name=name; var scor ...

  7. MyEclipse - 问题集 - maven update project 后,项目jdk的版本变化

    解决方法: 进入maven安装根目录,conf/settings.xml <profiles> <profile> <id>jdk-1.7</id> & ...

  8. 新工具填补Docker管理空白

    [TechTarget中国原创] 从事容器管理领域的IT运维专家这周需要评估一个新的工具. Docker推出了一款新产品,意在让IT运维人员能够跟上开发人员的脚步,这一产品是Docker Datace ...

  9. Git从入门到熟练

    Git的特性 1. 分布式版本控制 集中式VS分布式 保存更新时的文件快照而非差异 (快照 :是文件系统中的概念或者技术:来自照相领域的概念,是指特定时间点的一个状态) 其他系统在每个版本中记录着各个 ...

  10. BAD_ACCESS在什么情况下出现?如何调试BAD_ACCESS错误

    1. 访问一个僵尸对象,访问僵尸对象的成员变量或者向其发消息 死循环 2. 设置全局断点快速定位问题代码所在行 开启僵尸对象调试功能