关于ffmpeg

FFmpeg是一個自由軟體,可以執行音訊和視訊多種格式的錄影、轉檔、串流功能,包含了libavcodec——這是一個用於多個專案中音訊和視訊的解碼器函式庫,以及libavformat——一個音訊與視訊格式轉換函式庫。

--以上内容摘自 https://zh.wikipedia.org/wiki/FFmpeg

环境

Ubuntu Desktop 16.04 LTS

FFmpeg配置

1.关于yasm

在安装ffmpeg之前,还是先安装下yasm吧

(其实,也可以不装,在编译ffmpeg的时候加上 --disable-yasm 参数即可)

那么yasm是做什么用的呢?

Yasm is a complete rewrite of the NASM assembler under the “new” BSD License (some portions are under other licenses, see COPYING for details).

Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes, outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, RDOFF2, COFF, Win32, and Win64 object formats, and generates source debugging information in STABS, DWARF 2, and CodeView 8 formats.

Yasm can be easily integrated into Visual Studio 2005/2008 and 2010 for assembly of NASM or GAS syntax code into Win32 or Win64 object files.

以上是yasm官网的解释

其实就是英特尔X86架构下的汇编器和反汇编器,可以用来编写16位、32位(IA-32)和64位(x86-64)的程序。

2.安装yasm

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar -zxf yasm-1.3..tar.gz
cd yasm-1.3./
./configure
make
sudo make install
sudo ldconfig

3.编译ffmpeg

tar -jxf ffmpeg-4.0..tar.bz2 #我这里已经下载好了
cd ffmpeg-4.0./
./configure --prefix=/usr/local/ffmpeg --enable-shared
make
sudo make install

--enable-shared 参数据说是允许其编译产生动态库,在以后的编程中要用到这个几个动态库。

4.给ffmpeg设置环境变量

sudo vi /etc/profile

加入以下内容:

FFMPEG=/usr/local/ffmpeg
export PATH="$FFMPEG/bin:$PATH"

使修改立即生效

source /etc/profile6

5.为了防止执行程序找不到库文件

可以将/usr/local/ffmpeg/lib目录设置到LD_LIBRARY_PATH环境变量

6.找不到库文件

环境变量设置完成后

ffmpeg -version

检查下安装是否有问题

正常情况是显示这个

ffmpeg -version
ffmpeg version 4.0. Copyright (c) - the FFmpeg developers
built with gcc (Ubuntu 7.3.-16ubuntu3)
configuration: --prefix=/usr/local/ffmpeg --enable-shared
libavutil . 14.100 / . 14.100
libavcodec . 18.100 / . 18.100
libavformat . 12.100 / . 12.100
libavdevice . 3.100 / . 3.100
libavfilter . 16.100 / . 16.100
libswscale . 1.100 / . 1.100
libswresample . 1.100 / . 1.100

若出现 ffmpeg: error while loading shared libraries: libavdevice.so.58: cannot open shared object file 错误

修改/etc/ld.so.conf 在最后一行加上

/usr/local/ffmpeg/lib

例如

