ffmpeg交叉编译
2016-08-04 10:13
197 查看
Intro
Basically, cross compiling FFmpeg for windows means that you use a special version of the gcc compiler (and related tools) that output a working windows executable when they're done. You can copy it to your windows box and then use it (or use wine to run itunder linux, but that kind of defeats the point).
This is sometimes easier than using a "native" compilation in windows because some dependencies' configure scripts accept a cross compiler more readily than a native windows mingw gcc, etc. It also may be "faster" than using mingw's gcc in windows, for whatever
reason gcc seems faster in linux.
Most cross compilation are done under Linux, but it is possible to us OS X as a host machine.
Automated cross compiling environment
Some building environments aim to automatically build the cross compilers and dependencies of FFmpeg. By using these projects you can eliminate the mess of building toolchains yourself. These projects include MXE and Win-builds.MXE is more feature-complete as of Dec 2013, as
it has more dependencies for FFmpeg (x264, xvid, etc.)
it has a ffmpeg package (by default it is libraries-only, but users are able to generate the programs to by simply deleting one line in the building recipe)
it supports OS X as a host machine
it supports MinGW in addition to mingw-w64.
Win-builds as the official package manager for mingw-w64, is really new, and it does not have as many multimedia packages as MXE.
Cross Compiler
Zeranoe has a script forcompiling your own windows cross compiler, then you can use it to compile
ffmpeg and its libs. NB that it can be a little tricky, you could try using this
scriptwhich attempts to automated building the cross compiler and gcc.
Another option is that some linux distros have packages like mingw-w64-dev or gcc-mingw-w64-i686 which might also get a working local cross compiler system. Basically, they'll add x86_64-w64-mingw32-gcc to a directory or to the PATH somehow. And you're ready
to go.
Compile dependencies
Next cross compile any added dependencies you may want, for instead libx264.The script "cross_compile_ffmpeg.sh" in this
repository lists many dependencies.
Compile FFmpeg
Now basically configure and compile FFmpeg like$ ./configure --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --pkg-config=pkg-config $ make
and other options if you want them, like --enable-libx264, etc.
This should eventually create the file ffmpeg_g.exe (ffmpeg.exe with debug symbols) and ffmpeg.exe (ffmpeg.exe "stripped" of its debug symbols). If you cross compile SDL before hand, it will also include ffplay.exe
Resources
Thisrepository has a script that compiles the cross compiler locally
You can ask questions on the Zeranoe
Forum.
https://trac.ffmpeg.org/wiki/CompilationGuide/CrossCompilingForWindows
相关文章推荐
- ubuntu下NDK9交叉编译ffmpeg
- Opencv+ffmpeg 交叉编译
- 基于Ubuntu交叉编译FFmpeg Windows SDK
- 基于Ubuntu交叉编译FFmpeg Windows SDK
- linux下交叉编译ffmpeg,并加入H264编码支持
- 交叉编译opencv时候ffmpeg选项始终为no的解决方法
- 基于海思平台交叉编译opencv+ffmpeg但是ffmpeg始终为NO
- ffmpeg、jrtp、SDL的交叉编译
- ubuntu下交叉编译ffmpeg+libaacplus
- linux下交叉编译ffmpeg,并加入H264编码支持
- 流媒体直播之四ffmpeg在ARM板下的交叉编译
- 交叉编译 motion ,使其支持 ffmpeg
- Ubuntu14.04 交叉编译 Android 可用的 ffmpeg3.4.1
- ffmpeg交叉编译指南
- 基于Ubuntu交叉编译FFmpeg Windows SDK
- 基于Ubuntu交叉编译FFmpeg Windows SDK
- h264 ffmpeg 400 交叉编译
- ffmpeg-0.5交叉编译
- ubuntu14.04交叉编译ffmpeg出现unable to create an executable file. C compiler test failed.
- FFMPEG研究: 基于Ubuntu交叉编译FFmpeg Windows SDK