zoukankan      html  css  js  c++  java
  • Ubuntu Desktop 编译 ffmpeg (简略的写写)

    关于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.0.tar.gz
    cd yasm-1.3.0/
    ./configure
    make
    sudo make install
    sudo ldconfig

    3.编译ffmpeg

    tar -jxf ffmpeg-4.0.1.tar.bz2 #我这里已经下载好了
    cd ffmpeg-4.0.1/
    ./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.1 Copyright (c) 2000-2018 the FFmpeg developers
    built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
    configuration: --prefix=/usr/local/ffmpeg --enable-shared
    libavutil      56. 14.100 / 56. 14.100
    libavcodec     58. 18.100 / 58. 18.100
    libavformat    58. 12.100 / 58. 12.100
    libavdevice    58.  3.100 / 58.  3.100
    libavfilter     7. 16.100 /  7. 16.100
    libswscale      5.  1.100 /  5.  1.100
    libswresample   3.  1.100 /  3.  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

  • 相关阅读:
    青蛙学Linux—Nginx配置文件详解
    ICEM二维网格
    ubuntu画面延迟问题解决
    plot over time
    fluent中UDF环境变量问题的三种解决方法
    stiff chemistry模型出现NaN错误
    壁面边界漏给条件引起的发散问题
    mfix添加文件后重新生成configure文件
    DEM反应不收敛问题
    多气体组分DEM流动的DMP并行内存错误
  • 原文地址:https://www.cnblogs.com/wpjamer/p/9192141.html
Copyright © 2011-2022 走看看