include /etc/ld.so.conf.d/*.conf
/usr/local/ffmpeg/lib #在后面加上这段

再执行

sudo ldconfig 

并修改 /usr/local/ffmpeg/lib目录下的文件权限为777

检查下库是否加载到

ldd $(which ffmpeg)
ffmpeg -version

我是在Ubuntu的桌面版安装的,如果你是server版,可能会缺少很多库。请参考这里 在Ubuntu Server上编译FFmpeg

比较完整的编译安装,请参考官网文档 Compile FFmpeg for Ubuntu, Debian, or Mint

Ubuntu Desktop 编译 ffmpeg (简略的写写)的更多相关文章

  1. 在Ubuntu下编译FFmpeg

    第一步:准备编译环境 .tar.bz2 -2245/ ./configure --enable-static--enable-shared--prefix=/usr/localmakesudomake ...

  2. ubuntu 下 编译ffmpeg 3.1.1

    1,下载ggmpeg源码:http://ffmpeg.org/download.html 2.下载ndk ,百度 3.配置环境 3.1 编译FFMPEG时,出现了 ffmpeg yasm not fo ...

  3. ubuntu下编译ffmpeg+SDL+ffplay提取motion vector

    编译ffmpeg: 第一步: 从官网http://ffmpeg.org/下载最新版本. 解压tar -xjvf ffmpeg-3.3.1.tar.bz2 进入目录cd ffmpeg-3.3.1 第二步 ...

  4. [笔记] Ubuntu下编译ffmpeg+openh264+x264

    [下载代码]   - ffmpeg: git clone git://source.ffmpeg.org/ffmpeg.git - openh264: git clone https://github ...

  5. ubuntu下编译ffmpeg并用eclipse调试

    一.下载ffnpeg源码 下载地址:http://ffmpeg.org/download.html 二.解决版本问题 可能之前你编译过ffmpeg,或者装过相关的库,那都要先卸载掉,否则用的时候会报一 ...

  6. Linux下编译ffmpeg并用GDB调试

    1.在Ubuntu界面上调处命令行界面,最方便的方式是使用快捷键Ctrl+Alt+T. 2.安装SDL SDL是一个开源的多媒体开发库,可以设置图像和视频的绘制等操作.如果不安装SDL,FFMPEG将 ...

  7. 【FFMPEG】Ubuntu上安装FFMPEG

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

  8. ubuntu下编译原生ffmpeg

    本文主要介绍Linux 系统下如何编译Ffmpeg,编译环境是Ubuntu 16.04,Ffmpeg版本是3.4.2.Windows环境 下如何编译ffmpeg前面有博文介绍,也录有视频,感兴趣的同学 ...

  9. Ubuntu下安装和编译ffmpeg

    参考:http://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu   1.安装依赖包 sudo apt-get update sudo apt-get -y ...

随机推荐

  1. 面试常问Spring IOC,不得不会。

    广义的 IOC IoC(Inversion of Control) 控制反转,即“不用打电话过来,我们会打给你”. 两种实现: 依赖查找(DL)和依赖注入(DI). IOC 和 DI .DL 的关系( ...

  2. Linux脚本shell字符串处理

    Linux脚本shell字符串处理,基本都有了,看着搜吧 TLDP教堂 shell中if条件字符串.数字比对,[[ ]]和[ ]区别 Linux 之 shell 比较运算符 Linux Shell编程 ...

  3. 解决使用eclipse创建maven web项目时报Could not resolve archetype的问题

    前两天重装了系统,今天想写一个项目的时候出现了点问题. 在使用eclipse创建maven web项目时,点Finish后报了Could not resolve archetype的问题. Could ...

  4. WebApi返回的Json去掉XML

    在global.asax.cs文件中的 application_start()方法中加入下面一句话 GlobalConfiguration.Configuration.Formatters.XmlFo ...

  5. i.MX6UL -- PWM用户空间使用方法【转】

    本文转载自:https://blog.csdn.net/u014486599/article/details/53010114 i.MX6UL -- PWM用户空间使用方法 开发平台: 珠海鼎芯D51 ...

  6. SQLServer 对已有数据表添加自增主键

    最近在做老表的数据整理,发现有的表没有主键标识,.NET Core 无法一键生成模型,需要带有主键的表才可以,所以需要针对已有数据添加主键,这是我找到的两种方式. 1. 主键为int 或者bigint ...

  7. js 字符串,new String() 与 String()

    function showCase(value) { switch(value) { case 'A': console.log('Case A'); break; case 'B': console ...

  8. L0 Regularization

    参考: Learning Sparse Neural Networks through L0 Regularization The Variational Garrote

  9. Servlet的5种方式实现表单提交

    http://www.cnblogs.com/zhanghaoliang/p/5622900.html

  10. 【C/C++】小坑们

    1.printf("%03d", a); // 输出 a,占 3 位,不够则左边用 0 填充 2.memcpy 所在头文件为 <string.h> 3.string s ...