android ffmpeg 參數

最近想做android平臺的視頻擴展,跟大家一樣選擇了ffmpeg.之前在同事的幫助下編譯過vlc,這個視頻工具編譯比較簡便,成功很高,可以播放一般的格式視頻,但是總歸是別人的。想自己從基本着手。

ps: vlc下載編譯方法http://www.tidroid.com/article_110.html

在網上查了一些博客啊論壇,編譯ffmpeg的文章大相徑庭,除了作者比較nb外,照着別人的編譯,沒有幾個成功了的。我覺得主要原因還是對 bash shell 命令不瞭解的原因。爲什麼要那麼寫,大家其實心裏都想知道,苦於無從下手,因爲初次接觸。我也是初次接觸,嘗試了AbitNo,等等幾個牛人編譯的congfig.sh 和  Android.mk文件都失敗了。遇到問題不能這麼就放棄,雖然也是初次接觸,但是別人能做到我也一定能成功。

下面一行一行的解釋congfig.sh文件中的命令:

#!/bin/sh  首先申明瞭這個一個 shell 命令文件,可以在終端執行。

#這兩行主要是對變量賦值,以便下面引用,暫時可以不管

PREBUILT=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86
PLATFORM=$ANDROID_NDK/platforms/android-14/arch-arm  

重要的部分開始了:

 ./configure   --target-os=linux \   --arch=arm \  --enable-version3 \   --enable-gpl \   --enable-nonfree \   --disable-doc \
    --disable-stripping \  --disable-ffmpeg \    --disable-ffplay \ 等等……

這是什麼,爲什麼寫這麼多,有什麼用。

這個configure是ffmpeg官方寫一個shell文件,文件就在ffmpeg根目錄下,用gedit打開看了一下,很多bash shell命令以及方法,作爲初學者這麼去讀肯定費勁。可以在終端 進入到ffmpeg目錄下執行 ./configure --help 如果提示沒有權限的先執行chmod a+x configure .可以看到如下提示信息:

Usage: configure [options]
Options: [defaults in brackets after descriptions]

Standard options:
  --help                   print this message
  --logfile=FILE           log tests and output to FILE [config.log]
  --disable-logging        do not log configure debug information
  --prefix=PREFIX          install in PREFIX []
  --bindir=DIR             install binaries in DIR [PREFIX/bin]
  --datadir=DIR            install data files in DIR [PREFIX/share/ffmpeg]
  --libdir=DIR             install libs in DIR [PREFIX/lib]
  --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]
  --incdir=DIR             install includes in DIR [PREFIX/include]
  --mandir=DIR             install man page in DIR [PREFIX/share/man]

