faq.html 65 KB

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