zoukankan      html  css  js  c++  java
  • ffmpeg安装与配置

    经过试验,ubuntu-meta 16.04 和 2019-07-10-raspbian-buster-full 都可使用下面的步骤安装FFmpeg视频转码软件

    具体安装步骤如下:

    1、安装FFMPEG需要的所有组件

    sudo apt-get update
    sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev 
      libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev 
      libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev

     为下面的安装源文件建立一个目录

    mkdir ~/ffmpeg_sources

    编译和安装 
    注:根据自己的需要来选择要安装的编解码器
    Yasm

    sudo apt-get install yasm
    
    cd ~/ffmpeg_sources
    wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
    tar xzvf yasm-1.3.0.tar.gz
    cd yasm-1.3.0
    ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
    make
    make install
    make distclean

     libx264

    sudo apt-get install libx264-dev
    cd ~/ffmpeg_sources
    wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
    tar xjvf last_x264.tar.bz2
    cd x264-snapshot*
    PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --disable-opencl
    PATH="$HOME/bin:$PATH" make
    make install
    make distclean

     libx265

    sudo apt-get install libx265-dev
    sudo apt-get install cmake mercurial
    cd ~/ffmpeg_sources
    hg clone https://bitbucket.org/multicoreware/x265
    cd ~/ffmpeg_sources/x265/build/linux
    PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
    make
    make install
    make distclean

    libfdk-aac

    sudo apt-get install libfdk-aac-dev
    cd ~/ffmpeg_sources
    wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master
    tar xzvf fdk-aac.tar.gz
    cd mstorsjo-fdk-aac*
    autoreconf -fiv
    ./configure --prefix="$HOME/ffmpeg_build" --disable-shared
    make
    make install
    make distclean

    libmp3lame

    sudo apt-get install libmp3lame-dev
    sudo apt-get install nasm
    cd ~/ffmpeg_sources
    wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
    tar xzvf lame-3.99.5.tar.gz
    cd lame-3.99.5
    ./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared
    make
    make install
    make distclean

     libopus

    sudo apt-get install libopus-dev
    cd ~/ffmpeg_sources
    wget http://downloads.xiph.org/releases/opus/opus-1.1.4.tar.gz
    tar xzvf opus-1.1.4.tar.gz
    cd opus-1.1.4
    ./configure --prefix="$HOME/ffmpeg_build" --disable-shared
    make
    make install
    make clean
    libvpx
    sudo apt-get install libvpx-dev
    cd ~/ffmpeg_sources
    wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.6.1.tar.bz2
    tar xjvf libvpx-1.6.1.tar.bz2
    cd llibvpx-1.6.1
    PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests
    PATH="$HOME/bin:$PATH" make
    make install
    make clean

     ffmpeg

    cd ~/ffmpeg_sources
    wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
    tar xjvf ffmpeg-snapshot.tar.bz2
    cd ffmpeg
    PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure 
      --prefix="$HOME/ffmpeg_build" 
      --pkg-config-flags="--static" 
      --extra-cflags="-I$HOME/ffmpeg_build/include" 
      --extra-ldflags="-L$HOME/ffmpeg_build/lib" 
      --bindir="$HOME/bin" 
      --enable-gpl 
      --enable-libass 
      --enable-libfdk-aac 
      --enable-libfreetype 
      --enable-libmp3lame 
      --enable-libopus 
      --enable-libtheora 
      --enable-libvorbis 
      --enable-libvpx 
      --enable-libx264 
      --enable-libx265 
      --enable-nonfree
    PATH="$HOME/bin:$PATH" make
    make install
    make distclean
    hash -r
    cd ~/ffmpeg_sources
    wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
    tar xjvf ffmpeg-snapshot.tar.bz2
    cd ffmpeg
    PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure 
      --prefix="$HOME/ffmpeg_build" 
      --pkg-config-flags="--static" 
      --extra-cflags="-I$HOME/ffmpeg_build/include" 
      --extra-ldflags="-L$HOME/ffmpeg_build/lib" 
      --bindir="$HOME/bin" 
      --enable-gpl 
      --enable-libass 
      --enable-libfdk-aac 
      --enable-libfreetype 
      --enable-libmp3lame --enable-libtheora 
      --enable-libvorbis --enable-libx264 --enable-nonfree
    PATH="$HOME/bin:$PATH" make
    make install
    make distclean
    hash -r

    参考资料:

    https://blog.csdn.net/danfengw/article/details/62887997

    https://www.jianshu.com/p/adea4bdb5bc8

  • 相关阅读:
    安装django时出错
    mysql ------python3(一)笔记
    安装mysql的具体过程
    Python3web框架---Django、Tornado、Flask的对比
    python3-----json函数
    图片人脸识别年龄和性别
    urllib库的使用(三)-----python3 异常处理
    python 3 基础篇 (一)
    requests,pymysql,django的安装
    求素数方法的改进
  • 原文地址:https://www.cnblogs.com/little-kwy/p/11305759.html
Copyright © 2011-2022 走看看