Configuration options:
  --disable-static         do not build static libraries [no]
  --enable-shared          build shared libraries [no]
  --enable-gpl             allow use of GPL code, the resulting libs
                           and binaries will be under GPL [no]
  --enable-version3        upgrade (L)GPL to version 3 [no]
  --enable-nonfree         allow use of nonfree code, the resulting libs
                           and binaries will be unredistributable [no]
  --disable-doc            do not build documentation
  --disable-ffmpeg         disable ffmpeg build
  --enable-avconv          enable  avconv build
  --disable-ffplay         disable ffplay build
  --disable-ffprobe        disable ffprobe build
  --disable-ffserver       disable ffserver build
  --disable-avdevice       disable libavdevice build
  --disable-avcodec        disable libavcodec build
  --disable-avformat       disable libavformat build
  --disable-swresample     disable libswresample build
  --disable-swscale        disable libswscale build
  --disable-postproc       disable libpostproc build
  --disable-avfilter       disable video filter support [no]
  --disable-pthreads       disable pthreads [auto]
  --disable-w32threads     disable Win32 threads [auto]
  --disable-os2threads     disable OS/2 threads [auto]
  --enable-x11grab         enable X11 grabbing [no]
  --disable-network        disable network support [no]
  --enable-gray            enable full grayscale support (slower color)
  --disable-swscale-alpha  disable alpha channel support in swscale
  --disable-fastdiv        disable table-based division
  --enable-small           optimize for size instead of speed
  --disable-aandct         disable AAN DCT code
  --disable-dct            disable DCT code
  --disable-fft            disable FFT code
  --disable-golomb         disable Golomb code
  --disable-huffman        disable Huffman code
  --disable-lpc            disable LPC code
  --disable-mdct           disable MDCT code
  --disable-rdft           disable RDFT code
  --enable-vaapi           enable VAAPI code [autodetect]
  --enable-vda             enable VDA code [autodetect]
  --enable-vdpau           enable VDPAU code [autodetect]
  --disable-dxva2          disable DXVA2 code
  --disable-vda            disable VDA code
  --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  --disable-safe-bitstream-reader
                           disable buffer boundary checking in bitreaders
                           (faster, but may crash)
  --enable-memalign-hack   emulate memalign, interferes with memory debuggers
  --disable-everything     disable all components listed below
  --disable-encoder=NAME   disable encoder NAME
  --enable-encoder=NAME    enable encoder NAME
  --disable-encoders       disable all encoders
  --disable-decoder=NAME   disable decoder NAME
  --enable-decoder=NAME    enable decoder NAME
  --disable-decoders       disable all decoders
  --disable-hwaccel=NAME   disable hwaccel NAME
  --enable-hwaccel=NAME    enable hwaccel NAME
  --disable-hwaccels       disable all hwaccels
  --disable-muxer=NAME     disable muxer NAME
  --enable-muxer=NAME      enable muxer NAME
  --disable-muxers         disable all muxers
  --disable-demuxer=NAME   disable demuxer NAME
  --enable-demuxer=NAME    enable demuxer NAME
  --disable-demuxers       disable all demuxers
  --enable-parser=NAME     enable parser NAME
  --disable-parser=NAME    disable parser NAME
  --disable-parsers        disable all parsers
  --enable-bsf=NAME        enable bitstream filter NAME
  --disable-bsf=NAME       disable bitstream filter NAME
  --disable-bsfs           disable all bitstream filters
  --enable-protocol=NAME   enable protocol NAME
  --disable-protocol=NAME  disable protocol NAME
  --disable-protocols      disable all protocols
  --disable-indev=NAME     disable input device NAME
  --disable-outdev=NAME    disable output device NAME
  --disable-indevs         disable input devices
  --disable-outdevs        disable output devices
  --disable-devices        disable all devices
  --enable-filter=NAME     enable filter NAME
  --disable-filter=NAME    disable filter NAME
  --disable-filters        disable all filters
  --list-decoders          show all available decoders
  --list-encoders          show all available encoders
  --list-hwaccels          show all available hardware accelerators
  --list-muxers            show all available muxers
  --list-demuxers          show all available demuxers
  --list-parsers           show all available parsers
  --list-protocols         show all available protocols
  --list-bsfs              show all available bitstream filters
  --list-indevs            show all available input devices
  --list-outdevs           show all available output devices
  --list-filters           show all available filters

External library support:
  --enable-avisynth        enable reading of AVISynth script files [no]
  --enable-bzlib           enable bzlib [autodetect]
  --enable-frei0r          enable frei0r video filtering
  --enable-gnutls          enable gnutls [no]
  --enable-libaacplus      enable AAC+ encoding via libaacplus [no]
  --enable-libass          enable libass subtitles rendering [no]
  --enable-libcelt         enable CELT decoding via libcelt [no]
  --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  --enable-libopencv       enable video filtering via libopencv [no]
  --enable-libcdio         enable audio CD grabbing with libcdio
  --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
                           and libraw1394 [no]
  --enable-libdirac        enable Dirac support via libdirac [no]
  --enable-libfaac         enable FAAC support via libfaac [no]
  --enable-libfreetype     enable libfreetype [no]
  --enable-libgsm          enable GSM support via libgsm [no]
  --enable-libmodplug      enable ModPlug via libmodplug [no]
  --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
  --enable-libnut          enable NUT (de)muxing via libnut,
                           native (de)muxer exists [no]
  --enable-libopenjpeg     enable JPEG 2000 encoding/decoding via OpenJPEG [no]
  --enable-libpulse        enable Pulseaudio input via libpulse [no]
  --enable-librtmp         enable RTMP[E] support via librtmp [no]
  --enable-libschroedinger enable Dirac support via libschroedinger [no]
  --enable-libspeex        enable Speex support via libspeex [no]
  --enable-libstagefright-h264  enable H.264 decoding via libstagefright [no]
  --enable-libtheora       enable Theora encoding via libtheora [no]
  --enable-libutvideo      enable Ut Video decoding via libutvideo [no]
  --enable-libv4l2         enable libv4l2/v4l-utils [no]
  --enable-libvo-aacenc    enable AAC encoding via libvo-aacenc [no]
  --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
  --enable-libvorbis       enable Vorbis encoding via libvorbis,
                           native implementation exists [no]
  --enable-libvpx          enable VP8 support via libvpx [no]
  --enable-libx264         enable H.264 encoding via x264 [no]
  --enable-libxavs         enable AVS encoding via xavs [no]
  --enable-libxvid         enable Xvid encoding via xvidcore,
                           native MPEG-4/Xvid encoder exists [no]
  --enable-openal          enable OpenAL 1.1 capture support [no]
  --enable-mlib            enable Sun medialib [no]
  --enable-openssl         enable openssl [no]
  --enable-zlib            enable zlib [autodetect]

