<车载物联网项目,视频采集传输部分,第一天> FFmpeg的安装过程

FFmpeg的安装过程,是姬哥在网上找到的,他说是在维基百科上面找到的。

安装的过程,在如下的网站:http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide

也可以点击这里进行连接:FFmpeg安装方式网页

为了防止网页将来失效,并且整个的安装过程需要对网页上面的命令稍作修改,我们在此保留一份笔记。如下:


Compile FFmpeg on Ubuntu, Debian, or Mint


This guide for supported releases of UbuntuDebian, and Linux Mint will provide a local install of the latest FFmpeg tools and libraries including several external encoding and decoding libraries (codecs). This will not provide a system installation and therefore will not interfere with anything such as repository packages. Recent static builds are also available for lazy people or those who are unable to compile.



Get the Dependencies

Copy and paste the whole code box for each step.


sudo apt-get update
 
 
sudo apt-get -y install autoconf automake build-essential git libass-dev libgpac-dev \
libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev \
libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev
mkdir ~/ffmpeg_sources
  • Server users can omit the ffplay and x11 dependencies: libsdl1.2-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxfixes-dev.
  • Ubuntu 10.04 Lucid users will need to install the  git-core package instead of the  git package. Lucid lacks the package  libva-dev. This can be ignored.

    Compilation & Installation

    One advantage to compiling is that you can build ffmpeg to your liking. If you do not require certain encoders you may skip the relevant section and then remove the appropriate ./configure option in FFmpeg. For example, if libopus is not needed, then skip that section and then remove --enable-libopus from the Install FFmpeg section.

    YYasm

    Yasm is an assembler used by x264 and FFmpeg.

    Ubuntu 13.04 and Mint 15 users can alternatively install the yasm package from the repository instead of compiling.

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

    x264

    H.264 video encoder. See the x264 Encoding Guide for more information and examples.

    cd ~/ffmpeg_sources
    git clone --depth 1 git://git.videolan.org/x264.git
    cd x264
    ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
    make
    sudo make install
    make distclean
    

    Note: You can download the nightly  x264 source snapshot as an alternative to using git.


    fdk-aac

    AAC audio encoder. See the AAC Encoding Guide for more information and examples.

    cd ~/ffmpeg_sources
    git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
    cd fdk-aac
    autoreconf -fiv
    ./configure --prefix="$HOME/ffmpeg_build" --disable-shared
    make
    sudo make install
    make distclean
    

    Note: You can download a  fdk-aac source snapshot as an alternative to using git.

    libmp3lame

    MP3 audio encoder.

    Most users can install the repository package:

    sudo apt-get install libmp3lame-dev
    

    Ubuntu 10.04 and Debian Squeeze users must compile:

    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
    sudo make install
    make distclean

    libopus

    Opus audio decoder and encoder.

    Ubuntu 13.04 and Mint 15 users can alternatively install the libopus-dev package from the repository instead of compiling.

    cd ~/ffmpeg_sources
    wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz
    tar xzvf opus-1.0.3.tar.gz
    cd opus-1.0.3
    ./configure --prefix="$HOME/ffmpeg_build" --disable-shared
    make
    sudo make install
    make distclean

    libvpx

    VP8/VP9 video encoder and decoder. See the vpx (WebM) Encoding Guide for more information and examples.

    Ubuntu 13.04 and Mint 15 users can alternatively install the libvpx-dev package from the repository instead of compiling.

    cd ~/ffmpeg_sources
    git clone --depth 1 http://git.chromium.org/webm/libvpx.git
    cd libvpx
    ./configure --prefix="$HOME/ffmpeg_build" --disable-examples
    make
    sudo make install
    make clean
    

    Note: You can download a  libvpx source snapshot as an alternative to using git.

    ffmpeg

    Note: Server users should remove --enable-x11grab from the following command:

    cd ~/ffmpeg_sources
    git clone --depth 1 git://source.ffmpeg.org/ffmpeg
    cd ffmpeg
    PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"
    export PKG_CONFIG_PATH
         
         
    ./configure --prefix="$HOME/ffmpeg_build" \
    --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
    --bindir="$HOME/bin" --extra-libs="-ldl" --enable-gpl --enable-libass --enable-libfdk-aac \
    --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx \
    --enable-libx264 --enable-nonfree --enable-x11grab
    make
    sudo make install
    make distclean
    hash -r
    

    Note: You can download the nightly FFmpeg source snapshot as an alternative to using git.

    Finish

    Installation is now complete and ffmpeg is now ready for use. Check to see if you're using your new ffmpeg:

    $ ffmpeg 2>&1 | head -n1
    ffmpeg version git-2013-05-18-5918b7a Copyright (c) 2000-2013 the FFmpeg developers
    

    If you do not see FFmpeg developers in your output then something went wrong and you're probably using the  fake "ffmpeg" from the repository.

    You can keep the ffmpeg_sources directory if you plan on updating later. See Updating FFmpeg below for more details followed by instructions for reverting all changes made by this guide.

    =================================================================

    这里向上全部在UNTU12.04LTS下运行成功

    =================================================================

    以上我们将,整个FFmpeg 环境全部都搭建好了!!!!

    如果环境搭建好了,我们可以在命令行输入相应的命令验证是否安装成功,如果安装成功会有相应的提示信息!!!见如下图片:

    运行ffplay会出现如下提示:

    如果运行ffserver会出现如下提示:


    如果运行ffmpeg会出现如下提示;


    接下来,我们就可以使用以上的三个命令,来进行相应的操作,这里我们想在命令行上面播放一个文件:

    首先我们要配置ffmpeg_sources/ffmpeg/doc/ffserver.conf这个文件,如果这个文件配置不好是无法播放文件的。

    配置文件如下:

    Port 8090
    BindAddress 0.0.0.0


    MaxHTTPConnections 2000
    MaxClients 1000


    MaxBandwidth 1000
    CustomLog -


    NoDaemon


    <Feed feed1.ffm>
    File /tmp/feed1.ffm
    FileMaxSize 5M
    </Feed>


    <Stream test.flv>
    Feed feed1.ffm
    Format mp2
    StartSendOnKey
    </Stream>


    <Stream test.mp3>
    File "/home/jx/test/Numb.mp3"
    Format mp2
    NoVideo
    </stream>


    <Stream stat.html>
    Format status


    ACL allow localhost
    ACL allow 192.168.0.0 192.168.255.255
    </Stream>


    <Redirect index.html>
    URL http://www.ffmpeg.org/
    </Redirect>


    然后我们在命令行上启动ffserver ,如下图:


    然后启动一个新的终端窗口,运行如下命令:


    将会出现如下的运行结果,指定的音乐被播放了:


    ==================================================================

    以下是关于FFmpeg的更新操作:

    Updating FFmpeg

    Development of FFmpeg is active and an occasional update can give you new features and bug fixes. First, remove (or move) the old files and then update the dependencies:

    rm -rf ~/ffmpeg_build ~/bin/{ffmpeg,ffprobe,ffserver,vsyasm,x264,yasm,ytasm}
    sudo apt-get update
    sudo apt-get -y install autoconf automake build-essential git libass-dev libgpac-dev \libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev \libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev
    

    Server users can omit: libsdl1.2-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxfixes-dev.

    x264

    cd ~/ffmpeg_sources/x264
    make distclean
    git pull
    

    Now run ./configuremake, and make install as shown in the Install x264 section.

    fdk-aac

    cd ~/ffmpeg_sources/fdk-aac
    make distclean
    git pull
    

    Now run ./configuremake, and make install as shown in the Install fdk-aac section.

    libvpx

    cd ~/ffmpeg_sources/libvpx
    make clean
    git pull
    

    Now run ./configuremake, and make install as shown in the Install libvpx section.

    ffmpeg

    cd ~/ffmpeg_sources/ffmpeg
    make distclean
    git pull
    

    Now run ./configuremake, and make install as shown in the Install FFmpeg section.


    Reverting Changes Made by This Guide

    To remove ffmpeg, x264, and dependencies installed for this guide:

    rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffserver,vsyasm,x264,yasm,ytasm}
    sudo apt-get autoremove autoconf automake build-essential git libass-dev libgpac-dev \  libmp3lame-dev libopus-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev \  libvorbis-dev libvpx-dev libx11-dev libxext-dev libxfixes-dev texi2html zlib1g-dev
    hash -r
    

    If You Need Help

    Feel free to ask questions at the #ffmpeg IRC channel or the ffmpeg-user mailing list.


    Also See







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值