“编译” 标签页面:

  • CentOS编译安装ffmpeg以及相关编码解码器

    CentOS编译安装ffmpeg是一件很痛苦的过程,因为各种编码器、解码器什么的很繁杂,而且相互依赖关系更复杂。

    编译了一天终于把它搞定并基本测试无问题,以下是步骤。

    安装yasm

    wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
    tar zxf yasm-1.2.0.tar.gz
    cd yasm-1.2.0
    ./configure
    make
    make install

    安装frei0r(先安装新版autoconf,这会覆盖掉系统中的旧版本哦)

    wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
    tar zxf autoconf-2.69.tar.gz
    cd autoconf-2.69
    ./configure --prefix=/usr
    make
    make install

    wget http://files.dyne.org/frei0r/releases/frei0r-plugins-1.4.tar.gz
    tar zxf frei0r-plugins-1.4.tar.gz
    cd frei0r-plugins-1.4
    ./configure
    make
    make install

    安装gnutls

    参考:http://blog.creke.net/800.html

    安装mp3lame

    wget http://iweb.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
    tar zxf lame-3.99.5.tar.gz
    cd lame-3.99.5
    make
    make install

    安装opencore-amr

    wget http://iweb.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
    tar zxf opencore-amr-0.1.3.tar.gz
    ./configure --enable-shared
    make
    make install

    安装opus

    wget http://downloads.xiph.org/releases/opus/opus-1.0.2.tar.gz
    tar zxf opus-1.0.2.tar.gz
    cd opus-1.0.2
    make
    make install

    安装rtmpdump

    wget http://rtmpdump.mplayerhq.hu/download/rtmpdump-2.3.tgz
    tar zxf rtmpdump-2.3.tgz
    cd rtmpdump-2.3
    make
    make install

    安装schroedinger(先安装好orc库)

    wget http://code.entropywave.com/download/orc/orc-0.4.17.tar.gz
    tar zxf orc-0.4.17.tar.gz
    cd orc-0.4.17
    ./configure
    make
    make install
    /sbin/ldconfig

    wget http://diracvideo.org/download/schroedinger/schroedinger-1.0.11.tar.gz
    tar zxf schroedinger-1.0.11.tar.gz
    cd schroedinger-1.0.11
    PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig ./configure
    make
    make install

    安装soxr(注:新版libsoxr貌似与当前ffmpeg不兼容,用旧版)

    yum install -y xz
    wget http://hivelocity.dl.sourceforge.net/project/soxr/soxr-0.1.0-Source.tar.xz
    xz -d soxr-0.1.0-Source.tar.xz
    tar xf soxr-0.1.0-Source.tar
    cd soxr-0.1.0-Source
    ./go
    cd Release/
    make
    make install
    /sbin/ldconfig

    安装speex(先安装libogg库)

    wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
    tar zxf libogg-1.3.0.tar.gz
    ./configure
    make
    make install
    /sbin/ldconfig

    wget http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz
    tar zxf speex-1.2rc1.tar.gz
    cd speex-1.2rc1
    ./configure
    make
    make install

    安装theora(先安装好libvorbis库和libsdl库)

    wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
    tar zxf libvorbis-1.3.3.tar.gz
    ./configure
    make
    make install

    wget http://www.libsdl.org/release/SDL-1.2.15.tar.gz
    tar zxf SDL-1.2.15.tar.gz
    cd SDL-1.2.15
    ./configure
    make
    make install
    /sbin/ldconfig

    wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
    tar zjf libtheora-1.1.1.tar.bz2
    ./configure
    make
    make install

    安装twolame

    wget http://downloads.sourceforge.net/twolame/twolame-0.3.13.tar.gz
    tar zxf twolame-0.3.13
    .tar.gz
    cd twolame-0.3.13
    ./configure
    make
    make install
    /sbin/ldconfig

    安装VisualOn AAC(注:github的tag和master版均无法autoconf,用zeranoe版代替)

    wget wget http://ffmpeg.zeranoe.com/builds/source/external_libraries/vo-aacenc-0.1.2.tar.xz
    xz -d vo-aacenc-0.1.2.tar.xz
    tar xf vo-aacenc-0.1.2.tar
    cd vo-aacenc-0.1.2
    ./configure
    make
    make install

    安装VisualOn AMR-WB(注:github的tag和master版均无法autoconf,用zeranoe版代替)

    wget http://ffmpeg.zeranoe.com/builds/source/external_libraries/vo-amrwbenc-0.1.2.tar.xz
    xz -d vo-amrwbenc-0.1.2.tar.xz
    tar xf vo-amrwbenc-0.1.2.tar
    cd vo-amrwbenc-0.1.2
    ./configure

    安装libvpx(注:新版libvpx貌似与当前ffmpeg不兼容,用旧版)

    wget http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2
    tar jxf libvpx-v1.1.0.tar.bz2
    cd libvpx-v1.1.0
    ./configure
    make
    make install

    安装x264

    wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
    tar jxf last_x264.tar.bz2
    cd x264-snapshot-20130311-2245/
    ./configure --enable-shared
    make
    make install

    安装xvid

    wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
    tar zxf xvidcore-1.3.2.tar.gz
    cd xvidcore
    cd build/generic
    ./configure
    make
    make install

    最重要的一步——编译安装ffmpeg!

    wget http://ffmpeg.org/releases/ffmpeg-1.1.3.tar.gz
    tar zxf ffmpeg-1.1.3.tar.gz
    cd ffmpeg-1.1.3
    PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig ./configure --disable-static --enable-shared --enable-gpl --enable-version3 --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-zlib
    make
    make install

    注1:

    我在编译安装时参考Windows Build:http://ffmpeg.zeranoe.com/builds/。

    注2:

    与Windows Build相比,以下没有选项开启:

    --enable-libgsm --enable-libilbc -enable-libass --enable-libbluray --enable-libcaca --enable-libopenjpeg --disable-w32threads --enable-avisynth --enable-libxavs

    2013.03.12 / 1 条评论 / 8,333 次点击 / 分类: 所谓技术

  • CentOS编译安装新版gnutls

    在Linux中,gnutls应用很常见,最近编译ffmpeg时也用到,不过应该是自带的gnutls太旧了,所以编译错误,要新编译一个。下面是编译安装过程。

    注意:/etc/ld.so.conf要加上lib64。并且不要使用yum remove gnutls gnutls-devel,不信?你会后悔的!

    首先安装nettle:

    wget http://www.lysator.liu.se/~nisse/archive/nettle-2.5.tar.gz
    tar zxf nettle-2.5.tar.gz
    cd nettle-2.5
    ./configure --enable-shared
    make
    make install

    然后安装gnutls新版:

    wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1/gnutls-3.1.9.1.tar.xz
    xz -d gnutls-3.1.9.1.tar.xz
    tar xf gnutls-3.1.9.1.tar
    cd gnutls-3.1.9.1
    PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig ./configure --enable-shared
    make
    make install

    就是这样。

    2013.03.12 / 1 条评论 / 7,350 次点击 / 分类: 所谓技术

  • Windows下编译安装Privoxy

    首先,要安装MingW。在此不赘述。当然,用cygwin也可以,但是这样编译出来的Privoxy没有GUI图形界面。PS:Privoxy在jcc.c那里已经自动识别了MingW,并且嵌入了Windows GUI的API,因此编译出来就可以自己采用图形界面了。

    然后,在这里下载Privoxy的源代码,本文以privoxy-3.0.18-stable为例。

    进入privoxy-3.0.18-stable源码目录,执行以下命令,进入bash:

    bash

    执行以下命令,进行配置:

    autoheader
    autoconf
    ./configure --prefix=/r/privoxy --enable-mingw32 --disable-pthread

    稍微解释以下configure的各个参数。--prefix参数指明privoxy的安装目录,/r/privoxy是mingw表示windows文件系统的方式,即R盘的privoxy文件夹。--enable-mingw32指明了为mingw环境配置,其实不指明配置程序也会自动检测得到。--disable-pthread是禁用POSIX的pthread,privoxy会自动使用windows API的thread来实现线程,具体参照errlog.c的部分代码:

    /*********************************************************************
     *
     * Function    :  get_thread_id
     *
     * Description :  Returns a number that is different for each thread.
     *
     *                XXX: Should be moved elsewhere (miscutil.c?)
     *
     * Parameters  :  None
     *
     * Returns     :  thread_id
     *
     *********************************************************************/
    static long get_thread_id(void)
    {
       long this_thread = 1;  /* was: pthread_t this_thread;*/
    
    #ifdef __OS2__
       PTIB     ptib;
       APIRET   ulrc; /* XXX: I have no clue what this does */
    #endif /* __OS2__ */
    
       /* FIXME get current thread id */
    #ifdef FEATURE_PTHREAD
       this_thread = (long)pthread_self();
    #ifdef __MACH__
       /*
        * Mac OSX (and perhaps other Mach instances) doesn't have a debuggable
        * value at the first 4 bytes of pthread_self()'s return value, a pthread_t.
        * pthread_t is supposed to be opaque... but it's fairly random, though, so
        * we make it mostly presentable.
        */
       this_thread = abs(this_thread % 1000);
    #endif /* def __MACH__ */
    #elif defined(_WIN32)
       this_thread = GetCurrentThreadId();
    #elif defined(__OS2__)
       ulrc = DosGetInfoBlocks(&ptib, NULL);
       if (ulrc == 0)
         this_thread = ptib -> tib_ptib2 -> tib2_ultid;
    #endif /* def FEATURE_PTHREAD */
    
       return this_thread;
    }

    配置成功后,编译安装:

    make

    make install

    其实,make后已经有privoxy.exe,可以下载官方的Win32版本的ZIP包,替换里面的privoxy.exe即可使用,无需再make install。

     

    一些注意的问题:

    1、编译时提示未定义“NI_MAXSERV”

    编译时出现如下错误:

    jbsockets.c: In function 'get_host_information':

    jbsockets.c:979:22: error: 'NI_MAXSERV' undeclared (first use in this function)

    jbsockets.c:979:22: note: each undeclared identifier is reported only once for e

    ach function it appears in

    make: *** [jbsockets.o] Error 1

    修改jbsockets.c,在

    const char jbsockets_h_rcs[] = JBSOCKETS_H_VERSION;

    前面加上:

    /* MOD BY Creke START */

    #ifndef NI_MAXSERV

    #define NI_MAXSERV    32

    #endif

    /* MOD BY Creke END */

    说实话,这是configure没有识别getnameinfo和getaddrinfo,因此config.h中没有定义HAVE_RFC2553所致。这些依赖于官方修复,再次仅拷贝ws2tcpip.h中的相关值进来,作临时修补。

    2、MingW默认安装的话,需要额外的库吗?

    需要zlib库,在mingw中又称为libz,可以在这里下载。当然,如果需要将privoxy拷贝到其它电脑运行,需要将libz-1.dll拷贝到privoxy程序目录中。

    3、额外的DLL?

    libgcc_s_dw2-1.dll

    4、编译好如何发行和安装?

    推荐下载官方发行的win32的zip包,将编译好的privoxy.exe覆盖。同时别忘记拷贝依赖的dll。

    2011.12.07 / 15 条评论 / 7,119 次点击 / 分类: 所谓技术