Advanced options (experts only):
  --cross-prefix=PREFIX    use PREFIX for compilation tools []
  --enable-cross-compile   assume a cross-compiler is used
  --sysroot=PATH           root of cross-build tree
  --sysinclude=PATH        location of cross-build system headers
  --target-os=OS           compiler targets OS []
  --target-exec=CMD        command to run executables on target
  --target-path=DIR        path to view of build directory on target
  --nm=NM                  use nm tool
  --ar=AR                  use archive tool AR [ar]
  --as=AS                  use assembler AS []
  --cc=CC                  use C compiler CC [gcc]
  --cxx=CXX                use C compiler CXX [g++]
  --ld=LD                  use linker LD
  --host-cc=HOSTCC         use host C compiler HOSTCC
  --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
  --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
  --host-libs=HLIBS        use libs HLIBS when linking for host
  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS []
  --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS []
  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS []
  --extra-libs=ELIBS       add ELIBS []
  --extra-version=STRING   version string suffix []
  --build-suffix=SUFFIX    library name suffix []
  --progs-suffix=SUFFIX    program name suffix []
  --arch=ARCH              select architecture []
  --cpu=CPU                select the minimum required CPU (affects
                           instruction selection, may crash on older CPUs)
  --disable-asm            disable all assembler optimizations
  --disable-altivec        disable AltiVec optimizations
  --disable-amd3dnow       disable 3DNow! optimizations
  --disable-amd3dnowext    disable 3DNow! extended optimizations
  --disable-mmx            disable MMX optimizations
  --disable-mmx2           disable MMX2 optimizations
  --disable-sse            disable SSE optimizations
  --disable-ssse3          disable SSSE3 optimizations
  --disable-avx            disable AVX optimizations
  --disable-armv5te        disable armv5te optimizations
  --disable-armv6          disable armv6 optimizations
  --disable-armv6t2        disable armv6t2 optimizations
  --disable-armvfp         disable ARM VFP optimizations
  --disable-iwmmxt         disable iwmmxt optimizations
  --disable-mmi            disable MMI optimizations
  --disable-neon           disable neon optimizations
  --disable-vis            disable VIS optimizations
  --disable-yasm           disable use of yasm assembler
  --enable-pic             build position-independent code
  --malloc-prefix=PFX      prefix malloc and related names with PFX
  --enable-sram            allow use of on-chip SRAM
  --disable-symver         disable symbol versioning
  --optflags               override optimization-related compiler flags

Developer options (useful when working on FFmpeg itself):
  --enable-coverage        build with test coverage instrumentation
  --disable-debug          disable debugging symbols
  --enable-debug=LEVEL     set the debug level []
  --disable-optimizations  disable compiler optimizations
  --enable-extra-warnings  enable more compiler warnings
  --disable-stripping      disable stripping of executables and shared libraries
  --samples=PATH           location of test samples for FATE, if not set use
                           $FATE_SAMPLES at make invocation time.

 

很清楚了吧,那些命令是幹嘛用的,都有說明.在使用過程中個人需要選擇相應的命令,可以不用完全的cp別人的了。

具體的一部分其他命令,大家可以查看bash shell 基礎命令,網上找一下,說明都很詳細的。

然後再是Android.mk文件,這個mk文件很長,就不帖上來了。這些文件主要是ndk-build的時候編譯的制定的c類或者引用的makefile文件,這個文件也沒具體看,等研究後再更新上來。

希望此文章能夠給像我這樣的初學者解惑,以及更深入的研究學習,增加你們編譯成功率。牛人覺得寫得有錯或太簡單,也希望能給些指導和意見,使小弟能夠步入正軌,大家共同進步。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章