星火直播PC
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 4 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <title>FFmpeg documentation</title>
  7. <link rel="stylesheet" href="bootstrap.min.css" />
  8. <link rel="stylesheet" href="style.min.css" />
  9. <meta name="description" content="Platform Specific Information: ">
  10. <meta name="keywords" content="FFmpeg documentation : Platform Specific Information: ">
  11. <meta name="Generator" content="texi2html 5.0">
  12. <!-- Created on March 9, 2020 by texi2html 5.0 -->
  13. <!--
  14. texi2html was written by:
  15. Lionel Cons <Lionel.Cons@cern.ch> (original author)
  16. Karl Berry <karl@freefriends.org>
  17. Olaf Bachmann <obachman@mathematik.uni-kl.de>
  18. and many others.
  19. Maintained by: Many creative people.
  20. Send bugs and suggestions to <texi2html-bug@nongnu.org>
  21. -->
  22. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  23. </head>
  24. <body>
  25. <div class="container">
  26. <h1 class="titlefont">Platform Specific Information</h1>
  27. <hr>
  28. <a name="SEC_Top"></a>
  29. <a name="SEC_Contents"></a>
  30. <h1>Table of Contents</h1>
  31. <div class="contents">
  32. <ul class="no-bullet">
  33. <li><a name="toc-Unix_002dlike" href="#Unix_002dlike">1 Unix-like</a>
  34. <ul class="no-bullet">
  35. <li><a name="toc-Advanced-linking-configuration" href="#Advanced-linking-configuration">1.1 Advanced linking configuration</a></li>
  36. <li><a name="toc-BSD" href="#BSD">1.2 BSD</a></li>
  37. <li><a name="toc-_0028Open_0029Solaris" href="#g_t_0028Open_0029Solaris">1.3 (Open)Solaris</a></li>
  38. <li><a name="toc-Darwin-_0028Mac-OS-X_002c-iPhone_0029" href="#Darwin-_0028Mac-OS-X_002c-iPhone_0029">1.4 Darwin (Mac OS X, iPhone)</a></li>
  39. </ul></li>
  40. <li><a name="toc-DOS" href="#DOS">2 DOS</a></li>
  41. <li><a name="toc-OS_002f2" href="#OS_002f2">3 OS/2</a></li>
  42. <li><a name="toc-Windows" href="#Windows">4 Windows</a>
  43. <ul class="no-bullet">
  44. <li><a name="toc-Native-Windows-compilation-using-MinGW-or-MinGW_002dw64" href="#Native-Windows-compilation-using-MinGW-or-MinGW_002dw64">4.1 Native Windows compilation using MinGW or MinGW-w64</a>
  45. <ul class="no-bullet">
  46. <li><a name="toc-Native-Windows-compilation-using-MSYS2" href="#Native-Windows-compilation-using-MSYS2">4.1.1 Native Windows compilation using MSYS2</a></li>
  47. </ul></li>
  48. <li><a name="toc-Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows" href="#Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows">4.2 Microsoft Visual C++ or Intel C++ Compiler for Windows</a>
  49. <ul class="no-bullet">
  50. <li><a name="toc-Linking-to-FFmpeg-with-Microsoft-Visual-C_002b_002b" href="#Linking-to-FFmpeg-with-Microsoft-Visual-C_002b_002b">4.2.1 Linking to FFmpeg with Microsoft Visual C++</a></li>
  51. </ul></li>
  52. <li><a name="toc-Cross-compilation-for-Windows-with-Linux-1" href="#Cross-compilation-for-Windows-with-Linux-1">4.3 Cross compilation for Windows with Linux</a></li>
  53. <li><a name="toc-Compilation-under-Cygwin" href="#Compilation-under-Cygwin">4.4 Compilation under Cygwin</a></li>
  54. <li><a name="toc-Crosscompilation-for-Windows-under-Cygwin" href="#Crosscompilation-for-Windows-under-Cygwin">4.5 Crosscompilation for Windows under Cygwin</a></li>
  55. </ul>
  56. </li>
  57. </ul>
  58. </div>
  59. <hr size="6">
  60. <a name="Unix_002dlike"></a>
  61. <h1 class="chapter"><a href="platform.html#toc-Unix_002dlike">1 Unix-like</a></h1>
  62. <p>Some parts of FFmpeg cannot be built with version 2.15 of the GNU
  63. assembler which is still provided by a few AMD64 distributions. To
  64. make sure your compiler really uses the required version of gas
  65. after a binutils upgrade, run:
  66. </p>
  67. <div class="example">
  68. <pre class="example">$(gcc -print-prog-name=as) --version
  69. </pre></div>
  70. <p>If not, then you should install a different compiler that has no
  71. hard-coded path to gas. In the worst case pass <code>--disable-asm</code>
  72. to configure.
  73. </p>
  74. <a name="Advanced-linking-configuration"></a>
  75. <h2 class="section"><a href="platform.html#toc-Advanced-linking-configuration">1.1 Advanced linking configuration</a></h2>
  76. <p>If you compiled FFmpeg libraries statically and you want to use them to
  77. build your own shared library, you may need to force PIC support (with
  78. <code>--enable-pic</code> during FFmpeg configure) and add the following option
  79. to your project LDFLAGS:
  80. </p>
  81. <div class="example">
  82. <pre class="example">-Wl,-Bsymbolic
  83. </pre></div>
  84. <p>If your target platform requires position independent binaries, you should
  85. pass the correct linking flag (e.g. <code>-pie</code>) to <code>--extra-ldexeflags</code>.
  86. </p>
  87. <a name="BSD"></a>
  88. <h2 class="section"><a href="platform.html#toc-BSD">1.2 BSD</a></h2>
  89. <p>BSD make will not build FFmpeg, you need to install and use GNU Make
  90. (<code>gmake</code>).
  91. </p>
  92. <a name="g_t_0028Open_0029Solaris"></a>
  93. <h2 class="section"><a href="platform.html#toc-_0028Open_0029Solaris">1.3 (Open)Solaris</a></h2>
  94. <p>GNU Make is required to build FFmpeg, so you have to invoke (<code>gmake</code>),
  95. standard Solaris Make will not work. When building with a non-c99 front-end
  96. (gcc, generic suncc) add either <code>--extra-libs=/usr/lib/values-xpg6.o</code>
  97. or <code>--extra-libs=/usr/lib/64/values-xpg6.o</code> to the configure options
  98. since the libc is not c99-compliant by default. The probes performed by
  99. configure may raise an exception leading to the death of configure itself
  100. due to a bug in the system shell. Simply invoke a different shell such as
  101. bash directly to work around this:
  102. </p>
  103. <div class="example">
  104. <pre class="example">bash ./configure
  105. </pre></div>
  106. <p><a name="Darwin"></a>
  107. </p><a name="Darwin-_0028Mac-OS-X_002c-iPhone_0029"></a>
  108. <h2 class="section"><a href="platform.html#toc-Darwin-_0028Mac-OS-X_002c-iPhone_0029">1.4 Darwin (Mac OS X, iPhone)</a></h2>
  109. <p>The toolchain provided with Xcode is sufficient to build the basic
  110. unaccelerated code.
  111. </p>
  112. <p>Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from
  113. <a href="https://github.com/FFmpeg/gas-preprocessor">https://github.com/FFmpeg/gas-preprocessor</a> or
  114. <a href="https://github.com/yuvi/gas-preprocessor">https://github.com/yuvi/gas-preprocessor</a>(currently outdated) to build the optimized
  115. assembly functions. Put the Perl script somewhere
  116. in your PATH, FFmpeg&rsquo;s configure will pick it up automatically.
  117. </p>
  118. <p>Mac OS X on amd64 and x86 requires <code>nasm</code> to build most of the
  119. optimized assembly functions. <a href="http://www.finkproject.org/">Fink</a>,
  120. <a href="https://wiki.gentoo.org/wiki/Project:Prefix">Gentoo Prefix</a>,
  121. <a href="https://mxcl.github.com/homebrew/">Homebrew</a>
  122. or <a href="http://www.macports.org">MacPorts</a> can easily provide it.
  123. </p>
  124. <a name="DOS"></a>
  125. <h1 class="chapter"><a href="platform.html#toc-DOS">2 DOS</a></h1>
  126. <p>Using a cross-compiler is preferred for various reasons.
  127. <a href="http://www.delorie.com/howto/djgpp/linux-x-djgpp.html">http://www.delorie.com/howto/djgpp/linux-x-djgpp.html</a>
  128. </p>
  129. <a name="OS_002f2"></a>
  130. <h1 class="chapter"><a href="platform.html#toc-OS_002f2">3 OS/2</a></h1>
  131. <p>For information about compiling FFmpeg on OS/2 see
  132. <a href="http://www.edm2.com/index.php/FFmpeg">http://www.edm2.com/index.php/FFmpeg</a>.
  133. </p>
  134. <a name="Windows"></a>
  135. <h1 class="chapter"><a href="platform.html#toc-Windows">4 Windows</a></h1>
  136. <p>To get help and instructions for building FFmpeg under Windows, check out
  137. the FFmpeg Windows Help Forum at <a href="http://ffmpeg.zeranoe.com/forum/">http://ffmpeg.zeranoe.com/forum/</a>.
  138. </p>
  139. <a name="Native-Windows-compilation-using-MinGW-or-MinGW_002dw64"></a>
  140. <h2 class="section"><a href="platform.html#toc-Native-Windows-compilation-using-MinGW-or-MinGW_002dw64">4.1 Native Windows compilation using MinGW or MinGW-w64</a></h2>
  141. <p>FFmpeg can be built to run natively on Windows using the MinGW-w64
  142. toolchain. Install the latest versions of MSYS2 and MinGW-w64 from
  143. <a href="http://msys2.github.io/">http://msys2.github.io/</a> and/or <a href="http://mingw-w64.sourceforge.net/">http://mingw-w64.sourceforge.net/</a>.
  144. You can find detailed installation instructions in the download section and
  145. the FAQ.
  146. </p>
  147. <p>Notes:
  148. </p>
  149. <ul>
  150. <li> Building for the MSYS environment is discouraged, MSYS2 provides a full
  151. MinGW-w64 environment through &lsquo;<tt>mingw64_shell.bat</tt>&rsquo; or
  152. &lsquo;<tt>mingw32_shell.bat</tt>&rsquo; that should be used instead of the environment
  153. provided by &lsquo;<tt>msys2_shell.bat</tt>&rsquo;.
  154. </li><li> Building using MSYS2 can be sped up by disabling implicit rules in the
  155. Makefile by calling <code>make -r</code> instead of plain <code>make</code>. This
  156. speed up is close to non-existent for normal one-off builds and is only
  157. noticeable when running make for a second time (for example during
  158. <code>make install</code>).
  159. </li><li> In order to compile FFplay, you must have the MinGW development library
  160. of <a href="http://www.libsdl.org/">SDL</a> and <code>pkg-config</code> installed.
  161. </li><li> By using <code>./configure --enable-shared</code> when configuring FFmpeg,
  162. you can build the FFmpeg libraries (e.g. libavutil, libavcodec,
  163. libavformat) as DLLs.
  164. </li></ul>
  165. <a name="Native-Windows-compilation-using-MSYS2"></a>
  166. <h3 class="subsection"><a href="platform.html#toc-Native-Windows-compilation-using-MSYS2">4.1.1 Native Windows compilation using MSYS2</a></h3>
  167. <p>The MSYS2 MinGW-w64 environment provides ready to use toolchains and dependencies
  168. through <code>pacman</code>.
  169. </p>
  170. <p>Make sure to use &lsquo;<tt>mingw64_shell.bat</tt>&rsquo; or &lsquo;<tt>mingw32_shell.bat</tt>&rsquo; to have
  171. the correct MinGW-w64 environment. The default install provides shortcuts to
  172. them under <code>MinGW-w64 Win64 Shell</code> and <code>MinGW-w64 Win32 Shell</code>.
  173. </p>
  174. <div class="example">
  175. <pre class="example"># normal msys2 packages
  176. pacman -S make pkgconf diffutils
  177. # mingw-w64 packages and toolchains
  178. pacman -S mingw-w64-x86_64-nasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2
  179. </pre></div>
  180. <p>To target 32 bits replace <code>x86_64</code> with <code>i686</code> in the command above.
  181. </p>
  182. <a name="Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows"></a>
  183. <h2 class="section"><a href="platform.html#toc-Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows">4.2 Microsoft Visual C++ or Intel C++ Compiler for Windows</a></h2>
  184. <p>FFmpeg can be built with MSVC 2013 or later.
  185. </p>
  186. <p>You will need the following prerequisites:
  187. </p>
  188. <ul>
  189. <li> <a href="http://msys2.github.io/">MSYS2</a>
  190. </li><li> <a href="http://www.nasm.us/">NASM</a>
  191. (Also available via MSYS2&rsquo;s package manager.)
  192. </li></ul>
  193. <p>To set up a proper environment in MSYS2, you need to run <code>msys_shell.bat</code> from
  194. the Visual Studio or Intel Compiler command prompt.
  195. </p>
  196. <p>Place <code>yasm.exe</code> somewhere in your <code>PATH</code>.
  197. </p>
  198. <p>Next, make sure any other headers and libs you want to use, such as zlib, are
  199. located in a spot that the compiler can see. Do so by modifying the <code>LIB</code>
  200. and <code>INCLUDE</code> environment variables to include the <strong>Windows-style</strong>
  201. paths to these directories. Alternatively, you can try to use the
  202. <code>--extra-cflags</code>/<code>--extra-ldflags</code> configure options.
  203. </p>
  204. <p>Finally, run:
  205. </p>
  206. <div class="example">
  207. <pre class="example">For MSVC:
  208. ./configure --toolchain=msvc
  209. For ICL:
  210. ./configure --toolchain=icl
  211. make
  212. make install
  213. </pre></div>
  214. <p>If you wish to compile shared libraries, add <code>--enable-shared</code> to your
  215. configure options. Note that due to the way MSVC and ICL handle DLL imports and
  216. exports, you cannot compile static and shared libraries at the same time, and
  217. enabling shared libraries will automatically disable the static ones.
  218. </p>
  219. <p>Notes:
  220. </p>
  221. <ul>
  222. <li> If you wish to build with zlib support, you will have to grab a compatible
  223. zlib binary from somewhere, with an MSVC import lib, or if you wish to link
  224. statically, you can follow the instructions below to build a compatible
  225. <code>zlib.lib</code> with MSVC. Regardless of which method you use, you must still
  226. follow step 3, or compilation will fail.
  227. <ol>
  228. <li> Grab the <a href="http://zlib.net/">zlib sources</a>.
  229. </li><li> Edit <code>win32/Makefile.msc</code> so that it uses -MT instead of -MD, since
  230. this is how FFmpeg is built as well.
  231. </li><li> Edit <code>zconf.h</code> and remove its inclusion of <code>unistd.h</code>. This gets
  232. erroneously included when building FFmpeg.
  233. </li><li> Run <code>nmake -f win32/Makefile.msc</code>.
  234. </li><li> Move <code>zlib.lib</code>, <code>zconf.h</code>, and <code>zlib.h</code> to somewhere MSVC
  235. can see.
  236. </li></ol>
  237. </li><li> FFmpeg has been tested with the following on i686 and x86_64:
  238. <ul>
  239. <li> Visual Studio 2013 Pro and Express
  240. </li><li> Intel Composer XE 2013
  241. </li><li> Intel Composer XE 2013 SP1
  242. </li></ul>
  243. <p>Anything else is not officially supported.
  244. </p>
  245. </li></ul>
  246. <a name="Linking-to-FFmpeg-with-Microsoft-Visual-C_002b_002b"></a>
  247. <h3 class="subsection"><a href="platform.html#toc-Linking-to-FFmpeg-with-Microsoft-Visual-C_002b_002b">4.2.1 Linking to FFmpeg with Microsoft Visual C++</a></h3>
  248. <p>If you plan to link with MSVC-built static libraries, you will need
  249. to make sure you have <code>Runtime Library</code> set to
  250. <code>Multi-threaded (/MT)</code> in your project&rsquo;s settings.
  251. </p>
  252. <p>You will need to define <code>inline</code> to something MSVC understands:
  253. </p><div class="example">
  254. <pre class="example">#define inline __inline
  255. </pre></div>
  256. <p>Also note, that as stated in <strong>Microsoft Visual C++</strong>, you will need
  257. an MSVC-compatible <a href="http://code.google.com/p/msinttypes/">inttypes.h</a>.
  258. </p>
  259. <p>If you plan on using import libraries created by dlltool, you must
  260. set <code>References</code> to <code>No (/OPT:NOREF)</code> under the linker optimization
  261. settings, otherwise the resulting binaries will fail during runtime.
  262. This is not required when using import libraries generated by <code>lib.exe</code>.
  263. This issue is reported upstream at
  264. <a href="http://sourceware.org/bugzilla/show_bug.cgi?id=12633">http://sourceware.org/bugzilla/show_bug.cgi?id=12633</a>.
  265. </p>
  266. <p>To create import libraries that work with the <code>/OPT:REF</code> option
  267. (which is enabled by default in Release mode), follow these steps:
  268. </p>
  269. <ol>
  270. <li> Open the <em>Visual Studio Command Prompt</em>.
  271. <p>Alternatively, in a normal command line prompt, call &lsquo;<tt>vcvars32.bat</tt>&rsquo;
  272. which sets up the environment variables for the Visual C++ tools
  273. (the standard location for this file is something like
  274. &lsquo;<tt>C:\Program Files (x86_\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat</tt>&rsquo;).
  275. </p>
  276. </li><li> Enter the &lsquo;<tt>bin</tt>&rsquo; directory where the created LIB and DLL files
  277. are stored.
  278. </li><li> Generate new import libraries with <code>lib.exe</code>:
  279. <div class="example">
  280. <pre class="example">lib /machine:i386 /def:..\lib\foo-version.def /out:foo.lib
  281. </pre></div>
  282. <p>Replace <code>foo-version</code> and <code>foo</code> with the respective library names.
  283. </p>
  284. </li></ol>
  285. <p><a name="Cross-compilation-for-Windows-with-Linux"></a>
  286. </p><a name="Cross-compilation-for-Windows-with-Linux-1"></a>
  287. <h2 class="section"><a href="platform.html#toc-Cross-compilation-for-Windows-with-Linux-1">4.3 Cross compilation for Windows with Linux</a></h2>
  288. <p>You must use the MinGW cross compilation tools available at
  289. <a href="http://www.mingw.org/">http://www.mingw.org/</a>.
  290. </p>
  291. <p>Then configure FFmpeg with the following options:
  292. </p><div class="example">
  293. <pre class="example">./configure --target-os=mingw32 --cross-prefix=i386-mingw32msvc-
  294. </pre></div>
  295. <p>(you can change the cross-prefix according to the prefix chosen for the
  296. MinGW tools).
  297. </p>
  298. <p>Then you can easily test FFmpeg with <a href="http://www.winehq.com/">Wine</a>.
  299. </p>
  300. <a name="Compilation-under-Cygwin"></a>
  301. <h2 class="section"><a href="platform.html#toc-Compilation-under-Cygwin">4.4 Compilation under Cygwin</a></h2>
  302. <p>Please use Cygwin 1.7.x as the obsolete 1.5.x Cygwin versions lack
  303. llrint() in its C library.
  304. </p>
  305. <p>Install your Cygwin with all the &quot;Base&quot; packages, plus the
  306. following &quot;Devel&quot; ones:
  307. </p><div class="example">
  308. <pre class="example">binutils, gcc4-core, make, git, mingw-runtime, texinfo
  309. </pre></div>
  310. <p>In order to run FATE you will also need the following &quot;Utils&quot; packages:
  311. </p><div class="example">
  312. <pre class="example">diffutils
  313. </pre></div>
  314. <p>If you want to build FFmpeg with additional libraries, download Cygwin
  315. &quot;Devel&quot; packages for Ogg and Vorbis from any Cygwin packages repository:
  316. </p><div class="example">
  317. <pre class="example">libogg-devel, libvorbis-devel
  318. </pre></div>
  319. <p>These library packages are only available from
  320. <a href="http://sourceware.org/cygwinports/">Cygwin Ports</a>:
  321. </p>
  322. <div class="example">
  323. <pre class="example">yasm, libSDL-devel, libgsm-devel, libmp3lame-devel,
  324. speex-devel, libtheora-devel, libxvidcore-devel
  325. </pre></div>
  326. <p>The recommendation for x264 is to build it from source, as it evolves too
  327. quickly for Cygwin Ports to be up to date.
  328. </p>
  329. <a name="Crosscompilation-for-Windows-under-Cygwin"></a>
  330. <h2 class="section"><a href="platform.html#toc-Crosscompilation-for-Windows-under-Cygwin">4.5 Crosscompilation for Windows under Cygwin</a></h2>
  331. <p>With Cygwin you can create Windows binaries that do not need the cygwin1.dll.
  332. </p>
  333. <p>Just install your Cygwin as explained before, plus these additional
  334. &quot;Devel&quot; packages:
  335. </p><div class="example">
  336. <pre class="example">gcc-mingw-core, mingw-runtime, mingw-zlib
  337. </pre></div>
  338. <p>and add some special flags to your configure invocation.
  339. </p>
  340. <p>For a static build run
  341. </p><div class="example">
  342. <pre class="example">./configure --target-os=mingw32 --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
  343. </pre></div>
  344. <p>and for a build with shared libraries
  345. </p><div class="example">
  346. <pre class="example">./configure --target-os=mingw32 --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
  347. </pre></div>
  348. </div>
  349. </body>
  350. </html>