ffmpeg的centos、msys2、msvc编译
msys2 和 centos
https://ffmpeg.org/download.html
https://ffmpeg.zeranoe.com/builds/ Windows MSYS2准备
1)安装MSYS2
http://www.msys2.org/
http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20161025.exe
// http://repo.msys2.org/distrib/i686/msys2-i686-20161025.exe
2)进入msys2的mingw64
C:\> C:\msys64\msys2_shell.cmd -mingw64 -full-path -here // 编译64位(x86_64-w64-mingw32)
C:\> C:\msys64\msys2_shell.cmd -mingw32 -full-path -here // 编译32位(i686-w64-mingw32),在configure后需要加入--host=i686-w64-mingw32
3)安装开发工具
编译x264, x265 和 ffplay,需要安装mingw工具链、nasm等: ### msys2 ###
$ pacman -S base-devel git mercurial cvs wget curl p7zip nasm yasm perl ruby python2
$ pacman -S mingw-w64-x86_64-toolchain // mingw-w64-i686-toolchain
$ pacman -S mingw-w64-x86_64-cmake // mingw-w64-i686-cmake
$ pacman -S mingw-w64-x86_64-qt-creator // mingw-w64-i686-qt-creator,或者安装cmake推荐的mingw-w64-x86_64-qt5可选包
注:qt5的大小超过了1GB,在编译x265时候作为cmake的配置,虽然是cmake的可选项,但是建议安装。 ### centos ###
$ sudo yum group install "Development Tools"
$ sudo yum install wget curl git
$ sudo yum install glibc-static libstdc++-static
$ vim /etc/yum.repos.d/nasm.repo // repo没有2.13版本的nasm,因此手动安装;debian 需要手动下载deb:https://packages.debian.org/sid/nasm
[nasm]
name=The Netwide Assembler
baseurl=http://www.nasm.us/pub/nasm/stable/linux/
enabled=1
gpgcheck=0 [nasm-testing]
name=The Netwide Assembler (release candidate builds)
baseurl=http://www.nasm.us/pub/nasm/testing/linux/
enabled=0
gpgcheck=0 [nasm-snapshot]
name=The Netwide Assembler (daily snapshot builds)
baseurl=http://www.nasm.us/pub/nasm/snapshots/latest/linux/
enabled=0
gpgcheck=0
$ sudo yum install nasm
$ sudo yum install cmake 下载和编译x264:
$ git clone http://git.videolan.org/git/x264.git
$ cd x264
$ git checkout -b stable remotes/origin/stable ### msys2 ###
$ make clean
// git reset --hard
// git clean -xf
// rm -rf /usr/local/x264
$ ./configure --prefix=/usr/local/x264 --enable-static --enable-strip --enable-pic // --host=i686-w64-mingw32
$ make -j8
$ make install
// $ ldd /usr/local/x264/bin/x264.exe | grep -v /c/WINDOWS | sort // 将依赖复制到bin下,就可以在CMD里直接运行x264.exe程序了
// liblsmash-2.dll => /mingw64/bin/liblsmash-2.dll (0x64e40000) // i686不需要复制
// $ cp /mingw64/bin/liblsmash-2.dll /usr/local/x264/bin
$ cd .. ### centos ###
$ ./configure --prefix=/usr/local/x264 --enable-static --enable-strip --enable-pic
$ sudo make -j8
$ sudo make install
$ cd .. 下载SDL2(生成ffplay必要):
$ curl -L http://www.libsdl.org/release/SDL2-2.0.8.tar.gz > SDL2-2.0.8.tar.gz
$ tar xzvf SDL2-2.0.8.tar.gz 编译SDL2(生成ffplay必要):
### msys2 ###
$ cd SDL2-2.0.8
// $ make distclean
// rm -rf /usr/local/sdl2
$ ./configure --prefix=/usr/local/sdl2 --enable-static // --host=i686-w64-mingw32
$ make -j8
$ make install
// $ ldd /usr/local/sdl2/bin/SDL2.dll | grep -v /c/WINDOWS | sort
// ??? => ??? (0x180000) // 不需要复制
$ cd .. ### centos ###
$ cd SDL2-2.0.8
// $ sudo make distclean
// sudo rm -rf /usr/local/sdl2
$ ./configure --prefix=/usr/local/sdl2 --enable-static
$ sudo make -j8
$ sudo make install
$ cd .. 下载x265源码:
$ curl -L http://ftp.videolan.org/pub/videolan/x265/x265_2.7.tar.gz > x265_2.7.tar.gz
$ tar xzvf x265_2.7.tar.gz
或者
$ hg clone https://bitbucket.org/multicoreware/x265 编译x265:
### msys2 ###
$ cd x265_2.7/build/msys
编辑toolchain-x86_64-w64-mingw32.cmake文件,全部替换x86_64-w64-mingw32-为空:
$ vim toolchain-x86_64-w64-mingw32.cmake
:%s/x86_64-w64-mingw32-//g
$ ./make-x86_64-w64-mingw32-Makefiles.sh // 注意:32位也调用此处
出现CMake配置窗口,编辑CMAKE_INSTALL_PREFIX为c:/msys64/usr/local/x265(请一定指定盘符),
勾选ENABLE_PIC,去掉勾选ENABLE_SHARED
然后一次点击Configure和Generate按钮,关闭CMake窗口
$ make -j8
$ make install
// $ ldd /usr/local/x265/bin/x265.exe | grep -v /c/WINDOWS | sort
// libgcc_s_seh-1.dll => /mingw64/bin/libgcc_s_seh-1.dll (0x61440000)
// libstdc++-6.dll => /mingw64/bin/libstdc++-6.dll (0x6fc40000)
// libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x64940000)
// 然后在CMD里单独执行,如果没任何提示就失败了,用Dependency Walker检查,发现需要LIBSTDC++-6.DLL等库:
// $ cp /mingw64/bin/libstdc++-6.dll \
// /mingw64/bin/libgcc_s_seh-1.dll \
// /mingw64/bin/libwinpthread-1.dll \
// /usr/local/x265/bin
// i868的情况:
// $ cp /mingw32/bin/libstdc++-6.dll \
// /mingw32/bin/libwinpthread-1.dll \
// /mingw32/bin/libgcc_s_dw2-1.dll \
// /usr/local/x265/bin
$ cd ../../.. ### centos ###
$ cd x265_2.7/build/linux
$ ./make-Makefiles.bash
编辑CMAKE_INSTALL_PREFIX为/usr/local/x265,勾选ENABLE_PIC(默认勾选),去掉勾选ENABLE_SHARED,输入c,g退出
$ sudo make -j8
$ sudo make install
$ cd ../../.. 下载fdk-aac
https://sourceforge.net/projects/opencore-amr/
https://github.com/mstorsjo/fdk-aac
$ tar xzvf fdk-aac-0.1.6.tar.gz 编译fdk-aac
$ cd fdk-aac-0.1.6
$ rm -rf /usr/local/fdk-aac
### msys2 ###
$ ./configure --prefix=/usr/local/fdk-aac --enable-static // --host=i686-w64-mingw32
$ make -j8
$ make install
// $ ldd /usr/local/fdk-aac/bin/libfdk-aac-1.dll | grep -v /c/WINDOWS | sort // 无依赖
$ cd .. ### centos ###
$ sudo ./configure --prefix=/usr/local/fdk-aac --enable-static
$ sudo make -j8
$ sudo install
$ cd .. centos更新openssl
下载openssl
$ yum info openssl // 查看下版本信息是否未1.1.x,若是,跳过更新openssl这步
$ wget https://www.openssl.org/source/openssl-1.1.0g.tar.gz
$ tar xvzf openssl-1.1.0g.tar.gz
$ cd openssl-1.1.0g
$ ./config --prefix=/usr/local/openssl
$ sudo make -j8
$ sudo make install 编译ffmpeg
注:ffmpeg v3.4 的 ffplay.c 有个不支持SDL2的BUG,可以将 v3.4.1 的 fftools/ffplay.c 替换过来。 ### msys2 ###
检查PKG配置
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/x265/lib/pkgconfig:/usr/local/x264/lib/pkgconfig:/usr/local/sdl2/lib/pkgconfig:/usr/local/fdk-aac/lib/pkgconfig" pkg-config --exists --print-errors x264 x265 sdl2 fdk-aac
直接返回表示成功。如果失败,会返回错误提示。 // 静态库配置
$ cd ffmpeg3.4
// $ rm -rf /usr/local/ffmpegstatic
// make distclean
// make clean
// git reset --hard
// git clean -xf
注:这里没有使用msvc工具链,而是msys的。
$ PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/x265/lib/pkgconfig:/usr/local/x264/lib/pkgconfig:/usr/local/sdl2/lib/pkgconfig:/usr/local/fdk-aac/lib/pkgconfig" ./configure \
--prefix=/usr/local/ffmpegstatic --enable-static --disable-shared \
--pkg-config-flags="--static" --extra-ldflags="-static -static-libgcc -static-libstdc++" \
--enable-gpl --enable-small --disable-doc --enable-nonfree \
--enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-openssl \
--enable-pic --disable-debug
$ make -j8
$ make install
下面是加入--extra-ldflags="-static -static-libgcc -static-libstdc++"的情况:
$ ldd /usr/local/ffmpegstatic/bin/ffmpeg.exe | grep -v /c/WINDOWS | sort
然后在CMD里单独执行,如果没任何提示就失败了,用Dependency Walker检查,发现需要的库:
$ cp /mingw64/bin/libwinpthread-1.dll \
/mingw64/bin/libgcc_s_seh-1.dll \
/usr/local/ffmpegstatic/bin
i868的情况:
//$ cp /mingw32/bin/libwinpthread-1.dll \
/mingw32/bin/libgcc_s_dw2-1.dll \
/usr/local/ffmpegstatic/bin 下面是未加--extra-ldflags="-static -static-libgcc -static-libstdc++"的情况:
$ ldd /usr/local/ffmpegstatic/bin/ffmpeg.exe | grep -v /c/WINDOWS | sort
libbz2-1.dll => /usr/local/ffmpegstatic/bin/libbz2-1.dll (0x626c0000)
LIBEAY32.dll => /usr/local/ffmpegstatic/bin/LIBEAY32.dll (0x63080000)
libiconv-2.dll => /usr/local/ffmpegstatic/bin/libiconv-2.dll (0x66000000)
liblzma-5.dll => /usr/local/ffmpegstatic/bin/liblzma-5.dll (0x63cc0000)
libwinpthread-1.dll => /usr/local/ffmpegstatic/bin/libwinpthread-1.dll (0x64940000)
SDL2.dll => /usr/local/ffmpegstatic/bin/SDL2.dll (0x6c740000)
zlib1.dll => /usr/local/ffmpegstatic/bin/zlib1.dll (0x62e80000)
然后在CMD里单独执行,如果没任何提示就失败了,用Dependency Walker检查,发现需要LIBSTDC++-6.DLL等库:
$ cp /mingw64/bin/libwinpthread-1.dll \
/mingw64/bin/libbz2-1.dll \
/mingw64/bin/libiconv-2.dll \
/mingw64/bin/LIBEAY32.dll \
/mingw64/bin/liblzma-5.dll \
/mingw64/bin/zlib1.dll \
/usr/local/fdk-aac/bin/libfdk-aac-1.dll \
/usr/local/sdl2/bin/sdl2.dll \
/mingw64/bin/libstdc++-6.dll \
/mingw64/bin/libgcc_s_seh-1.dll \
/usr/local/ffmpegstatic/bin
i868的情况:
//$ cp /mingw32/bin/libbz2-1.dll \
/mingw32/bin/libiconv-2.dll \
/mingw32/bin/liblzma-5.dll \
/mingw32/bin/zlib1.dll \
/usr/local/fdk-aac/bin/libfdk-aac-1.dll \
/usr/local/sdl2/bin/sdl2.dll \
/mingw32/bin/libstdc++-6.dll \
/mingw32/bin/libgcc_s_dw2-1.dll \
/mingw32/bin/libwinpthread-1.dll \
/mingw32/bin/libeay32.dll \
/usr/local/ffmpegstatic/bin ### centos ###
检查PKG配置
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/x265/lib/pkgconfig:/usr/local/x264/lib/pkgconfig:/usr/local/sdl2/lib/pkgconfig:/usr/local/fdk-aac/lib/pkgconfig:/usr/local/openssl/lib/pkgconfig" pkg-config --exists --print-errors x264 x265 sdl2 fdk-aac openssl
直接返回表示成功。如果失败,会返回错误提示。 $ cd ffmpeg3.4
// 静态库配置
// $ sudo rm -rf /usr/local/ffmpegstatic
// $ sudo make distclean
// $ sudo make clean
$ PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/x265/lib/pkgconfig:/usr/local/x264/lib/pkgconfig:/usr/local/sdl2/lib/pkgconfig:/usr/local/fdk-aac/lib/pkgconfig:/usr/local/openssl/lib/pkgconfig" ./configure \
--prefix=/usr/local/ffmpegstatic --enable-static --disable-shared \
--pkg-config-flags="--static" --extra-ldflags="-static -static-libgcc -static-libstdc++" \
--enable-gpl --enable-small --disable-doc --enable-nonfree \
--enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-openssl \
--enable-pic --disable-debug
$ sudo make -j8
$ sudo make install
// 测试
$ /usr/local/ffmpegstatic/bin/ffmpeg -version
ffmpeg version e40fcb1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-16)
configuration: ...
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100 -----------------------------------------------------------
MSVC方式:(未包含外部库x264、sdl2、x265、fdk-aac等)
动态
$ ./configure --toolchain=msvc --arch=x86 --enable-shared --disable-static
静态
$ ./configure --toolchain=msvc --arch=x86 --enable-yasm --enable-asm --enable-static
等待配置完成,日志查看ffbuild/config.log
MAKE前,如果是中文版VS提示符,请打开config.h文件,将文件字符编码更改为UTF-8,检查其中的开关,比如CONFIG_FFPLAY是否被设置等。
$ make
如果make有警告C4828,检查提示文件(如config.h)的代码页,更改为UTF-8,
其他警告可忽略
$ make install
编译生产的执行文件ffmpeg.exe和DLL文件在目录C:\msys64\usr\local\bin中,开发头文件在C:\msys64\usr\local\include中
msvc(不支持openssl)
用msvc工具链编译ffmpeg 准备工作参考ffmepg.txt,下面是具体步骤: 1. 先将需要编译的文件放到一个英文目录下,比如E:\ffmpeg
2. 打开用 VS 的 VC 命令提示符
x86: x86 Native Tools Command Prompt for VS 2017 适用于 VS 2017 的 x86 本机工具命令提示
x64: x64 Native Tools Command Prompt for VS 2017 适用于 VS 2017 的 x64 本机工具命令提示
3. 进入目录,然后启动mingw64
C:\> cd /d E:\ffmpeg
E:\> c:\msys64\msys2_shell.cmd -mingw32 -here -full-path // x86 本机工具命令提示
E:\> c:\msys64\msys2_shell.cmd -mingw64 -here -full-path // x64 本机工具命令提示
4. 分别编译x264、SDL2、x265、fdk-aac、openssl和ffmpeg
4.1 编译x264
$ cd x264
$ CC=cl ./configure --prefix=/usr/local/msvc/x264 --enable-static --enable-shared --enable-strip --enable-pic
$ make
$ make install
4.2 编译SDL2
用VS打开E:\ffmpeg\SDL2-2.0.8\VisualC\SDL.sln,如果没有安装Visual Studio 2010 (Platform Toolset = 'v100'),选择不要升级。
VS打开解决方案后,只要分别对SDL (Visual Studio 2010)项目和SDL2main (Visual Studio 2010)项目编译即可。
对于需要升级的情况,先选择编译方案Release|Win32或者Release|x64,然后分别右键SDL和SDL2main项目,属性,
修改“平台工具集”为靠近VS2010的版本,直接选择VS2017也是可以编译的;下面的配置类型(dll或者lib)是不需要修改的。 $ mkdir -p /usr/local/msvc/sdl2/lib
$ cp /e/ffmpeg/SDL2-2.0.8/VisualC/Win32/Release/* /usr/local/msvc/sdl2/lib //拷贝32位版本
$ cp /e/ffmpeg/SDL2-2.0.8/VisualC/x64/Release/* /usr/local/msvc/sdl2/lib //拷贝64位版本 $ mkdir /usr/local/msvc/sdl2/include
$ cp -r /e/ffmpeg/SDL2-2.0.8/include /usr/local/msvc/sdl2/ $ mkdir /usr/local/msvc/sdl2/lib/pkgconfig
$ cp /e/ffmpeg/SDL2-2.0.8/sdl2.pc.in /usr/local/msvc/sdl2/lib/pkgconfig/sdl2.pc
$ vim /usr/local/msvc/sdl2/lib/pkgconfig/sdl2.pc
2dd 删除前面的行注释和空行
:%s/@prefix@/\/usr\/local\/msvc\/sdl2/g
:%s/@exec_prefix@/$\{prefix\}\/bin/g
:%s/@libdir@/$\{prefix\}\/lib/g
:%s/@includedir@/$\{prefix\}\/include/g
:%s/@SDL_VERSION@/2\.0\.8/g
:%s/@SDL_RLD_FLAGS@//g
:%s/@SDL_LIBS@/-lSDL2/g
:%s/@SDL_STATIC_LIBS@//g
:%s/@SDL_CFLAGS@//g
:%s/${includedir}\/SDL2/$\{includedir\}/g
$ cat /usr/local/msvc/sdl2/lib/pkgconfig/sdl2.pc
/---------------------------------------------\
prefix=/usr/local/msvc/sdl2
exec_prefix=${prefix}/bin
libdir=${prefix}/lib
includedir=${prefix}/include Name: sdl2
Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
Version: 2.0.8
Requires:
Conflicts:
Libs: -L${libdir} -lSDL2
Libs.private:
Cflags: -I${includedir} \---------------------------------------------/
4.3 编译x265
*** 编译32位版本 ***
打开 x86 Native Tools Command Prompt for VS 2017 适用于 VS 2017 的 x86 本机工具命令提示
C:\> cd /d E:\ffmpeg\x265_2.7\build\vc15-x86 // vc15 指 VS2017
E:\> set PATH=%PATH%;C:\msys64\mingw32\bin
E:\> make-solutions.bat // 由于 build-all.bat 中的 MSBuild 命令未指定 /p:Platform="Win32",因此将手动MSbuild编译
出现CMake配置窗口,编辑CMAKE_INSTALL_PREFIX为c:/msys64/usr/local/msvc/x265(请一定指定盘符),
勾选ENABLE_PIC
然后一次点击Configure和Generate按钮,关闭CMake窗口
E:\> MSBuild /p:Configuration="Release" /p:Platform="Win32" x265.sln
E:\> MSBuild /p:Configuration="Release" /p:Platform="Win32" INSTALL.vcxproj
*** 编译64位版本 ***
打开 x64 Native Tools Command Prompt for VS 2017
C:\> cd /d E:\ffmpeg\x265_2.7\build\vc15-x86_64
E:\> set PATH=%PATH%;C:\msys64\mingw64\bin
E:\> build-all.bat
出现CMake配置窗口,编辑CMAKE_INSTALL_PREFIX为c:/msys64/usr/local/msvc/x265(请一定指定盘符),
勾选ENABLE_PIC
然后一次点击Configure和Generate按钮,关闭CMake窗口
等待完成。
E:\> MSBuild /p:Configuration="Release" /p:Platform="x64" INSTALL.vcxproj
4.4 编译fdk-aac
*** 编译32位版本 ***
打开 x86 Native Tools Command Prompt for VS 2017
C:\> cd /d E:\ffmpeg\fdk-aac-0.1.6
E:\> nmake -f Makefile.vc
E:\> nmake -f Makefile.vc prefix=C:\msys64\usr\local\msvc\fdk-aac install
*** 编译64位版本 ***
打开 x64 Native Tools Command Prompt for VS 2017
C:\> cd /d E:\ffmpeg\fdk-aac-0.1.6
E:\> nmake -f Makefile.vc
E:\> nmake -f Makefile.vc prefix=C:\msys64\usr\local\msvc\fdk-aac install
制作fdk-aac.pc
E:\> mkdir C:\msys64\usr\local\msvc\fdk-aac\lib\pkgconfig
E:\> notepad C:\msys64\usr\local\msvc\fdk-aac\lib\pkgconfig\fdk-aac.pc
(UTF-8)
/-------------------------------------\
prefix=/usr/local/msvc/fdk-aac
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include Name: Fraunhofer FDK AAC Codec Library
Description: AAC codec library
Version: 0.1.6
Libs: -L${libdir} -lfdk-aac
Libs.private:
Cflags: -I${includedir} \-------------------------------------/
4.5 编译openssl (可忽略,暂未找到msvc方式编译ffmpeg带--enable-openssl成功的方法)
先安装perl:
http://www.activestate.com/ActivePerl
http://downloads.activestate.com/ActivePerl/releases/5.24.3.2404/ActivePerl-5.24.3.2404-MSWin32-x64-404865.exe
注:如果您的操作系统不是64位的,只能安装较旧的perl:http://downloads.activestate.com/ActivePerl/releases/5.22.4.2205/ActivePerl-5.22.4.2205-MSWin32-x86-64int-403863.exe
安装后会自动加入环境变量PATH,默认位置C:\Perl64\bin
*** 编译32位版本 ***
打开 x86 Native Tools Command Prompt for VS 2017
C:\> set PATH=%PATH%;C:\msys64\mingw32\bin
C:\> cd /d E:\ffmpeg\openssl-1.1.0g
E:\> perl Configure --prefix=C:\msys64\usr\local\msvc\openssl VC-WIN32 // 可选 VC-WIN32 | VC-WIN64A | VC-WIN64I | VC-CE
不必在意安装dmake提示(ppm install dmake),因为VS2017包含了nmake,它没检测出来而已。
E:\> nmake
E:\> nmake install
*** 编译64位版本 ***
打开 x64 Native Tools Command Prompt for VS 2017
C:\> set PATH=%PATH%;C:\msys64\mingw64\bin
C:\> cd /d E:\ffmpeg\openssl-1.1.0g
E:\> perl Configure --prefix=C:\msys64\usr\local\msvc\openssl VC-WIN64A
E:\> nmake
E:\> nmake install 创建pc文件(UTF-8):openssl.pc、libssl.pc、libcrypto.pc
E:\> mkdir C:\msys64\usr\local\msvc\openssl\lib\pkgconfig
E:\> notepad C:\msys64\usr\local\msvc\openssl\lib\pkgconfig\openssl.pc
/-------------------------------------\
prefix=/usr/local/msvc/openssl
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include Name: OpenSSL
Description: Secure Sockets Layer and cryptography libraries and tools
Version: 1.1.0g
Requires: libssl libcrypto \-------------------------------------/
E:\> notepad C:\msys64\usr\local\msvc\openssl\lib\pkgconfig\libssl.pc
/-------------------------------------\
prefix=/usr/local/msvc/openssl
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include Name: OpenSSL-libssl
Description: Secure Sockets Layer and cryptography libraries
Version: 1.1.0g
Requires.private: libcrypto
Libs: -L${libdir} -lssl
Libs.private: -lws2_32 -lgdi32 -lcrypt32
Cflags: -I${includedir} \-------------------------------------/
E:\> notepad C:\msys64\usr\local\msvc\openssl\lib\pkgconfig\libcrypto.pc
/-------------------------------------\
prefix=/usr/local/msvc/openssl
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
enginesdir=${libdir}/engines-1.1 Name: OpenSSL-libcrypto
Description: OpenSSL cryptography library
Version: 1.1.0g
Libs: -L${libdir} -lcrypto
Libs.private: -lws2_32 -lgdi32 -lcrypt32
Cflags: -I${includedir} \-------------------------------------/ 4.6 编译ffmpeg
*** 编译32位版本 ***
打开 x86 Native Tools Command Prompt for VS 2017
C:\> cd /d E:\ffmpeg\ffmpeg3.4
E:\> c:\msys64\msys2_shell.cmd -mingw32 -here -full-path
*** 编译64位版本 ***
打开 x64 Native Tools Command Prompt for VS 2017
C:\> cd /d E:\ffmpeg\ffmpeg3.4
E:\> c:\msys64\msys2_shell.cmd -mingw64 -here -full-path 然后执行: $ vim /usr/local/msvc/x264/lib/pkgconfig/x264.pc
将 Libs: -L${exec_prefix}/lib -lx264 更改
为 Libs: -L${exec_prefix}/lib -llibx264 $ vim /usr/local/msvc/x265/lib/pkgconfig/x265.pc
将 Libs: -L${libdir} -lx265 更改
为 Libs: -L${libdir} -llibx265 $ PKG_CONFIG_PATH="/usr/local/msvc/x265/lib/pkgconfig:/usr/local/msvc/x264/lib/pkgconfig:/usr/local/msvc/sdl2/lib/pkgconfig:/usr/local/msvc/fdk-aac/lib/pkgconfig:/usr/local/msvc/openssl/lib/pkgconfig" pkg-config --exists --print-errors x264 x265 sdl2 fdk-aac openssl *** 编译32位版本 ***
$ PKG_CONFIG_PATH="/usr/local/msvc/x265/lib/pkgconfig:/usr/local/msvc/x264/lib/pkgconfig:/usr/local/msvc/sdl2/lib/pkgconfig:/usr/local/msvc/fdk-aac/lib/pkgconfig:/usr/local/msvc/openssl/lib/pkgconfig" ./configure \
--toolchain=msvc --arch=x86 \
--prefix=/usr/local/msvc/ffmpegstatic --enable-static --disable-shared \
--pkg-config-flags="--static --msvc-syntax" \
--enable-gpl --enable-small --disable-doc --enable-nonfree \
--enable-libfdk-aac --enable-libx264 --enable-libx265 \
--enable-pic --disable-debug
注:--enable-openssl会失败,因此未加入。 *** 编译64位版本 ***
$ PKG_CONFIG_PATH="/usr/local/msvc/x265/lib/pkgconfig:/usr/local/msvc/x264/lib/pkgconfig:/usr/local/msvc/sdl2/lib/pkgconfig:/usr/local/msvc/fdk-aac/lib/pkgconfig:/usr/local/msvc/openssl/lib/pkgconfig" ./configure \
--toolchain=msvc --arch=amd64 \
--prefix=/usr/local/msvc/ffmpegstatic --enable-static --disable-shared \
--pkg-config-flags="--static --msvc-syntax" \
--enable-gpl --enable-small --disable-doc --enable-nonfree \
--enable-libfdk-aac --enable-libx264 --enable-libx265 \
--enable-pic --disable-debug
注:--enable-openssl会失败,因此未加入。 $ make -j8
$ make install
$ cp /usr/local/msvc/sdl2/lib/SDL2.dll /usr/local/msvc/ffmpegstatic/bin/
$ cp /usr/local/msvc/x265/lib/libx265.dll /usr/local/msvc/ffmpegstatic/bin/ 编译32位版本
$ cp /usr/local/msvc/x265/bin/libx265.dll /usr/local/msvc/ffmpegstatic/bin/ 编译64位版本
ffmpeg的centos、msys2、msvc编译的更多相关文章
- VS2015 MSVC编译FFMPEG
1.下载安装msys2 http://www.msys2.org/下载msys2 下载安装完成后,在msys2的shell中安装编译FFMPEG必要的命令行工具 pacman -S make gcc ...
- FFmpeg笔记:使用MSVC工具链编译Windows版本静态库、动态库
2019年3月开始,为了将音视频编解码功能集成到Cocos2d-x中,开始接触到FFmpeg: 当时开发环境还在Mac下,编译FFmpeg相比现在用Windows平台要方便的多: 最近,公司内部有个U ...
- FFmpeg在Linux下安装编译过程
转载请把头部出处链接和尾部二维码一起转载,本文出自:http://blog.csdn.net/hejjunlin/article/details/52402759 今天介绍下FFmpeg在Linux下 ...
- CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14
准备篇: CentOS 7.0系统安装配置图解教程 http://www.osyunwei.com/archives/7829.html 一.配置防火墙,开启80端口.3306端口 CentOS 7. ...
- centos 7.0 编译安装php 7.0.3
php下载页面 http://cn2.php.net/downloads.php 7.0.3多地区下载页面 http://cn2.php.net/get/php-7.0.3.tar.gz/from/a ...
- CentOS 6.6编译安装Nginx1.6.2+MySQL5.6.21+PHP5.6.3
http://www.osyunwei.com/archives/8867.html 一.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables #编辑防火墙配置 ...
- CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.13
CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.132013-10-24 15:31:12标签:服务器 防火墙 file 配置文件 written 一.配置好I ...
- CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.13+博客系统WordPress3.3.2
说明: 操作系统:CentOS 6.2 32位 系统安装教程:CentOS 6.2安装(超级详细图解教程): http://www.osyunwei.com/archives/1537.html 准备 ...
- CentOS 6.4编译安装淘宝web服务器Tengine
Tengine 是由淘宝核心系统部基于Nginx开发的Web服务器,它在Nginx的基础上,针对大访问量网站的需求,添加了很多功能和特性.Tengine的性能和稳定性已经在大型的网站如淘宝网,淘宝商城 ...
- CentOS 6.8编译安装httpd2.2.31+MySQL5.6.31+PHP5.3.27
CentOS 6.8编译安装httpd2.2.31+MySQL5.6.31+PHP5.3.27 说明: 操作系统:CentOS 6.8 32位 准备篇: 一.系统约定 软件源代码包存放位 ...
随机推荐
- WebService 综合案例
1. 需求: 集成公网手机号归属地查询服务; 对外发布自己的手机号归属地查询服务; 提供查询界面 //1. 使用 wsimport 生成公网客户端代码 // 2. 创建 SEI 接口 @WebServ ...
- Java 面向对象编程介绍
面向对象的概念 类与对象的关系 封装 面向对象 面向过程: 强调的是过程(动作) 面向对象: 强调的是对象(实体) 面向对象的特点 面向对象就是一种常见的思想,符合人们的思考习惯; 面向对象的出现,将 ...
- 打印出所有的"水仙花数"
题目:打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身.例如:153是一个"水仙花数",因为153=1 ...
- MySQL日期时间字段
mysql支持的日期时间类型有:DATETIME. TIMESTAMP.DATE.TIME.YEAR. 几种类型比较如下: DATETIME DATETIME 用于表示 年月日 时分秒,是 DATE和 ...
- MySQL数据库(4)- 多表查询、可视化工具Navicat的使用、设计模式MVC
一.多表查询 准备工作:创建两张表,部门表(department).员工表(employee),代码和表格如下: # 创建表 create table department( id int, name ...
- 000 初步使用Kotlin开发Android应用
Kotlin是Jetbrians公司开发的一款编程语言,基于jvm兼容Java. 要求 IDE:IDEA或者Android Studio(简称studio)对Kotlin语言有所了解,官方文档:htt ...
- iptables练习题(四)
设有一台Linux服务器,利用iptables作为防火墙,要求新建一条名为MYCHAIN的新链,来实现只允许开放本机的http服务,其余协议和端口均拒绝. 脚本: [root@miyan ~]# ca ...
- Swap 2 Variables in Python
In Python, it's concise, easy and faster to swap 2 variables compared in other Programming languages ...
- yii2查询数据倒序显示
public function selectall(){ return $this->findBySql("SELECT * FROM article order by art_tim ...
- Wannafly交流赛1_B_硬币【数学】
Wannafly交流赛1_B_硬币[数学] 链接:https://www.nowcoder.com/acm/contest/69/B 来源:牛客网 题目描述 蜥蜴的生日快到了,就在这个月底! 今年,蜥 ...