faq.html 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>FFmpeg FAQ</title>
  7. <meta name="description" content="FFmpeg FAQ">
  8. <meta name="keywords" content="FFmpeg FAQ">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <meta name="viewport" content="width=device-width,initial-scale=1">
  13. <link href="#SEC_Contents" rel="contents" title="Table of Contents">
  14. <style type="text/css">
  15. <!--
  16. a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em}
  17. a.summary-letter {text-decoration: none}
  18. blockquote.indentedblock {margin-right: 0em}
  19. div.display {margin-left: 3.2em}
  20. div.example {margin-left: 3.2em}
  21. kbd {font-style: oblique}
  22. pre.display {font-family: inherit}
  23. pre.format {font-family: inherit}
  24. pre.menu-comment {font-family: serif}
  25. pre.menu-preformatted {font-family: serif}
  26. span.nolinebreak {white-space: nowrap}
  27. span.roman {font-family: initial; font-weight: normal}
  28. span.sansserif {font-family: sans-serif; font-weight: normal}
  29. span:hover a.copiable-anchor {visibility: visible}
  30. ul.no-bullet {list-style: none}
  31. -->
  32. </style>
  33. </head>
  34. <body lang="en">
  35. <h1 class="settitle" align="center">FFmpeg FAQ</h1>
  36. <a name="SEC_Top"></a>
  37. <a name="General-Questions"></a>
  38. <h2 class="chapter">1 General Questions<span class="pull-right"><a class="anchor hidden-xs" href="#General-Questions" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-General-Questions" aria-hidden="true">TOC</a></span></h2>
  39. <a name="Why-doesn_0027t-FFmpeg-support-feature-_005bxyz_005d_003f"></a>
  40. <h3 class="section">1.1 Why doesn&rsquo;t FFmpeg support feature [xyz]?<span class="pull-right"><a class="anchor hidden-xs" href="#Why-doesn_0027t-FFmpeg-support-feature-_005bxyz_005d_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Why-doesn_0027t-FFmpeg-support-feature-_005bxyz_005d_003f" aria-hidden="true">TOC</a></span></h3>
  41. <p>Because no one has taken on that task yet. FFmpeg development is
  42. driven by the tasks that are important to the individual developers.
  43. If there is a feature that is important to you, the best way to get
  44. it implemented is to undertake the task yourself or sponsor a developer.
  45. </p>
  46. <a name="FFmpeg-does-not-support-codec-XXX_002e-Can-you-include-a-Windows-DLL-loader-to-support-it_003f"></a>
  47. <h3 class="section">1.2 FFmpeg does not support codec XXX. Can you include a Windows DLL loader to support it?<span class="pull-right"><a class="anchor hidden-xs" href="#FFmpeg-does-not-support-codec-XXX_002e-Can-you-include-a-Windows-DLL-loader-to-support-it_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-FFmpeg-does-not-support-codec-XXX_002e-Can-you-include-a-Windows-DLL-loader-to-support-it_003f" aria-hidden="true">TOC</a></span></h3>
  48. <p>No. Windows DLLs are not portable, bloated and often slow.
  49. Moreover FFmpeg strives to support all codecs natively.
  50. A DLL loader is not conducive to that goal.
  51. </p>
  52. <a name="I-cannot-read-this-file-although-this-format-seems-to-be-supported-by-ffmpeg_002e"></a>
  53. <h3 class="section">1.3 I cannot read this file although this format seems to be supported by ffmpeg.<span class="pull-right"><a class="anchor hidden-xs" href="#I-cannot-read-this-file-although-this-format-seems-to-be-supported-by-ffmpeg_002e" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-I-cannot-read-this-file-although-this-format-seems-to-be-supported-by-ffmpeg_002e" aria-hidden="true">TOC</a></span></h3>
  54. <p>Even if ffmpeg can read the container format, it may not support all its
  55. codecs. Please consult the supported codec list in the ffmpeg
  56. documentation.
  57. </p>
  58. <a name="Which-codecs-are-supported-by-Windows_003f"></a>
  59. <h3 class="section">1.4 Which codecs are supported by Windows?<span class="pull-right"><a class="anchor hidden-xs" href="#Which-codecs-are-supported-by-Windows_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Which-codecs-are-supported-by-Windows_003f" aria-hidden="true">TOC</a></span></h3>
  60. <p>Windows does not support standard formats like MPEG very well, unless you
  61. install some additional codecs.
  62. </p>
  63. <p>The following list of video codecs should work on most Windows systems:
  64. </p><dl compact="compact">
  65. <dt><span><samp>msmpeg4v2</samp></span></dt>
  66. <dd><p>.avi/.asf
  67. </p></dd>
  68. <dt><span><samp>msmpeg4</samp></span></dt>
  69. <dd><p>.asf only
  70. </p></dd>
  71. <dt><span><samp>wmv1</samp></span></dt>
  72. <dd><p>.asf only
  73. </p></dd>
  74. <dt><span><samp>wmv2</samp></span></dt>
  75. <dd><p>.asf only
  76. </p></dd>
  77. <dt><span><samp>mpeg4</samp></span></dt>
  78. <dd><p>Only if you have some MPEG-4 codec like ffdshow or Xvid installed.
  79. </p></dd>
  80. <dt><span><samp>mpeg1video</samp></span></dt>
  81. <dd><p>.mpg only
  82. </p></dd>
  83. </dl>
  84. <p>Note, ASF files often have .wmv or .wma extensions in Windows. It should also
  85. be mentioned that Microsoft claims a patent on the ASF format, and may sue
  86. or threaten users who create ASF files with non-Microsoft software. It is
  87. strongly advised to avoid ASF where possible.
  88. </p>
  89. <p>The following list of audio codecs should work on most Windows systems:
  90. </p><dl compact="compact">
  91. <dt><span><samp>adpcm_ima_wav</samp></span></dt>
  92. <dt><span><samp>adpcm_ms</samp></span></dt>
  93. <dt><span><samp>pcm_s16le</samp></span></dt>
  94. <dd><p>always
  95. </p></dd>
  96. <dt><span><samp>libmp3lame</samp></span></dt>
  97. <dd><p>If some MP3 codec like LAME is installed.
  98. </p></dd>
  99. </dl>
  100. <a name="Compilation"></a>
  101. <h2 class="chapter">2 Compilation<span class="pull-right"><a class="anchor hidden-xs" href="#Compilation" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Compilation" aria-hidden="true">TOC</a></span></h2>
  102. <a name="error_003a-can_0027t-find-a-register-in-class-_0027GENERAL_005fREGS_0027-while-reloading-_0027asm_0027"></a>
  103. <h3 class="section">2.1 <code>error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'</code><span class="pull-right"><a class="anchor hidden-xs" href="#error_003a-can_0027t-find-a-register-in-class-_0027GENERAL_005fREGS_0027-while-reloading-_0027asm_0027" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-error_003a-can_0027t-find-a-register-in-class-_0027GENERAL_005fREGS_0027-while-reloading-_0027asm_0027" aria-hidden="true">TOC</a></span></h3>
  104. <p>This is a bug in gcc. Do not report it to us. Instead, please report it to
  105. the gcc developers. Note that we will not add workarounds for gcc bugs.
  106. </p>
  107. <p>Also note that (some of) the gcc developers believe this is not a bug or
  108. not a bug they should fix:
  109. <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203</a>.
  110. Then again, some of them do not know the difference between an undecidable
  111. problem and an NP-hard problem...
  112. </p>
  113. <a name="I-have-installed-this-library-with-my-distro_0027s-package-manager_002e-Why-does-configure-not-see-it_003f"></a>
  114. <h3 class="section">2.2 I have installed this library with my distro&rsquo;s package manager. Why does <code>configure</code> not see it?<span class="pull-right"><a class="anchor hidden-xs" href="#I-have-installed-this-library-with-my-distro_0027s-package-manager_002e-Why-does-configure-not-see-it_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-I-have-installed-this-library-with-my-distro_0027s-package-manager_002e-Why-does-configure-not-see-it_003f" aria-hidden="true">TOC</a></span></h3>
  115. <p>Distributions usually split libraries in several packages. The main package
  116. contains the files necessary to run programs using the library. The
  117. development package contains the files necessary to build programs using the
  118. library. Sometimes, docs and/or data are in a separate package too.
  119. </p>
  120. <p>To build FFmpeg, you need to install the development package. It is usually
  121. called <samp>libfoo-dev</samp> or <samp>libfoo-devel</samp>. You can remove it after the
  122. build is finished, but be sure to keep the main package.
  123. </p>
  124. <a name="How-do-I-make-pkg_002dconfig-find-my-libraries_003f"></a>
  125. <h3 class="section">2.3 How do I make <code>pkg-config</code> find my libraries?<span class="pull-right"><a class="anchor hidden-xs" href="#How-do-I-make-pkg_002dconfig-find-my-libraries_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-do-I-make-pkg_002dconfig-find-my-libraries_003f" aria-hidden="true">TOC</a></span></h3>
  126. <p>Somewhere along with your libraries, there is a <samp>.pc</samp> file (or several)
  127. in a <samp>pkgconfig</samp> directory. You need to set environment variables to
  128. point <code>pkg-config</code> to these files.
  129. </p>
  130. <p>If you need to <em>add</em> directories to <code>pkg-config</code>&rsquo;s search list
  131. (typical use case: library installed separately), add it to
  132. <code>$PKG_CONFIG_PATH</code>:
  133. </p>
  134. <div class="example">
  135. <pre class="example">export PKG_CONFIG_PATH=/opt/x264/lib/pkgconfig:/opt/opus/lib/pkgconfig
  136. </pre></div>
  137. <p>If you need to <em>replace</em> <code>pkg-config</code>&rsquo;s search list
  138. (typical use case: cross-compiling), set it in
  139. <code>$PKG_CONFIG_LIBDIR</code>:
  140. </p>
  141. <div class="example">
  142. <pre class="example">export PKG_CONFIG_LIBDIR=/home/me/cross/usr/lib/pkgconfig:/home/me/cross/usr/local/lib/pkgconfig
  143. </pre></div>
  144. <p>If you need to know the library&rsquo;s internal dependencies (typical use: static
  145. linking), add the <code>--static</code> option to <code>pkg-config</code>:
  146. </p>
  147. <div class="example">
  148. <pre class="example">./configure --pkg-config-flags=--static
  149. </pre></div>
  150. <a name="How-do-I-use-pkg_002dconfig-when-cross_002dcompiling_003f"></a>
  151. <h3 class="section">2.4 How do I use <code>pkg-config</code> when cross-compiling?<span class="pull-right"><a class="anchor hidden-xs" href="#How-do-I-use-pkg_002dconfig-when-cross_002dcompiling_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-do-I-use-pkg_002dconfig-when-cross_002dcompiling_003f" aria-hidden="true">TOC</a></span></h3>
  152. <p>The best way is to install <code>pkg-config</code> in your cross-compilation
  153. environment. It will automatically use the cross-compilation libraries.
  154. </p>
  155. <p>You can also use <code>pkg-config</code> from the host environment by
  156. specifying explicitly <code>--pkg-config=pkg-config</code> to <code>configure</code>.
  157. In that case, you must point <code>pkg-config</code> to the correct directories
  158. using the <code>PKG_CONFIG_LIBDIR</code>, as explained in the previous entry.
  159. </p>
  160. <p>As an intermediate solution, you can place in your cross-compilation
  161. environment a script that calls the host <code>pkg-config</code> with
  162. <code>PKG_CONFIG_LIBDIR</code> set. That script can look like that:
  163. </p>
  164. <div class="example">
  165. <pre class="example">#!/bin/sh
  166. PKG_CONFIG_LIBDIR=/path/to/cross/lib/pkgconfig
  167. export PKG_CONFIG_LIBDIR
  168. exec /usr/bin/pkg-config &quot;$@&quot;
  169. </pre></div>
  170. <a name="Usage"></a>
  171. <h2 class="chapter">3 Usage<span class="pull-right"><a class="anchor hidden-xs" href="#Usage" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Usage" aria-hidden="true">TOC</a></span></h2>
  172. <a name="ffmpeg-does-not-work_003b-what-is-wrong_003f"></a>
  173. <h3 class="section">3.1 ffmpeg does not work; what is wrong?<span class="pull-right"><a class="anchor hidden-xs" href="#ffmpeg-does-not-work_003b-what-is-wrong_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-ffmpeg-does-not-work_003b-what-is-wrong_003f" aria-hidden="true">TOC</a></span></h3>
  174. <p>Try a <code>make distclean</code> in the ffmpeg source directory before the build.
  175. If this does not help see
  176. (<a href="https://ffmpeg.org/bugreports.html">https://ffmpeg.org/bugreports.html</a>).
  177. </p>
  178. <a name="How-do-I-encode-single-pictures-into-movies_003f"></a>
  179. <h3 class="section">3.2 How do I encode single pictures into movies?<span class="pull-right"><a class="anchor hidden-xs" href="#How-do-I-encode-single-pictures-into-movies_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-do-I-encode-single-pictures-into-movies_003f" aria-hidden="true">TOC</a></span></h3>
  180. <p>First, rename your pictures to follow a numerical sequence.
  181. For example, img1.jpg, img2.jpg, img3.jpg,...
  182. Then you may run:
  183. </p>
  184. <div class="example">
  185. <pre class="example">ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg
  186. </pre></div>
  187. <p>Notice that &lsquo;<samp>%d</samp>&rsquo; is replaced by the image number.
  188. </p>
  189. <p><samp>img%03d.jpg</samp> means the sequence <samp>img001.jpg</samp>, <samp>img002.jpg</samp>, etc.
  190. </p>
  191. <p>Use the <samp>-start_number</samp> option to declare a starting number for
  192. the sequence. This is useful if your sequence does not start with
  193. <samp>img001.jpg</samp> but is still in a numerical order. The following
  194. example will start with <samp>img100.jpg</samp>:
  195. </p>
  196. <div class="example">
  197. <pre class="example">ffmpeg -f image2 -start_number 100 -i img%d.jpg /tmp/a.mpg
  198. </pre></div>
  199. <p>If you have large number of pictures to rename, you can use the
  200. following command to ease the burden. The command, using the bourne
  201. shell syntax, symbolically links all files in the current directory
  202. that match <code>*jpg</code> to the <samp>/tmp</samp> directory in the sequence of
  203. <samp>img001.jpg</samp>, <samp>img002.jpg</samp> and so on.
  204. </p>
  205. <div class="example">
  206. <pre class="example">x=1; for i in *jpg; do counter=$(printf %03d $x); ln -s &quot;$i&quot; /tmp/img&quot;$counter&quot;.jpg; x=$(($x+1)); done
  207. </pre></div>
  208. <p>If you want to sequence them by oldest modified first, substitute
  209. <code>$(ls -r -t *jpg)</code> in place of <code>*jpg</code>.
  210. </p>
  211. <p>Then run:
  212. </p>
  213. <div class="example">
  214. <pre class="example">ffmpeg -f image2 -i /tmp/img%03d.jpg /tmp/a.mpg
  215. </pre></div>
  216. <p>The same logic is used for any image format that ffmpeg reads.
  217. </p>
  218. <p>You can also use <code>cat</code> to pipe images to ffmpeg:
  219. </p>
  220. <div class="example">
  221. <pre class="example">cat *.jpg | ffmpeg -f image2pipe -c:v mjpeg -i - output.mpg
  222. </pre></div>
  223. <a name="How-do-I-encode-movie-to-single-pictures_003f"></a>
  224. <h3 class="section">3.3 How do I encode movie to single pictures?<span class="pull-right"><a class="anchor hidden-xs" href="#How-do-I-encode-movie-to-single-pictures_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-do-I-encode-movie-to-single-pictures_003f" aria-hidden="true">TOC</a></span></h3>
  225. <p>Use:
  226. </p>
  227. <div class="example">
  228. <pre class="example">ffmpeg -i movie.mpg movie%d.jpg
  229. </pre></div>
  230. <p>The <samp>movie.mpg</samp> used as input will be converted to
  231. <samp>movie1.jpg</samp>, <samp>movie2.jpg</samp>, etc...
  232. </p>
  233. <p>Instead of relying on file format self-recognition, you may also use
  234. </p><dl compact="compact">
  235. <dt><span><samp>-c:v ppm</samp></span></dt>
  236. <dt><span><samp>-c:v png</samp></span></dt>
  237. <dt><span><samp>-c:v mjpeg</samp></span></dt>
  238. </dl>
  239. <p>to force the encoding.
  240. </p>
  241. <p>Applying that to the previous example:
  242. </p><div class="example">
  243. <pre class="example">ffmpeg -i movie.mpg -f image2 -c:v mjpeg menu%d.jpg
  244. </pre></div>
  245. <p>Beware that there is no &quot;jpeg&quot; codec. Use &quot;mjpeg&quot; instead.
  246. </p>
  247. <a name="Why-do-I-see-a-slight-quality-degradation-with-multithreaded-MPEG_002a-encoding_003f"></a>
  248. <h3 class="section">3.4 Why do I see a slight quality degradation with multithreaded MPEG* encoding?<span class="pull-right"><a class="anchor hidden-xs" href="#Why-do-I-see-a-slight-quality-degradation-with-multithreaded-MPEG_002a-encoding_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Why-do-I-see-a-slight-quality-degradation-with-multithreaded-MPEG_002a-encoding_003f" aria-hidden="true">TOC</a></span></h3>
  249. <p>For multithreaded MPEG* encoding, the encoded slices must be independent,
  250. otherwise thread n would practically have to wait for n-1 to finish, so it&rsquo;s
  251. quite logical that there is a small reduction of quality. This is not a bug.
  252. </p>
  253. <a name="How-can-I-read-from-the-standard-input-or-write-to-the-standard-output_003f"></a>
  254. <h3 class="section">3.5 How can I read from the standard input or write to the standard output?<span class="pull-right"><a class="anchor hidden-xs" href="#How-can-I-read-from-the-standard-input-or-write-to-the-standard-output_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-can-I-read-from-the-standard-input-or-write-to-the-standard-output_003f" aria-hidden="true">TOC</a></span></h3>
  255. <p>Use <samp>-</samp> as file name.
  256. </p>
  257. <a name="g_t_002df-jpeg-doesn_0027t-work_002e"></a>
  258. <h3 class="section">3.6 -f jpeg doesn&rsquo;t work.<span class="pull-right"><a class="anchor hidden-xs" href="#_002df-jpeg-doesn_0027t-work_002e" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-_002df-jpeg-doesn_0027t-work_002e" aria-hidden="true">TOC</a></span></h3>
  259. <p>Try &rsquo;-f image2 test%d.jpg&rsquo;.
  260. </p>
  261. <a name="Why-can-I-not-change-the-frame-rate_003f"></a>
  262. <h3 class="section">3.7 Why can I not change the frame rate?<span class="pull-right"><a class="anchor hidden-xs" href="#Why-can-I-not-change-the-frame-rate_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Why-can-I-not-change-the-frame-rate_003f" aria-hidden="true">TOC</a></span></h3>
  263. <p>Some codecs, like MPEG-1/2, only allow a small number of fixed frame rates.
  264. Choose a different codec with the -c:v command line option.
  265. </p>
  266. <a name="How-do-I-encode-Xvid-or-DivX-video-with-ffmpeg_003f"></a>
  267. <h3 class="section">3.8 How do I encode Xvid or DivX video with ffmpeg?<span class="pull-right"><a class="anchor hidden-xs" href="#How-do-I-encode-Xvid-or-DivX-video-with-ffmpeg_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-do-I-encode-Xvid-or-DivX-video-with-ffmpeg_003f" aria-hidden="true">TOC</a></span></h3>
  268. <p>Both Xvid and DivX (version 4+) are implementations of the ISO MPEG-4
  269. standard (note that there are many other coding formats that use this
  270. same standard). Thus, use &rsquo;-c:v mpeg4&rsquo; to encode in these formats. The
  271. default fourcc stored in an MPEG-4-coded file will be &rsquo;FMP4&rsquo;. If you want
  272. a different fourcc, use the &rsquo;-vtag&rsquo; option. E.g., &rsquo;-vtag xvid&rsquo; will
  273. force the fourcc &rsquo;xvid&rsquo; to be stored as the video fourcc rather than the
  274. default.
  275. </p>
  276. <a name="Which-are-good-parameters-for-encoding-high-quality-MPEG_002d4_003f"></a>
  277. <h3 class="section">3.9 Which are good parameters for encoding high quality MPEG-4?<span class="pull-right"><a class="anchor hidden-xs" href="#Which-are-good-parameters-for-encoding-high-quality-MPEG_002d4_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Which-are-good-parameters-for-encoding-high-quality-MPEG_002d4_003f" aria-hidden="true">TOC</a></span></h3>
  278. <p>&rsquo;-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 1/2&rsquo;,
  279. things to try: &rsquo;-bf 2&rsquo;, &rsquo;-mpv_flags qp_rd&rsquo;, &rsquo;-mpv_flags mv0&rsquo;, &rsquo;-mpv_flags skip_rd&rsquo;.
  280. </p>
  281. <a name="Which-are-good-parameters-for-encoding-high-quality-MPEG_002d1_002fMPEG_002d2_003f"></a>
  282. <h3 class="section">3.10 Which are good parameters for encoding high quality MPEG-1/MPEG-2?<span class="pull-right"><a class="anchor hidden-xs" href="#Which-are-good-parameters-for-encoding-high-quality-MPEG_002d1_002fMPEG_002d2_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Which-are-good-parameters-for-encoding-high-quality-MPEG_002d1_002fMPEG_002d2_003f" aria-hidden="true">TOC</a></span></h3>
  283. <p>&rsquo;-mbd rd -trellis 2 -cmp 2 -subcmp 2 -g 100 -pass 1/2&rsquo;
  284. but beware the &rsquo;-g 100&rsquo; might cause problems with some decoders.
  285. Things to try: &rsquo;-bf 2&rsquo;, &rsquo;-mpv_flags qp_rd&rsquo;, &rsquo;-mpv_flags mv0&rsquo;, &rsquo;-mpv_flags skip_rd&rsquo;.
  286. </p>
  287. <a name="Interlaced-video-looks-very-bad-when-encoded-with-ffmpeg_002c-what-is-wrong_003f"></a>
  288. <h3 class="section">3.11 Interlaced video looks very bad when encoded with ffmpeg, what is wrong?<span class="pull-right"><a class="anchor hidden-xs" href="#Interlaced-video-looks-very-bad-when-encoded-with-ffmpeg_002c-what-is-wrong_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Interlaced-video-looks-very-bad-when-encoded-with-ffmpeg_002c-what-is-wrong_003f" aria-hidden="true">TOC</a></span></h3>
  289. <p>You should use &rsquo;-flags +ilme+ildct&rsquo; and maybe &rsquo;-flags +alt&rsquo; for interlaced
  290. material, and try &rsquo;-top 0/1&rsquo; if the result looks really messed-up.
  291. </p>
  292. <a name="How-can-I-read-DirectShow-files_003f"></a>
  293. <h3 class="section">3.12 How can I read DirectShow files?<span class="pull-right"><a class="anchor hidden-xs" href="#How-can-I-read-DirectShow-files_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-can-I-read-DirectShow-files_003f" aria-hidden="true">TOC</a></span></h3>
  294. <p>If you have built FFmpeg with <code>./configure --enable-avisynth</code>
  295. (only possible on MinGW/Cygwin platforms),
  296. then you may use any file that DirectShow can read as input.
  297. </p>
  298. <p>Just create an &quot;input.avs&quot; text file with this single line ...
  299. </p><div class="example">
  300. <pre class="example">DirectShowSource(&quot;C:\path to your file\yourfile.asf&quot;)
  301. </pre></div>
  302. <p>... and then feed that text file to ffmpeg:
  303. </p><div class="example">
  304. <pre class="example">ffmpeg -i input.avs
  305. </pre></div>
  306. <p>For ANY other help on AviSynth, please visit the
  307. <a href="http://www.avisynth.org/">AviSynth homepage</a>.
  308. </p>
  309. <a name="How-can-I-join-video-files_003f"></a>
  310. <h3 class="section">3.13 How can I join video files?<span class="pull-right"><a class="anchor hidden-xs" href="#How-can-I-join-video-files_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-can-I-join-video-files_003f" aria-hidden="true">TOC</a></span></h3>
  311. <p>To &quot;join&quot; video files is quite ambiguous. The following list explains the
  312. different kinds of &quot;joining&quot; and points out how those are addressed in
  313. FFmpeg. To join video files may mean:
  314. </p>
  315. <ul>
  316. <li> To put them one after the other: this is called to <em>concatenate</em> them
  317. (in short: concat) and is addressed
  318. <a href="#How-can-I-concatenate-video-files">in this very faq</a>.
  319. </li><li> To put them together in the same file, to let the user choose between the
  320. different versions (example: different audio languages): this is called to
  321. <em>multiplex</em> them together (in short: mux), and is done by simply
  322. invoking ffmpeg with several <samp>-i</samp> options.
  323. </li><li> For audio, to put all channels together in a single stream (example: two
  324. mono streams into one stereo stream): this is sometimes called to
  325. <em>merge</em> them, and can be done using the
  326. <a href="ffmpeg-filters.html#amerge"><code>amerge</code></a> filter.
  327. </li><li> For audio, to play one on top of the other: this is called to <em>mix</em>
  328. them, and can be done by first merging them into a single stream and then
  329. using the <a href="ffmpeg-filters.html#pan"><code>pan</code></a> filter to mix
  330. the channels at will.
  331. </li><li> For video, to display both together, side by side or one on top of a part of
  332. the other; it can be done using the
  333. <a href="ffmpeg-filters.html#overlay"><code>overlay</code></a> video filter.
  334. </li></ul>
  335. <span id="How-can-I-concatenate-video-files"></span><a name="How-can-I-concatenate-video-files_003f"></a>
  336. <h3 class="section">3.14 How can I concatenate video files?<span class="pull-right"><a class="anchor hidden-xs" href="#How-can-I-concatenate-video-files_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-can-I-concatenate-video-files_003f" aria-hidden="true">TOC</a></span></h3>
  337. <p>There are several solutions, depending on the exact circumstances.
  338. </p>
  339. <a name="Concatenating-using-the-concat-filter"></a>
  340. <h4 class="subsection">3.14.1 Concatenating using the concat <em>filter</em><span class="pull-right"><a class="anchor hidden-xs" href="#Concatenating-using-the-concat-filter" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Concatenating-using-the-concat-filter" aria-hidden="true">TOC</a></span></h4>
  341. <p>FFmpeg has a <a href="ffmpeg-filters.html#concat"><code>concat</code></a> filter designed specifically for that, with examples in the
  342. documentation. This operation is recommended if you need to re-encode.
  343. </p>
  344. <a name="Concatenating-using-the-concat-demuxer"></a>
  345. <h4 class="subsection">3.14.2 Concatenating using the concat <em>demuxer</em><span class="pull-right"><a class="anchor hidden-xs" href="#Concatenating-using-the-concat-demuxer" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Concatenating-using-the-concat-demuxer" aria-hidden="true">TOC</a></span></h4>
  346. <p>FFmpeg has a <a href="ffmpeg-formats.html#concat"><code>concat</code></a> demuxer which you can use when you want to avoid a re-encode and
  347. your format doesn&rsquo;t support file level concatenation.
  348. </p>
  349. <a name="Concatenating-using-the-concat-protocol-_0028file-level_0029"></a>
  350. <h4 class="subsection">3.14.3 Concatenating using the concat <em>protocol</em> (file level)<span class="pull-right"><a class="anchor hidden-xs" href="#Concatenating-using-the-concat-protocol-_0028file-level_0029" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Concatenating-using-the-concat-protocol-_0028file-level_0029" aria-hidden="true">TOC</a></span></h4>
  351. <p>FFmpeg has a <a href="ffmpeg-protocols.html#concat"><code>concat</code></a> protocol designed specifically for that, with examples in the
  352. documentation.
  353. </p>
  354. <p>A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow one to concatenate
  355. video by merely concatenating the files containing them.
  356. </p>
  357. <p>Hence you may concatenate your multimedia files by first transcoding them to
  358. these privileged formats, then using the humble <code>cat</code> command (or the
  359. equally humble <code>copy</code> under Windows), and finally transcoding back to your
  360. format of choice.
  361. </p>
  362. <div class="example">
  363. <pre class="example">ffmpeg -i input1.avi -qscale:v 1 intermediate1.mpg
  364. ffmpeg -i input2.avi -qscale:v 1 intermediate2.mpg
  365. cat intermediate1.mpg intermediate2.mpg &gt; intermediate_all.mpg
  366. ffmpeg -i intermediate_all.mpg -qscale:v 2 output.avi
  367. </pre></div>
  368. <p>Additionally, you can use the <code>concat</code> protocol instead of <code>cat</code> or
  369. <code>copy</code> which will avoid creation of a potentially huge intermediate file.
  370. </p>
  371. <div class="example">
  372. <pre class="example">ffmpeg -i input1.avi -qscale:v 1 intermediate1.mpg
  373. ffmpeg -i input2.avi -qscale:v 1 intermediate2.mpg
  374. ffmpeg -i concat:&quot;intermediate1.mpg|intermediate2.mpg&quot; -c copy intermediate_all.mpg
  375. ffmpeg -i intermediate_all.mpg -qscale:v 2 output.avi
  376. </pre></div>
  377. <p>Note that you may need to escape the character &quot;|&quot; which is special for many
  378. shells.
  379. </p>
  380. <p>Another option is usage of named pipes, should your platform support it:
  381. </p>
  382. <div class="example">
  383. <pre class="example">mkfifo intermediate1.mpg
  384. mkfifo intermediate2.mpg
  385. ffmpeg -i input1.avi -qscale:v 1 -y intermediate1.mpg &lt; /dev/null &amp;
  386. ffmpeg -i input2.avi -qscale:v 1 -y intermediate2.mpg &lt; /dev/null &amp;
  387. cat intermediate1.mpg intermediate2.mpg |\
  388. ffmpeg -f mpeg -i - -c:v mpeg4 -c:a libmp3lame output.avi
  389. </pre></div>
  390. <a name="Concatenating-using-raw-audio-and-video"></a>
  391. <h4 class="subsection">3.14.4 Concatenating using raw audio and video<span class="pull-right"><a class="anchor hidden-xs" href="#Concatenating-using-raw-audio-and-video" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Concatenating-using-raw-audio-and-video" aria-hidden="true">TOC</a></span></h4>
  392. <p>Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also
  393. allow concatenation, and the transcoding step is almost lossless.
  394. When using multiple yuv4mpegpipe(s), the first line needs to be discarded
  395. from all but the first stream. This can be accomplished by piping through
  396. <code>tail</code> as seen below. Note that when piping through <code>tail</code> you
  397. must use command grouping, <code>{ ;}</code>, to background properly.
  398. </p>
  399. <p>For example, let&rsquo;s say we want to concatenate two FLV files into an
  400. output.flv file:
  401. </p>
  402. <div class="example">
  403. <pre class="example">mkfifo temp1.a
  404. mkfifo temp1.v
  405. mkfifo temp2.a
  406. mkfifo temp2.v
  407. mkfifo all.a
  408. mkfifo all.v
  409. ffmpeg -i input1.flv -vn -f u16le -c:a pcm_s16le -ac 2 -ar 44100 - &gt; temp1.a &lt; /dev/null &amp;
  410. ffmpeg -i input2.flv -vn -f u16le -c:a pcm_s16le -ac 2 -ar 44100 - &gt; temp2.a &lt; /dev/null &amp;
  411. ffmpeg -i input1.flv -an -f yuv4mpegpipe - &gt; temp1.v &lt; /dev/null &amp;
  412. { ffmpeg -i input2.flv -an -f yuv4mpegpipe - &lt; /dev/null | tail -n +2 &gt; temp2.v ; } &amp;
  413. cat temp1.a temp2.a &gt; all.a &amp;
  414. cat temp1.v temp2.v &gt; all.v &amp;
  415. ffmpeg -f u16le -c:a pcm_s16le -ac 2 -ar 44100 -i all.a \
  416. -f yuv4mpegpipe -i all.v \
  417. -y output.flv
  418. rm temp[12].[av] all.[av]
  419. </pre></div>
  420. <a name="Using-_002df-lavfi_002c-audio-becomes-mono-for-no-apparent-reason_002e"></a>
  421. <h3 class="section">3.15 Using <samp>-f lavfi</samp>, audio becomes mono for no apparent reason.<span class="pull-right"><a class="anchor hidden-xs" href="#Using-_002df-lavfi_002c-audio-becomes-mono-for-no-apparent-reason_002e" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Using-_002df-lavfi_002c-audio-becomes-mono-for-no-apparent-reason_002e" aria-hidden="true">TOC</a></span></h3>
  422. <p>Use <samp>-dumpgraph -</samp> to find out exactly where the channel layout is
  423. lost.
  424. </p>
  425. <p>Most likely, it is through <code>auto-inserted aresample</code>. Try to understand
  426. why the converting filter was needed at that place.
  427. </p>
  428. <p>Just before the output is a likely place, as <samp>-f lavfi</samp> currently
  429. only support packed S16.
  430. </p>
  431. <p>Then insert the correct <code>aformat</code> explicitly in the filtergraph,
  432. specifying the exact format.
  433. </p>
  434. <div class="example">
  435. <pre class="example">aformat=sample_fmts=s16:channel_layouts=stereo
  436. </pre></div>
  437. <a name="Why-does-FFmpeg-not-see-the-subtitles-in-my-VOB-file_003f"></a>
  438. <h3 class="section">3.16 Why does FFmpeg not see the subtitles in my VOB file?<span class="pull-right"><a class="anchor hidden-xs" href="#Why-does-FFmpeg-not-see-the-subtitles-in-my-VOB-file_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Why-does-FFmpeg-not-see-the-subtitles-in-my-VOB-file_003f" aria-hidden="true">TOC</a></span></h3>
  439. <p>VOB and a few other formats do not have a global header that describes
  440. everything present in the file. Instead, applications are supposed to scan
  441. the file to see what it contains. Since VOB files are frequently large, only
  442. the beginning is scanned. If the subtitles happen only later in the file,
  443. they will not be initially detected.
  444. </p>
  445. <p>Some applications, including the <code>ffmpeg</code> command-line tool, can only
  446. work with streams that were detected during the initial scan; streams that
  447. are detected later are ignored.
  448. </p>
  449. <p>The size of the initial scan is controlled by two options: <code>probesize</code>
  450. (default ~5 Mo) and <code>analyzeduration</code> (default 5,000,000 µs = 5 s). For
  451. the subtitle stream to be detected, both values must be large enough.
  452. </p>
  453. <a name="Why-was-the-ffmpeg-_002dsameq-option-removed_003f-What-to-use-instead_003f"></a>
  454. <h3 class="section">3.17 Why was the <code>ffmpeg</code> <samp>-sameq</samp> option removed? What to use instead?<span class="pull-right"><a class="anchor hidden-xs" href="#Why-was-the-ffmpeg-_002dsameq-option-removed_003f-What-to-use-instead_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Why-was-the-ffmpeg-_002dsameq-option-removed_003f-What-to-use-instead_003f" aria-hidden="true">TOC</a></span></h3>
  455. <p>The <samp>-sameq</samp> option meant &quot;same quantizer&quot;, and made sense only in a
  456. very limited set of cases. Unfortunately, a lot of people mistook it for
  457. &quot;same quality&quot; and used it in places where it did not make sense: it had
  458. roughly the expected visible effect, but achieved it in a very inefficient
  459. way.
  460. </p>
  461. <p>Each encoder has its own set of options to set the quality-vs-size balance,
  462. use the options for the encoder you are using to set the quality level to a
  463. point acceptable for your tastes. The most common options to do that are
  464. <samp>-qscale</samp> and <samp>-qmax</samp>, but you should peruse the documentation
  465. of the encoder you chose.
  466. </p>
  467. <a name="I-have-a-stretched-video_002c-why-does-scaling-does-not-fix-it_003f"></a>
  468. <h3 class="section">3.18 I have a stretched video, why does scaling does not fix it?<span class="pull-right"><a class="anchor hidden-xs" href="#I-have-a-stretched-video_002c-why-does-scaling-does-not-fix-it_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-I-have-a-stretched-video_002c-why-does-scaling-does-not-fix-it_003f" aria-hidden="true">TOC</a></span></h3>
  469. <p>A lot of video codecs and formats can store the <em>aspect ratio</em> of the
  470. video: this is the ratio between the width and the height of either the full
  471. image (DAR, display aspect ratio) or individual pixels (SAR, sample aspect
  472. ratio). For example, EGA screens at resolution 640×350 had 4:3 DAR and 35:48
  473. SAR.
  474. </p>
  475. <p>Most still image processing work with square pixels, i.e. 1:1 SAR, but a lot
  476. of video standards, especially from the analogic-numeric transition era, use
  477. non-square pixels.
  478. </p>
  479. <p>Most processing filters in FFmpeg handle the aspect ratio to avoid
  480. stretching the image: cropping adjusts the DAR to keep the SAR constant,
  481. scaling adjusts the SAR to keep the DAR constant.
  482. </p>
  483. <p>If you want to stretch, or “unstretch”, the image, you need to override the
  484. information with the
  485. <a href="ffmpeg-filters.html#setdar_002c-setsar"><code>setdar or setsar filters</code></a>.
  486. </p>
  487. <p>Do not forget to examine carefully the original video to check whether the
  488. stretching comes from the image or from the aspect ratio information.
  489. </p>
  490. <p>For example, to fix a badly encoded EGA capture, use the following commands,
  491. either the first one to upscale to square pixels or the second one to set
  492. the correct aspect ratio or the third one to avoid transcoding (may not work
  493. depending on the format / codec / player / phase of the moon):
  494. </p>
  495. <div class="example">
  496. <pre class="example">ffmpeg -i ega_screen.nut -vf scale=640:480,setsar=1 ega_screen_scaled.nut
  497. ffmpeg -i ega_screen.nut -vf setdar=4/3 ega_screen_anamorphic.nut
  498. ffmpeg -i ega_screen.nut -aspect 4/3 -c copy ega_screen_overridden.nut
  499. </pre></div>
  500. <span id="background-task"></span><a name="How-do-I-run-ffmpeg-as-a-background-task_003f"></a>
  501. <h3 class="section">3.19 How do I run ffmpeg as a background task?<span class="pull-right"><a class="anchor hidden-xs" href="#How-do-I-run-ffmpeg-as-a-background-task_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-do-I-run-ffmpeg-as-a-background-task_003f" aria-hidden="true">TOC</a></span></h3>
  502. <p>ffmpeg normally checks the console input, for entries like &quot;q&quot; to stop
  503. and &quot;?&quot; to give help, while performing operations. ffmpeg does not have a way of
  504. detecting when it is running as a background task.
  505. When it checks the console input, that can cause the process running ffmpeg
  506. in the background to suspend.
  507. </p>
  508. <p>To prevent those input checks, allowing ffmpeg to run as a background task,
  509. use the <a href="ffmpeg.html#stdin-option"><code>-nostdin</code> option</a>
  510. in the ffmpeg invocation. This is effective whether you run ffmpeg in a shell
  511. or invoke ffmpeg in its own process via an operating system API.
  512. </p>
  513. <p>As an alternative, when you are running ffmpeg in a shell, you can redirect
  514. standard input to <code>/dev/null</code> (on Linux and macOS)
  515. or <code>NUL</code> (on Windows). You can do this redirect either
  516. on the ffmpeg invocation, or from a shell script which calls ffmpeg.
  517. </p>
  518. <p>For example:
  519. </p>
  520. <div class="example">
  521. <pre class="example">ffmpeg -nostdin -i INPUT OUTPUT
  522. </pre></div>
  523. <p>or (on Linux, macOS, and other UNIX-like shells):
  524. </p>
  525. <div class="example">
  526. <pre class="example">ffmpeg -i INPUT OUTPUT &lt;/dev/null
  527. </pre></div>
  528. <p>or (on Windows):
  529. </p>
  530. <div class="example">
  531. <pre class="example">ffmpeg -i INPUT OUTPUT &lt;NUL
  532. </pre></div>
  533. <a name="How-do-I-prevent-ffmpeg-from-suspending-with-a-message-like-suspended-_0028tty-output_0029_003f"></a>
  534. <h3 class="section">3.20 How do I prevent ffmpeg from suspending with a message like <em>suspended (tty output)</em>?<span class="pull-right"><a class="anchor hidden-xs" href="#How-do-I-prevent-ffmpeg-from-suspending-with-a-message-like-suspended-_0028tty-output_0029_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-do-I-prevent-ffmpeg-from-suspending-with-a-message-like-suspended-_0028tty-output_0029_003f" aria-hidden="true">TOC</a></span></h3>
  535. <p>If you run ffmpeg in the background, you may find that its process suspends.
  536. There may be a message like <em>suspended (tty output)</em>. The question is how
  537. to prevent the process from being suspended.
  538. </p>
  539. <p>For example:
  540. </p>
  541. <div class="example">
  542. <pre class="example">% ffmpeg -i INPUT OUTPUT &amp;&gt; ~/tmp/log.txt &amp;
  543. [1] 93352
  544. %
  545. [1] + suspended (tty output) ffmpeg -i INPUT OUTPUT &amp;&gt;
  546. </pre></div>
  547. <p>The message &quot;tty output&quot; notwithstanding, the problem here is that
  548. ffmpeg normally checks the console input when it runs. The operating system
  549. detects this, and suspends the process until you can bring it to the
  550. foreground and attend to it.
  551. </p>
  552. <p>The solution is to use the right techniques to tell ffmpeg not to consult
  553. console input. You can use the
  554. <a href="ffmpeg.html#stdin-option"><code>-nostdin</code> option</a>,
  555. or redirect standard input with <code>&lt; /dev/null</code>.
  556. See FAQ
  557. <a href="#background-task"><em>How do I run ffmpeg as a background task?</em></a>
  558. for details.
  559. </p>
  560. <a name="Development"></a>
  561. <h2 class="chapter">4 Development<span class="pull-right"><a class="anchor hidden-xs" href="#Development" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Development" aria-hidden="true">TOC</a></span></h2>
  562. <a name="Are-there-examples-illustrating-how-to-use-the-FFmpeg-libraries_002c-particularly-libavcodec-and-libavformat_003f"></a>
  563. <h3 class="section">4.1 Are there examples illustrating how to use the FFmpeg libraries, particularly libavcodec and libavformat?<span class="pull-right"><a class="anchor hidden-xs" href="#Are-there-examples-illustrating-how-to-use-the-FFmpeg-libraries_002c-particularly-libavcodec-and-libavformat_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Are-there-examples-illustrating-how-to-use-the-FFmpeg-libraries_002c-particularly-libavcodec-and-libavformat_003f" aria-hidden="true">TOC</a></span></h3>
  564. <p>Yes. Check the <samp>doc/examples</samp> directory in the source
  565. repository, also available online at:
  566. <a href="https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples">https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples</a>.
  567. </p>
  568. <p>Examples are also installed by default, usually in
  569. <code>$PREFIX/share/ffmpeg/examples</code>.
  570. </p>
  571. <p>Also you may read the Developers Guide of the FFmpeg documentation. Alternatively,
  572. examine the source code for one of the many open source projects that
  573. already incorporate FFmpeg at (<a href="projects.html">projects.html</a>).
  574. </p>
  575. <a name="Can-you-support-my-C-compiler-XXX_003f"></a>
  576. <h3 class="section">4.2 Can you support my C compiler XXX?<span class="pull-right"><a class="anchor hidden-xs" href="#Can-you-support-my-C-compiler-XXX_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Can-you-support-my-C-compiler-XXX_003f" aria-hidden="true">TOC</a></span></h3>
  577. <p>It depends. If your compiler is C99-compliant, then patches to support
  578. it are likely to be welcome if they do not pollute the source code
  579. with <code>#ifdef</code>s related to the compiler.
  580. </p>
  581. <a name="Is-Microsoft-Visual-C_002b_002b-supported_003f"></a>
  582. <h3 class="section">4.3 Is Microsoft Visual C++ supported?<span class="pull-right"><a class="anchor hidden-xs" href="#Is-Microsoft-Visual-C_002b_002b-supported_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Is-Microsoft-Visual-C_002b_002b-supported_003f" aria-hidden="true">TOC</a></span></h3>
  583. <p>Yes. Please see the <a href="platform.html">Microsoft Visual C++</a>
  584. section in the FFmpeg documentation.
  585. </p>
  586. <a name="Can-you-add-automake_002c-libtool-or-autoconf-support_003f"></a>
  587. <h3 class="section">4.4 Can you add automake, libtool or autoconf support?<span class="pull-right"><a class="anchor hidden-xs" href="#Can-you-add-automake_002c-libtool-or-autoconf-support_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Can-you-add-automake_002c-libtool-or-autoconf-support_003f" aria-hidden="true">TOC</a></span></h3>
  588. <p>No. These tools are too bloated and they complicate the build.
  589. </p>
  590. <a name="Why-not-rewrite-FFmpeg-in-object_002doriented-C_002b_002b_003f"></a>
  591. <h3 class="section">4.5 Why not rewrite FFmpeg in object-oriented C++?<span class="pull-right"><a class="anchor hidden-xs" href="#Why-not-rewrite-FFmpeg-in-object_002doriented-C_002b_002b_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Why-not-rewrite-FFmpeg-in-object_002doriented-C_002b_002b_003f" aria-hidden="true">TOC</a></span></h3>
  592. <p>FFmpeg is already organized in a highly modular manner and does not need to
  593. be rewritten in a formal object language. Further, many of the developers
  594. favor straight C; it works for them. For more arguments on this matter,
  595. read <a href="https://web.archive.org/web/20111004021423/http://kernel.org/pub/linux/docs/lkml/#s15">&quot;Programming Religion&quot;</a>.
  596. </p>
  597. <a name="Why-are-the-ffmpeg-programs-devoid-of-debugging-symbols_003f"></a>
  598. <h3 class="section">4.6 Why are the ffmpeg programs devoid of debugging symbols?<span class="pull-right"><a class="anchor hidden-xs" href="#Why-are-the-ffmpeg-programs-devoid-of-debugging-symbols_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Why-are-the-ffmpeg-programs-devoid-of-debugging-symbols_003f" aria-hidden="true">TOC</a></span></h3>
  599. <p>The build process creates <code>ffmpeg_g</code>, <code>ffplay_g</code>, etc. which
  600. contain full debug information. Those binaries are stripped to create
  601. <code>ffmpeg</code>, <code>ffplay</code>, etc. If you need the debug information, use
  602. the *_g versions.
  603. </p>
  604. <a name="I-do-not-like-the-LGPL_002c-can-I-contribute-code-under-the-GPL-instead_003f"></a>
  605. <h3 class="section">4.7 I do not like the LGPL, can I contribute code under the GPL instead?<span class="pull-right"><a class="anchor hidden-xs" href="#I-do-not-like-the-LGPL_002c-can-I-contribute-code-under-the-GPL-instead_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-I-do-not-like-the-LGPL_002c-can-I-contribute-code-under-the-GPL-instead_003f" aria-hidden="true">TOC</a></span></h3>
  606. <p>Yes, as long as the code is optional and can easily and cleanly be placed
  607. under #if CONFIG_GPL without breaking anything. So, for example, a new codec
  608. or filter would be OK under GPL while a bug fix to LGPL code would not.
  609. </p>
  610. <a name="I_0027m-using-FFmpeg-from-within-my-C-application-but-the-linker-complains-about-missing-symbols-from-the-libraries-themselves_002e"></a>
  611. <h3 class="section">4.8 I&rsquo;m using FFmpeg from within my C application but the linker complains about missing symbols from the libraries themselves.<span class="pull-right"><a class="anchor hidden-xs" href="#I_0027m-using-FFmpeg-from-within-my-C-application-but-the-linker-complains-about-missing-symbols-from-the-libraries-themselves_002e" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-I_0027m-using-FFmpeg-from-within-my-C-application-but-the-linker-complains-about-missing-symbols-from-the-libraries-themselves_002e" aria-hidden="true">TOC</a></span></h3>
  612. <p>FFmpeg builds static libraries by default. In static libraries, dependencies
  613. are not handled. That has two consequences. First, you must specify the
  614. libraries in dependency order: <code>-lavdevice</code> must come before
  615. <code>-lavformat</code>, <code>-lavutil</code> must come after everything else, etc.
  616. Second, external libraries that are used in FFmpeg have to be specified too.
  617. </p>
  618. <p>An easy way to get the full list of required libraries in dependency order
  619. is to use <code>pkg-config</code>.
  620. </p>
  621. <div class="example">
  622. <pre class="example">c99 -o program program.c $(pkg-config --cflags --libs libavformat libavcodec)
  623. </pre></div>
  624. <p>See <samp>doc/example/Makefile</samp> and <samp>doc/example/pc-uninstalled</samp> for
  625. more details.
  626. </p>
  627. <a name="I_0027m-using-FFmpeg-from-within-my-C_002b_002b-application-but-the-linker-complains-about-missing-symbols-which-seem-to-be-available_002e"></a>
  628. <h3 class="section">4.9 I&rsquo;m using FFmpeg from within my C++ application but the linker complains about missing symbols which seem to be available.<span class="pull-right"><a class="anchor hidden-xs" href="#I_0027m-using-FFmpeg-from-within-my-C_002b_002b-application-but-the-linker-complains-about-missing-symbols-which-seem-to-be-available_002e" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-I_0027m-using-FFmpeg-from-within-my-C_002b_002b-application-but-the-linker-complains-about-missing-symbols-which-seem-to-be-available_002e" aria-hidden="true">TOC</a></span></h3>
  629. <p>FFmpeg is a pure C project, so to use the libraries within your C++ application
  630. you need to explicitly state that you are using a C library. You can do this by
  631. encompassing your FFmpeg includes using <code>extern &quot;C&quot;</code>.
  632. </p>
  633. <p>See <a href="http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.3">http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.3</a>
  634. </p>
  635. <a name="I_0027m-using-libavutil-from-within-my-C_002b_002b-application-but-the-compiler-complains-about-_0027UINT64_005fC_0027-was-not-declared-in-this-scope"></a>
  636. <h3 class="section">4.10 I&rsquo;m using libavutil from within my C++ application but the compiler complains about &rsquo;UINT64_C&rsquo; was not declared in this scope<span class="pull-right"><a class="anchor hidden-xs" href="#I_0027m-using-libavutil-from-within-my-C_002b_002b-application-but-the-compiler-complains-about-_0027UINT64_005fC_0027-was-not-declared-in-this-scope" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-I_0027m-using-libavutil-from-within-my-C_002b_002b-application-but-the-compiler-complains-about-_0027UINT64_005fC_0027-was-not-declared-in-this-scope" aria-hidden="true">TOC</a></span></h3>
  637. <p>FFmpeg is a pure C project using C99 math features, in order to enable C++
  638. to use them you have to append -D__STDC_CONSTANT_MACROS to your CXXFLAGS
  639. </p>
  640. <a name="I-have-a-file-in-memory-_002f-a-API-different-from-_002aopen_002f_002aread_002f-libc-how-do-I-use-it-with-libavformat_003f"></a>
  641. <h3 class="section">4.11 I have a file in memory / a API different from *open/*read/ libc how do I use it with libavformat?<span class="pull-right"><a class="anchor hidden-xs" href="#I-have-a-file-in-memory-_002f-a-API-different-from-_002aopen_002f_002aread_002f-libc-how-do-I-use-it-with-libavformat_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-I-have-a-file-in-memory-_002f-a-API-different-from-_002aopen_002f_002aread_002f-libc-how-do-I-use-it-with-libavformat_003f" aria-hidden="true">TOC</a></span></h3>
  642. <p>You have to create a custom AVIOContext using <code>avio_alloc_context</code>,
  643. see <samp>libavformat/aviobuf.c</samp> in FFmpeg and <samp>libmpdemux/demux_lavf.c</samp> in MPlayer or MPlayer2 sources.
  644. </p>
  645. <a name="Where-is-the-documentation-about-ffv1_002c-msmpeg4_002c-asv1_002c-4xm_003f"></a>
  646. <h3 class="section">4.12 Where is the documentation about ffv1, msmpeg4, asv1, 4xm?<span class="pull-right"><a class="anchor hidden-xs" href="#Where-is-the-documentation-about-ffv1_002c-msmpeg4_002c-asv1_002c-4xm_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Where-is-the-documentation-about-ffv1_002c-msmpeg4_002c-asv1_002c-4xm_003f" aria-hidden="true">TOC</a></span></h3>
  647. <p>see <a href="https://www.ffmpeg.org/~michael/">https://www.ffmpeg.org/~michael/</a>
  648. </p>
  649. <a name="How-do-I-feed-H_002e263_002dRTP-_0028and-other-codecs-in-RTP_0029-to-libavcodec_003f"></a>
  650. <h3 class="section">4.13 How do I feed H.263-RTP (and other codecs in RTP) to libavcodec?<span class="pull-right"><a class="anchor hidden-xs" href="#How-do-I-feed-H_002e263_002dRTP-_0028and-other-codecs-in-RTP_0029-to-libavcodec_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-How-do-I-feed-H_002e263_002dRTP-_0028and-other-codecs-in-RTP_0029-to-libavcodec_003f" aria-hidden="true">TOC</a></span></h3>
  651. <p>Even if peculiar since it is network oriented, RTP is a container like any
  652. other. You have to <em>demux</em> RTP before feeding the payload to libavcodec.
  653. In this specific case please look at RFC 4629 to see how it should be done.
  654. </p>
  655. <a name="AVStream_002er_005fframe_005frate-is-wrong_002c-it-is-much-larger-than-the-frame-rate_002e"></a>
  656. <h3 class="section">4.14 AVStream.r_frame_rate is wrong, it is much larger than the frame rate.<span class="pull-right"><a class="anchor hidden-xs" href="#AVStream_002er_005fframe_005frate-is-wrong_002c-it-is-much-larger-than-the-frame-rate_002e" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-AVStream_002er_005fframe_005frate-is-wrong_002c-it-is-much-larger-than-the-frame-rate_002e" aria-hidden="true">TOC</a></span></h3>
  657. <p><code>r_frame_rate</code> is NOT the average frame rate, it is the smallest frame rate
  658. that can accurately represent all timestamps. So no, it is not
  659. wrong if it is larger than the average!
  660. For example, if you have mixed 25 and 30 fps content, then <code>r_frame_rate</code>
  661. will be 150 (it is the least common multiple).
  662. If you are looking for the average frame rate, see <code>AVStream.avg_frame_rate</code>.
  663. </p>
  664. <a name="Why-is-make-fate-not-running-all-tests_003f"></a>
  665. <h3 class="section">4.15 Why is <code>make fate</code> not running all tests?<span class="pull-right"><a class="anchor hidden-xs" href="#Why-is-make-fate-not-running-all-tests_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Why-is-make-fate-not-running-all-tests_003f" aria-hidden="true">TOC</a></span></h3>
  666. <p>Make sure you have the fate-suite samples and the <code>SAMPLES</code> Make variable
  667. or <code>FATE_SAMPLES</code> environment variable or the <code>--samples</code>
  668. <code>configure</code> option is set to the right path.
  669. </p>
  670. <a name="Why-is-make-fate-not-finding-the-samples_003f"></a>
  671. <h3 class="section">4.16 Why is <code>make fate</code> not finding the samples?<span class="pull-right"><a class="anchor hidden-xs" href="#Why-is-make-fate-not-finding-the-samples_003f" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Why-is-make-fate-not-finding-the-samples_003f" aria-hidden="true">TOC</a></span></h3>
  672. <p>Do you happen to have a <code>~</code> character in the samples path to indicate a
  673. home directory? The value is used in ways where the shell cannot expand it,
  674. causing FATE to not find files. Just replace <code>~</code> by the full path.
  675. </p>
  676. </body>
  677. </html>