https://wiki.videolan.org/Win32Compile按照官网教程,安装所需工具,参考 :http://qjw.qiujinwu.com/blog/2014/12/08/cross_build_vlc_in_linux
git vlc: git clone git://git.videolan.org/vlc.git vlc
vlc版本:3.0.0-git
cd vlc/contrib
mkdir win32 && cd win32
../bootstrap --host=i686-w64-mingw32make prebuilt
不知道要不要移除,反正我移除了:rm -f ../i686-w64-mingw32/bin/moc ../i686-w64-mingw32/bin/uic ../i686-w64-mingw32/bin/rcc
编译自己的ffmpeg来进一步缩小体积:下载ffmpeg2.5,另存为vlc/contrib/tarballs/ffmpeg-HEAD.tar.gz,去掉contrib/src中的其他目录,除了ffmpeg,gsm,lame,openjpeg,zlib及一些sh和mak文件,
make fetch,会下载gsm,lame,openjpeg,zlib的包。
修改contrib/src/ffmpeg/rules.mak:在中间加上下面一段,去掉不需要的解码器,复用器,协议等
- FFMPEGCONF += --enable-memalign-hack
- --disable-decoders
- --enable-decoder=mpeg4
- --enable-decoder=flv
- --enable-decoder=h264
- --enable-decoder=wmv2
- --enable-decoder=wmv3
- --enable-decoder=rv40
- --enable-decoder=flac
- --enable-decoder=mp3
- --enable-decoder=pcm_alaw
- --enable-decoder=pcm_s8
- --enable-decoder=pcm_s8_planar
- --enable-decoder=pcm_u16be
- --enable-decoder=pcm_u16le
- --enable-decoder=pcm_u8
- --enable-decoder=pcm_mulaw
- --enable-decoder=pcm_s16be
- --enable-decoder=pcm_s16le
- --enable-decoder=pcm_s16le_planar
- --enable-decoder=ac3
- --enable-decoder=aac
- --enable-decoder=ape
- --enable-decoder=wmav2
- --enable-decoder=vorbis
- --enable-decoder=mp1
- --enable-decoder=mp2
- --disable-demuxers
- --enable-demuxer=aac
- --enable-demuxer=ac3
- --enable-demuxer=pcm_u8
- --enable-demuxer=ape
- --enable-demuxer=asf
- --enable-demuxer=rm
- --enable-demuxer=m4v
- --enable-demuxer=avi
- --enable-demuxer=mov
- --enable-demuxer=mp3
- --enable-demuxer=mtv
- --enable-demuxer=mv
- --enable-demuxer=ogg
- --enable-demuxer=flac
- --enable-demuxer=wav
- --enable-demuxer=h264
- --enable-demuxer=flv
- --enable-demuxer=matroska
- --disable-protocols
- --disable-hwaccels
修改contrib/win32/config.mak:
- BUILD := x86_64-linux-gnu
- HOST := i686-w64-mingw32
- PKGS_DISABLE :=
- PKGS_ENABLE :=
- BUILD_DISCS := 1
- #BUILD_ENCODERS := 1
- #BUILD_NETWORK := 1
- GPL := 1
- HAVE_WIN32 := 1
- ENABLE_SMALL := 1
在contrib/win32目录make,会编译精简版的ffmpeg,生成的.o会替换掉contrib/i686-w64-mingw32的同名文件。链接的时候会链接自己编译的链接库。
cd 到vlc的根目录
mkdir win32 && cd win32
添加pkgconfig路径,不然编译vlc的时候会找不到外部库:
export PKG_CONFIG_LIBDIR=$HOME/vlc/contrib/i686-w64-mingw32/lib/pkgconfig
编译vlc:
- export CFLAGS="-O2"
- export CXXFLAGS="-O2"
- ../extras/package/win32/configure.sh --host=i686-w64-mingw32
- --disable-debug
- --disable-gprof
- --disable-cprof
- --disable-lua
- --disable-sout
- --disable-httpd
- --disable-vlm
- --disable-archive
- --disable-live555
- --disable-dc1394
- --disable-dv1394
- --disable-linsys
- --disable-dvdread
- --disable-dvdnav
- --disable-bluray
- --disable-chromaprint
- --disable-chromecast
- --disable-qt
- --disable-skins2
- --disable-x265
- --disable-gnutls
- --disable-taglib
- --disable-opencv
- --disable-smbclient
- --disable-dsm
- --disable-sftp
- --disable-v4l2
- --disable-decklink
- --disable-gnomevfs
- --disable-vcdx
- --disable-vcd
- --disable-screen
- --disable-libcddb
- --disable-vnc
- --disable-freerdp
- --disable-realrtsp
- --disable-macosx-eyetv
- --disable-macosx-qtkit
- --disable-macosx-avfoundation
- --disable-silent-rules
- --disable-asdcp
- --disable-dvbpsi
- --disable-gme
- --disable-shout
- --disable-mod
- --disable-mpc
- --disable-omxil
- --disable-omxil-vout
- --disable-mad
- --disable-shine
- --disable-gst-decode
- --disable-crystalhd
- --disable-postproc
- --disable-vpx
- --disable-faad
- --disable-fdkaac
- --disable-quicktime
- --disable-dca
- --disable-gles2
- --disable-gles1
- --disable-tremor
- --disable-rpi-omxil
- --disable-macosx-quartztext
- --disable-android-surface
- --disable-macosx
- --disable-minimal-macosx
- --disable-macosx-dialog-provider
- --disable-directfb
- --disable-x26410b
- --disable-aa
- --disable-alsa
- --disable-jack
- --disable-update-check
- --disable-fluidsynth
- --disable-ncurses
- --disable-opus
- --disable-sdl
- --disable-sdl-image
- --disable-opensles
- --disable-png
- --disable-jpeg
- --disable-zvbi
- --disable-telx
- --disable-libtar
- --disable-libxml2
- --disable-sid
- --disable-kva
- --disable-merge-ffmpeg
- --disable-samplerate
- --disable-directx
- --disable-daala
- --disable-mfx
- --disable-vda
- --disable-dxva2
- --disable-flac
- --disable-mpg123
- --disable-vorbis
- --disable-mkv
- --disable-a52
- --disable-libmpeg2
- --disable-theora
- --disable-x264
- --disable-twolame
- --disable-glx
- --disable-ogg
- --disable-mux_ogg
- --disable-x262
- --disable-growl
- --disable-macosx-vlc-app
- --disable-chromaprint
- --disable-chromecast
- --disable-audioqueue
- --disable-libgcrypt
- --disable-aribsub
- --disable-aribb25
- --disable-kate
- --disable-tiger
- --disable-xcb
- --disable-xvideo
- --disable-vdpau
- --disable-wayland
- --disable-svg
- --disable-svgdec
- --disable-mmal
- --disable-speex
- --disable-schroedinger
- --disable-atmo
- --disable-glspectrum
- --disable-libass
- --disable-udev
- --disable-mtp
- --disable-upnp
- --disable-bonjour
- --disable-goom
- --disable-projectm
- --disable-vsxu
- --with-libiconv-prefix
会需要一些库,自己添加比如iconv,然后
make package-win-common,会把编译好的所有文件放到vlc/win32/vlc-版本号 文件夹中,进入上述文件夹中:
find . -name "*.dll" -type f | xargs -i strip --strip-all {}
去掉dll中的调试信息。
生成的所有所需插件都在plugins中,经过筛选,仅留下下列dll:
libavformat_plugin.dll
libavcodec_plugin.dll
libfilesystem_plugin.dll
libdirect3d_plugin.dll
libdrawable_plugin.dll
libwaveout_plugin.dll
libaudio_format_plugin.dll
libpacketizer_flac_plugin.dll
转载:http://blog.csdn.net/sx5486510/article/details/43117559