• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            elva

            ffmpeg和mencoder的編譯方法

            **************ffmpeg的編譯****************

            1。首先獲取ffmpeg 如果已經獲取了ffmpeg的tar包那第一步可以跳過

            很多人找不到怎么下載,其實之前ffmpeg可以通過cvs下載,不過最近他已經換成了更加強大的svn

            如何使用SVN我這里不再介紹,網上還有大量的安裝和使用的文章可以借鑒,這里簡單羅列幾個SVN輔助的軟件:

            SubVersion,從 http://subversion.tigris.org/ 下載,支持linux,我們這里就裝這個

            TortoiseSVN,從 http://tortoisesvn.tigris.org/ 下載,是很不錯的SVN客戶端程序,為windows外殼程序集成到windows資源管理器和文件管理系統的Subversion客戶端,用起來很方便,commit動作變得就像Winrar右鍵壓縮一樣方便。


            ok,先裝subversion,記住最好之前裝過apr和apr-util,在apache.org網站能下到

            wget http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz
            tar zvxf subversion-1.3.2.tar.gz
            cd subversion-1.3.2
            ./configure --with-apr=/usr/local/apr-httpd --with-apr-util=/usr/local/apr-util-httpd/
            make
            make install


            到此,我們就可以通過svn命令獲取最新的ffmpeg了

            svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

            你會發現在你所在的目錄,自動出現一個ffmpeg的目錄,就是你下載的源代碼。


            我們還不能這么快編譯ffmpeg,應該如果要讓ffmpeg支持更多格式的轉換,還需做一些前期工作


            2.支持mp3,linux當然是lame,下載解壓
            tar zxvf lame-3.97b3_.tar.gz
            cd lame-3.97.1
            ./configure --prefix=/usr  --enable-shared
            make
            make install
            這里推薦盡量裝在/usr下,默認是裝在/usr/local下。這樣ffmpeg編譯都能順利的找到庫文件


            3.支持Ogg和Vorbis:
            as4你可以安裝一下如下tar包
            libvorbis, libvorbis-devel,libogg, libogg-devel
            tar jxvf libvorbis-1.1.1-1-src.tar.bz2
            cd libvorbis-1.1.1-1
            ./configure --prefix=/usr  --enable-shared
            make
            make install
            其他的(libvorbis-devel,libogg, libogg-devel這三個tar直接解壓就可以了用tar jxvf libvorbis-devel.........)

            4.支持xvid x264,現在最流行的兩種高質量的壓縮格式
            xvid的編譯安裝
            下載 http://downloads.xvid.org/downloads/xvidcore-1.1.0.tar.gz
            tar zvxf xvidcore-1.1.0.tar.gz
            cd xvidcore-1.1.0/build/generic/
            ./configure --prefix=/usr --enable-shared
            make
            make install


            ***在安裝X264之前必須安裝nasm-0.98.39.tar.bz2 不然X264裝不上去***
            下載nasm-0.98.39.tar.bz2
            tar jxvf nasm-0.98.39.tar.bz2
            cd nams-0.98.39
            ./configure --prefix=/usr --enable-shared
            make
            make install

            下載 x264-snapshot.tar.bz2
            tar jxvf  x264-snapshot.tar.bz2
            cd  x264-snapshot.tar.bz2
            ./configure --prefix=/usr --enable-shared
            make
            make install


            5.AC3和dts編碼的支持
            as4系統似乎已經支持ac3編碼,編譯的時候只要加--enable-a52 --enable-gpl參數就行

            libdts-0.0.2.tar.gz編譯參數
            tar zxvf libdts-0.0.2.tar.gz 
            cd libdts-0.0.2
            ./configure --prefix=/usr --enable-shared
            make
            make install


            6.mpg4 aac格式支持,由于服務器還針對手機用戶服務,所以,類似aac,mpg4鈴聲格式的支持,我們也得做。這里我們安裝faad2和faac就行
            下載請到http://www.audiocoding.com/modules/mydownloads/

            ***先編譯FAAD2,然后在編譯FAAC。有個先后順序的***

            //////////////////////////FAAD2的編譯\\\\\\\\\\\\\\\\\\\\\\\\\\\\
            tar zxvf  faad2-2.5.tar.gz
            cd faad2
            在編譯FAAD2時可能出現的錯誤,參照你的錯誤現象去修改

            錯誤現象:

            cd faad2
            [root@TServer faad2]# autoreconf  -ivf
            autoreconf: Entering directory `.'
            autoreconf: configure.in: not using Gettext
            autoreconf: running: aclocal --force
            autoreconf: configure.in: tracing
            autoreconf: running: libtoolize --copy --force
            autoreconf: running: /usr/bin/autoconf --force
            autoreconf: running: /usr/bin/autoheader --force
            autoreconf: running: automake --add-missing --copy --force-missing
            configure.in: installing `./install-sh'
            configure.in: installing `./missing'
            common/mp4ff/Makefile.am: installing `./compile'
            common/mp4ff/Makefile.am: installing `./depcomp'
            plugins/Makefile.am:12: required directory plugins/bmp does not exist
            plugins/xmms/src/Makefile.am:2: libdir was already defined in condition TRUE, which includes condition HAVE_BMP ...
            configure.in:10: ... `libdir' previously defined here
            plugins/xmms/src/Makefile.am:8: libdir was already defined in condition TRUE, which includes condition !HAVE_BMP ...
            configure.in:10: ... `libdir' previously defined here
            Makefile.am: installing `./INSTALL'
            autoreconf: automake failed with exit status: 1

            解決方案:
            只要把BMP相關的編譯條件(一般都是以if-else形式存在的,注意要把整個塊都刪除)都remove,就好了。
            操作如下:
            [root@TServer faad2]# cd plugins/
            [root@TServer plugins]# grep -lr BMP *
            Makefile.am
            xmms/src/libmp4.c
            xmms/src/Makefile.am
            [root@TServer plugins]# vi Makefile.am
            if HAVE_MPEG4IP_PLUG
            if HAVE_XMMS
            SUBDIRS = xmms mpeg4ip
            else
            SUBDIRS = mpeg4ip
            endif #HAVE_XMMS
            else
            if HAVE_XMMS
            SUBDIRS = xmms
            else
            SUBDIRS =
            endif #HAVE_XMMS
            endif #HAVE_MPEG4IP_PLUG
            ~
            ~
            ~
            ~
            ~
            ~
            ~
            "Makefile.am" [dos] 13L, 200C 已寫入                        
            [root@TServer plugins]# grep -lr BMP *
            xmms/src/libmp4.c
            xmms/src/Makefile.am
            [root@TServer plugins]# vi xmms/src/libmp4.c
            /*
             * MP4/AAC decoder for xmms
             *
             * OPTIONNAL need
             * --------------
             * libid3 (3.8.x - www.id3.org)
            */

            #include <pthread.h>
            #include <gtk/gtk.h>
            #include <stdio.h>
            #include <string.h>

            #include "neaacdec.h"
            #include "mp4ff.h"

            #define MP4_DESCRIPTION "MP4 & MPEG2/4-AAC audio player - 1.2.x"
            #define MP4_VERSION     "ver. 0.5-faad2-version - 22 August 2004"
            #define MP4_ABOUT       "Written by ciberfred"
            #define BUFFER_SIZE     FAAD_MIN_STREAMSIZE*64

            static void     mp4_init(void);
            static void     mp4_about(void);
            static void     mp4_play(char *);
            static void     mp4_stop(void);
            "xmms/src/libmp4.c" [dos] 574L, 15762C 已寫入
            [root@TServer plugins]# ls
            in_mp4  Makefile.am  mpeg4ip  QCD  QCDMp4  xmms
            [root@TServer plugins]# grep -lr BMP *
            xmms/src/Makefile.am
            [root@TServer plugins]# vi xmms/src/Makefile.am
            if HAVE_BMP
            libdir=$(shell pkg-config --variable=input-plugin-dir bmp)
            local_CFLAGS=$(shell pkg-config --cflags bmp)
            local_LDFLAGS=$(shell pkg-config --libs bmp)
            else
            local_CFLAGS=`$(XMMS_CONFIG) --cflags` -Wall
            local_LDFLAGS=`$(XMMS_CONFIG) --libs`
            libdir = `$(XMMS_CONFIG) --input-plugin-dir`
            endif #HAVE_BMP
            lib_LTLIBRARIES = libmp4.la

            libmp4_la_CFLAGS = $(local_CFLAGS) -Wall \
                   -I$(top_srcdir)/include -I$(top_srcdir)/common/mp4ff

            libmp4_la_LIBADD = $(top_builddir)/libfaad/libfaad.la \
                   $(top_builddir)/common/mp4ff/libmp4ff.la

            libmp4_la_LDFLAGS = -module -avoid-version $(local_LDFLAGS) -lpthread

            libmp4_la_SOURCES = libmp4.c mp4_utils.c aac_utils.c
            ~
            ~
            "xmms/src/Makefile.am" [dos] 11L, 373C 已寫入
            [root@TServer plugins]# cd ..
            [root@TServer faad2]# grep -lr BMP *
            configure.in
            [root@TServer faad2]# vi configure.in
              AM_CONDITIONAL([HAVE_BMP], true)
            fi

            if test x$WITHDRM = xyes; then
              AC_DEFINE(DRM, 1, [Define if you want to use libfaad together with Digital Radio Mondiale (DRM)])
              AC_DEFINE(DRM_PS, 1, [Define if you want support for Digital Radio Mondiale (DRM) parametric stereo])
            fi

            AC_CONFIG_FILES(libfaad/Makefile)
            AC_CONFIG_FILES(common/Makefile)
            AC_CONFIG_FILES(common/mp4ff/Makefile)
            AC_CONFIG_FILES(plugins/Makefile)
            AC_CONFIG_FILES(plugins/xmms/Makefile)
            AC_CONFIG_FILES(plugins/xmms/src/Makefile)
            AC_CONFIG_FILES(plugins/mpeg4ip/Makefile)
            AC_CONFIG_FILES(faad2.spec)
            AC_CONFIG_FILES(frontend/Makefile)
            AC_CONFIG_FILES(Makefile)
            已查找到文件結尾;再從開頭繼續查找
            AC_PROG_MAKE_SET
            AC_CHECK_PROGS(RPMBUILD, rpmbuild, rpm)

            AM_CONFIG_HEADER(config.h)

            AC_ARG_WITH(xmms,[  --with-xmms             compile XMMS-1 plugin],
                         WITHXMMS=$withval, WITHXMMS=no)


            AC_ARG_WITH(drm,[  --with-drm              compile libfaad with DRM support],
                         WITHDRM=$withval, WITHDRM=no)

            AC_ARG_WITH(mpeg4ip, [  --with-mpeg4ip          compile mpeg4ip plugin],
                                 WITHMPEG4IP=$withval, WITHMPEG4IP=no)

            dnl Checks for header files required for mp4.h
            AC_HEADER_STDC
            AC_CHECK_HEADERS(stdint.h inttypes.h)
            AC_CHECK_HEADERS(mathf.h)
            AC_CHECK_HEADERS(float.h)
            /BMP                                                        
              fi

              AM_CONDITIONAL(HAVE_XMMS, true)
            else
             AC_MSG_NOTICE(no xmms build configured)
             AM_CONDITIONAL(HAVE_XMMS, false)
            fi

            if test x$WITHDRM = xyes; then
              AC_DEFINE(DRM, 1, [Define if you want to use libfaad together with Digital Radio Mondiale (DRM)])
              AC_DEFINE(DRM_PS, 1, [Define if you want support for Digital Radio Mondiale (DRM) parametric stereo])
            fi
            AC_CONFIG_FILES(libfaad/Makefile)AC_CONFIG_FILES(common/Makefile)AC_CONFIG_FILES(common/mp4ff/Makefile)AC_CONFIG_FILES(plugins/Makefile)
            AC_CONFIG_FILES(plugins/xmms/Makefile)
            "configure.in" [dos] 131L, 3776C 已寫入
            [root@TServer faad2]# grep -lr BMP *
            [root@TServer faad2]# ls
            aacDECdrop  common        faad2.spec.in    libfaad      README
            AUTHORS     configure.in  frontend         Makefile.am  README.linux
            bootstrap   COPYING       include          NEWS         TODO
            ChangeLog   docs          in_mpeg4aac.nsi  plugins
            [root@TServer faad2]# autoreconf -vir
            /usr/bin/autoreconf: unrecognized option `-r'
            Try `/usr/bin/autoreconf --help' for more information.
            [root@TServer faad2]# autoreconf -vif
            autoreconf: Entering directory `.'
            autoreconf: configure.in: not using Gettext
            autoreconf: running: aclocal --force
            autoreconf: configure.in: tracing
            autoreconf: running: libtoolize --copy --force
            autoreconf: running: /usr/bin/autoconf --force
            autoreconf: running: /usr/bin/autoheader --force
            autoreconf: running: automake --add-missing --copy --force-missing
            configure.in: installing `./install-sh'
            configure.in: installing `./missing'
            common/mp4ff/Makefile.am: installing `./compile'
            common/mp4ff/Makefile.am: installing `./depcomp'
            Makefile.am: installing `./INSTALL'
            autoreconf: Leaving directory `.'

            cd faad2
            autoreconf -vif
            ./configure --prefix=/usr --with-mp4v2 --enable-shared
            make
            make install

            ////////////////faac的編譯\\\\\\\\\\\\\\\\\\\\\\\\

            cd faac
            faac-1.25,有兩個地方需要修改,一是m4 macro文件,另外一個是需要對文件的格式及權限作一下處理:
            錯誤現象 1:
            [root@TServer faac]# autoreconf -vif
            autoreconf: Entering directory `.'
            autoreconf: configure.in: not using Gettext
            autoreconf: running: aclocal --force
            configure.in:10: warning: underquoted definition of MY_DEFINE
              run info '(automake)Extending aclocal'
              or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
            autoreconf: configure.in: tracing
            autoreconf: running: libtoolize --copy --force
            configure.in:10: warning: underquoted definition of MY_DEFINE
              run info '(automake)Extending aclocal'
              or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
            autoreconf: running: /usr/bin/autoconf --force
            autoreconf: running: /usr/bin/autoheader --force
            autoreconf: running: automake --add-missing --copy --force-missing
            autoreconf: Leaving directory `.'
            [root@TServer faac]# grep MY_DEFINE *
            configure.in:AC_DEFUN(MY_DEFINE, [ AC_DEFINE($1, 1, [define if needed]) ])
            configure.in:AC_CHECK_DECL(strcasecmp, MY_DEFINE(HAVE_STRCASECMP))
            configure.in:     MY_DEFINE(HAVE_LIBMP4V2)
            configure.in:AC_CHECK_DECL(strchr, MY_DEFINE(HAVE_STRCHR))
            configure.in:AC_CHECK_DECL(memcpy, MY_DEFINE(HAVE_MEMCPY))
            configure.in:AC_CHECK_DECL(strsep, MY_DEFINE(HAVE_STRSEP))


            解決方案1:
            [root@TServer faac]# grep MY_DEFINE *
            configure.in:AC_DEFUN(MY_DEFINE, [ AC_DEFINE($1, 1, [define if needed]) ])
            configure.in:AC_CHECK_DECL(strcasecmp, MY_DEFINE(HAVE_STRCASECMP))
            configure.in:     MY_DEFINE(HAVE_LIBMP4V2)
            configure.in:AC_CHECK_DECL(strchr, MY_DEFINE(HAVE_STRCHR))
            configure.in:AC_CHECK_DECL(memcpy, MY_DEFINE(HAVE_MEMCPY))
            configure.in:AC_CHECK_DECL(strsep, MY_DEFINE(HAVE_STRSEP))

            把configure.in文件中的AC_DEFUN(MY_DEFINE, [ AC_DEFINE($1, 1, [define if needed]) ])
            修改為 AC_DEFUN([MY_DEFINE], [ AC_DEFINE($1, 1, [define if needed]) ])
            然后就可以autoreconf -ivf了。

            錯誤現象2:
            ./configure的時候,會出現以下錯誤:
            configure: creating ./config.status
            config.status: creating common/Makefile
            config.status: creating common/mp4v2/Makefile
            config.status: creating \
            .infig.status: error: cannot find input file: \


            這個問題是文件的格式問題造成的,可以用一下方法處理:
            [root@TServer faac]#find . -type f | xargs dos2unix

            [root@TServer faac]#chmod * 777 -R

            處理之后,就可以安裝了。
             
            chmod +x bootstrap
            ./bootstrap
            ./configure --prefix=/usr --with-mp4v2 --enable-shared
            make
            make install

            7.支持3gp格式,這也是現在好多手機支持的格式,所以也得支持編譯

            編譯的時候加上--enable-amr_nb --enable-amr_wb參數就行,根據編譯系統的提示,所以我們得下載一

            些編譯3gp所需得文件。
            先在ffmpeg-0.4.9-p20051120/libavcoder/建三個目錄
            mkdir -p amr
            mkdir -p amr_float
            mkdir -p amrwb_float

            下載http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26073-530_ANSI_C_source_code.zip
            解壓以后把里面的文件都拷貝到libavcodec/amr

            下載http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-530_ANSI-C_source_code.zip
            解壓以后把里面的文件都拷貝到libavcodec/amrwb_float

            下載http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-540_ANSI_C_source_code.zip
            解壓以后把里面的文件都拷貝到libavcodec/amr_float

            修改libavcodec/amr/makefile 找到CFLAGS = -Wall -pedantic-errors -I. $(CFLAGS_$(MODE)) -D$(VAD) 換成CFLAGS = -Wall -I. $(CFLAGS_$(MODE)) -D$(VAD) -DMMS_IO


            8.編譯ffmpeg-0.4.9-p20051120
            tar xvf ffmpeg-0.4.9-p20051120.tar
            cd ffmpeg-0.4.9-p20051120
            ./configure --prefix=/usr --enable-gpl --enable-shared --enable-mp3lame --enable-amr_nb --enable-amr_nb-fixed --enable-amr_wb --enable-amr_if2 --enable-libogg --enable-vorbis --enable-xvid --enable-a52 --enable-a52bin --enable-dts --enable-pp --enable-faad --enable-faadbin --enable-faac --enable-x264 --enable-pthreads --disable-ffserver --disable-ffplay --cpu=CPU
            make
            make install


            小修正一下,如果上面的configure不行,在我的機器上得這樣,可能由于版本的關系,
            ./configure --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame  --enable-libx264 --enable-libxvid --enable-x11grab --prefix=/usr --enable-shared

            補充1:
            要是說在當在cpu是x86的情況下,不能編譯過去,如果你真編譯不過去,可以試著加上--cpu=CPU

            補充2:
            當遇到編譯ffmpeg出錯時,找到vi ffmpeg/libavcodec/x264.c刪除x4->params.rc.b_cbr = 1;這一行

            到此,一個ffmpeg編譯好了,不過目前管方的ffmpeg還不支持wma9和rmvb,不過網上有很多解決方法。

            ffmpeg的轉換參數:
            ffmpeg -y -i test.mpeg -ac 1 -acodec amr_nb -ar 8000 -s 320x240 -b 128 -r 15 test.3gp


            *************************mencoder的編譯********************************

            mencoder安裝篇

            1、下載主程序: MPlayer-1.0rc1.tar.bz2

            2、下載essential-20061022.tar.bz2,安裝:
            tar vjxf essential-20061022.tar.bz2
            mv essential-20061022 /usr/lib/codes
            chmod 644 /usr/lib/codes/*
            chown root.root /usr/lib/codes/*

            3、下載windows-essential-20061022.zip,安裝:
            unzip windows-essential-20061022.zip
            mv windows-essential-20061022 /usr/lib/wincodes
            chmod 644 /usr/lib/wincodes/*
            chown root.root /usr/lib/wincodes/*

            4、安裝mplayer

            tar vjxf MPlayer-1.0rc1.tar.bz2
            cd MPlayer-1.0rc1
            ./configure --prefix=/usr  --with-codecsdir=/usr/lib/codecs/   --language=zh_CN
            make
            make install
            如果你需要使用mplayer在linux下播放視頻,還需要加上--enable-gui(圖形界面),不過這樣就要安裝多很多東西了,這里我們只使用它的mencoder,所以--enable-gui可以省略


            mencoder的配置參數:
            ./configure --prefix=/usr  --with-codecsdir=/usr/lib/codecs/     --language=zh_CN


            mencoder轉換參數:
            mencoder /var/www/woyo/image.woyo.com/%inputfile% -o /var/www/woyo/image.woyo.com/%outputfile%   -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=300:mbd=2:last_pred=3:dia=2:cmp=3:vb_strategy=1 -sws 3 -vf scale=400:300  -ofps 30 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames

            posted on 2009-08-03 14:30 葉子 閱讀(3509) 評論(0)  編輯 收藏 引用 所屬分類: MPEG

            久久久亚洲裙底偷窥综合| 国产亚洲精久久久久久无码AV| 国产精品视频久久久| 奇米影视7777久久精品人人爽 | 久久99精品久久久久久久不卡| 三级片免费观看久久| 欧美性猛交xxxx免费看久久久| 久久久久久国产精品美女| 国产高潮久久免费观看| 国内精品欧美久久精品| 久久久久国产精品嫩草影院| 久久久久黑人强伦姧人妻| 久久性精品| 久久久无码精品亚洲日韩京东传媒| 99久久99久久精品国产片果冻 | 日本精品久久久中文字幕| 亚洲国产精品久久久天堂| 色婷婷久久综合中文久久蜜桃av| 乱亲女H秽乱长久久久| 色综合久久综合网观看| 久久99精品国产麻豆蜜芽| 国产精品乱码久久久久久软件| 亚洲AV无一区二区三区久久| 2020久久精品国产免费| 国产一区二区三精品久久久无广告| 色播久久人人爽人人爽人人片aV | 激情久久久久久久久久| 欧美亚洲国产精品久久| 国产精品久久一区二区三区| 国产精品美女久久久网AV| 久久综合精品国产一区二区三区 | 久久这里只有精品18| 国产福利电影一区二区三区久久久久成人精品综合 | 国产毛片久久久久久国产毛片| 亚洲а∨天堂久久精品| 久久精品人人做人人爽97| 久久精品三级视频| 久久精品国产亚洲AV嫖农村妇女 | 亚洲日韩欧美一区久久久久我| 国内精品人妻无码久久久影院| 麻豆久久|