編譯環境搭建
參考文章《QT Mingw32/64編譯ffmpeg源碼生成32/64bit庫以及測試》,搭建msys64環境;
運行msys.exe,運行:
pacman -S git subversion cvs automake autoconf libtool m4 make gettext pkg-config mingw-w64-i686-lua findutils mingw-w64-i686-headers yasm patch
pacman -S gettext
pacman -S flex
pacman -S bison
pacman -S protobuf
安裝所需工具。
代碼下載
VLC源碼,我是用的vlc 2.2.4
http://download.videolan.org/pub/videolan/vlc/
https://mirrors.tuna.tsinghua.edu.cn/videolan-ftp/vlc/
VLC Contrib:
http://download.videolan.org/pub/videolan/contrib/x86_64-w64-mingw32/
https://mirrors.tuna.tsinghua.edu.cn/videolan-ftp/contrib/x86_64-w64-mingw32/
編譯
將contrib解壓到vlc源碼的contrib文件夾下。
運行msys64安裝目錄下的mingw64.exe。
如果沒有下載contrib文件,則需要執行以下命令在線獲取,速度很慢,可以直接下載清華源中的文件:
cd contrib/
mkdir win32
cd win32/
../bootstrap --build=x86_64-w64-mingw32
make prebuilt
執行以下代碼進行編譯:
cd vlc源碼目錄
export BUILDCC="/usr/bin/gcc"
./bootstrap
mkdir win32
cd win32/
sh ../extras/package/win32/configure.sh --host=x86_64-w64-mingw32 --disable-nls
configure會報很多錯,像“”onfigure: error:libavcodec versions 55 and later are not supported yet”,可以使用下面的configure:
sh ../extras/package/win32/configure.sh --host=x86_64-w64-mingw32 --disable-nls --disable-lua --disable-mad --disable-avcodec --disable-avformat--disable-swscale --disable-postproc --disable-a52 --disable-mkv
然后執行如下命令:
make
make package-win32-zip
make package-win32-exe