ffmpeg-bitstream-filters.html 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305
  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.0.1 -->
  4. <head>
  5. <meta charset="utf-8">
  6. <title>
  7. FFmpeg Bitstream Filters Documentation
  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 Bitstream Filters Documentation
  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-Description" href="#Description">1 Description</a></li>
  24. <li><a id="toc-Bitstream-Filters" href="#Bitstream-Filters">2 Bitstream Filters</a>
  25. <ul class="toc-numbered-mark">
  26. <li><a id="toc-aac_005fadtstoasc" href="#aac_005fadtstoasc">2.1 aac_adtstoasc</a></li>
  27. <li><a id="toc-av1_005fmetadata" href="#av1_005fmetadata">2.2 av1_metadata</a></li>
  28. <li><a id="toc-chomp" href="#chomp">2.3 chomp</a></li>
  29. <li><a id="toc-dca_005fcore" href="#dca_005fcore">2.4 dca_core</a></li>
  30. <li><a id="toc-dump_005fextra" href="#dump_005fextra">2.5 dump_extra</a></li>
  31. <li><a id="toc-dv_005ferror_005fmarker" href="#dv_005ferror_005fmarker">2.6 dv_error_marker</a></li>
  32. <li><a id="toc-eac3_005fcore" href="#eac3_005fcore">2.7 eac3_core</a></li>
  33. <li><a id="toc-extract_005fextradata" href="#extract_005fextradata">2.8 extract_extradata</a></li>
  34. <li><a id="toc-filter_005funits" href="#filter_005funits">2.9 filter_units</a></li>
  35. <li><a id="toc-hapqa_005fextract" href="#hapqa_005fextract">2.10 hapqa_extract</a></li>
  36. <li><a id="toc-h264_005fmetadata" href="#h264_005fmetadata">2.11 h264_metadata</a></li>
  37. <li><a id="toc-h264_005fmp4toannexb" href="#h264_005fmp4toannexb">2.12 h264_mp4toannexb</a></li>
  38. <li><a id="toc-h264_005fredundant_005fpps" href="#h264_005fredundant_005fpps">2.13 h264_redundant_pps</a></li>
  39. <li><a id="toc-hevc_005fmetadata" href="#hevc_005fmetadata">2.14 hevc_metadata</a></li>
  40. <li><a id="toc-hevc_005fmp4toannexb" href="#hevc_005fmp4toannexb">2.15 hevc_mp4toannexb</a></li>
  41. <li><a id="toc-imxdump" href="#imxdump">2.16 imxdump</a></li>
  42. <li><a id="toc-mjpeg2jpeg" href="#mjpeg2jpeg">2.17 mjpeg2jpeg</a></li>
  43. <li><a id="toc-mjpegadump" href="#mjpegadump">2.18 mjpegadump</a></li>
  44. <li><a id="toc-mov2textsub-1" href="#mov2textsub-1">2.19 mov2textsub</a></li>
  45. <li><a id="toc-mp3decomp" href="#mp3decomp">2.20 mp3decomp</a></li>
  46. <li><a id="toc-mpeg2_005fmetadata" href="#mpeg2_005fmetadata">2.21 mpeg2_metadata</a></li>
  47. <li><a id="toc-mpeg4_005funpack_005fbframes" href="#mpeg4_005funpack_005fbframes">2.22 mpeg4_unpack_bframes</a></li>
  48. <li><a id="toc-noise" href="#noise">2.23 noise</a>
  49. <ul class="toc-numbered-mark">
  50. <li><a id="toc-Examples" href="#Examples">2.23.1 Examples</a></li>
  51. </ul></li>
  52. <li><a id="toc-null" href="#null">2.24 null</a></li>
  53. <li><a id="toc-pcm_005frechunk" href="#pcm_005frechunk">2.25 pcm_rechunk</a></li>
  54. <li><a id="toc-pgs_005fframe_005fmerge" href="#pgs_005fframe_005fmerge">2.26 pgs_frame_merge</a></li>
  55. <li><a id="toc-prores_005fmetadata" href="#prores_005fmetadata">2.27 prores_metadata</a></li>
  56. <li><a id="toc-remove_005fextra" href="#remove_005fextra">2.28 remove_extra</a></li>
  57. <li><a id="toc-setts" href="#setts">2.29 setts</a></li>
  58. <li><a id="toc-text2movsub-1" href="#text2movsub-1">2.30 text2movsub</a></li>
  59. <li><a id="toc-trace_005fheaders" href="#trace_005fheaders">2.31 trace_headers</a></li>
  60. <li><a id="toc-truehd_005fcore" href="#truehd_005fcore">2.32 truehd_core</a></li>
  61. <li><a id="toc-vp9_005fmetadata" href="#vp9_005fmetadata">2.33 vp9_metadata</a></li>
  62. <li><a id="toc-vp9_005fsuperframe" href="#vp9_005fsuperframe">2.34 vp9_superframe</a></li>
  63. <li><a id="toc-vp9_005fsuperframe_005fsplit" href="#vp9_005fsuperframe_005fsplit">2.35 vp9_superframe_split</a></li>
  64. <li><a id="toc-vp9_005fraw_005freorder" href="#vp9_005fraw_005freorder">2.36 vp9_raw_reorder</a></li>
  65. </ul></li>
  66. <li><a id="toc-See-Also" href="#See-Also">3 See Also</a></li>
  67. <li><a id="toc-Authors" href="#Authors">4 Authors</a></li>
  68. </ul>
  69. </div>
  70. </div>
  71. <ul class="mini-toc">
  72. <li><a href="#Description" accesskey="1">Description</a></li>
  73. <li><a href="#Bitstream-Filters" accesskey="2">Bitstream Filters</a></li>
  74. <li><a href="#See-Also" accesskey="3">See Also</a></li>
  75. <li><a href="#Authors" accesskey="4">Authors</a></li>
  76. </ul>
  77. <div class="chapter-level-extent" id="Description">
  78. <h2 class="chapter">1 Description</h2>
  79. <p>This document describes the bitstream filters provided by the
  80. libavcodec library.
  81. </p>
  82. <p>A bitstream filter operates on the encoded stream data, and performs
  83. bitstream level modifications without performing decoding.
  84. </p>
  85. </div>
  86. <div class="chapter-level-extent" id="Bitstream-Filters">
  87. <h2 class="chapter">2 Bitstream Filters</h2>
  88. <p>When you configure your FFmpeg build, all the supported bitstream
  89. filters are enabled by default. You can list all available ones using
  90. the configure option <code class="code">--list-bsfs</code>.
  91. </p>
  92. <p>You can disable all the bitstream filters using the configure option
  93. <code class="code">--disable-bsfs</code>, and selectively enable any bitstream filter using
  94. the option <code class="code">--enable-bsf=BSF</code>, or you can disable a particular
  95. bitstream filter using the option <code class="code">--disable-bsf=BSF</code>.
  96. </p>
  97. <p>The option <code class="code">-bsfs</code> of the ff* tools will display the list of
  98. all the supported bitstream filters included in your build.
  99. </p>
  100. <p>The ff* tools have a -bsf option applied per stream, taking a
  101. comma-separated list of filters, whose parameters follow the filter
  102. name after a &rsquo;=&rsquo;.
  103. </p>
  104. <div class="example">
  105. <pre class="example-preformatted">ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1:opt2=str2][,filter2] OUTPUT
  106. </pre></div>
  107. <p>Below is a description of the currently available bitstream filters,
  108. with their parameters, if any.
  109. </p>
  110. <ul class="mini-toc">
  111. <li><a href="#aac_005fadtstoasc" accesskey="1">aac_adtstoasc</a></li>
  112. <li><a href="#av1_005fmetadata" accesskey="2">av1_metadata</a></li>
  113. <li><a href="#chomp" accesskey="3">chomp</a></li>
  114. <li><a href="#dca_005fcore" accesskey="4">dca_core</a></li>
  115. <li><a href="#dump_005fextra" accesskey="5">dump_extra</a></li>
  116. <li><a href="#dv_005ferror_005fmarker" accesskey="6">dv_error_marker</a></li>
  117. <li><a href="#eac3_005fcore" accesskey="7">eac3_core</a></li>
  118. <li><a href="#extract_005fextradata" accesskey="8">extract_extradata</a></li>
  119. <li><a href="#filter_005funits" accesskey="9">filter_units</a></li>
  120. <li><a href="#hapqa_005fextract">hapqa_extract</a></li>
  121. <li><a href="#h264_005fmetadata">h264_metadata</a></li>
  122. <li><a href="#h264_005fmp4toannexb">h264_mp4toannexb</a></li>
  123. <li><a href="#h264_005fredundant_005fpps">h264_redundant_pps</a></li>
  124. <li><a href="#hevc_005fmetadata">hevc_metadata</a></li>
  125. <li><a href="#hevc_005fmp4toannexb">hevc_mp4toannexb</a></li>
  126. <li><a href="#imxdump">imxdump</a></li>
  127. <li><a href="#mjpeg2jpeg">mjpeg2jpeg</a></li>
  128. <li><a href="#mjpegadump">mjpegadump</a></li>
  129. <li><a href="#mov2textsub-1">mov2textsub</a></li>
  130. <li><a href="#mp3decomp">mp3decomp</a></li>
  131. <li><a href="#mpeg2_005fmetadata">mpeg2_metadata</a></li>
  132. <li><a href="#mpeg4_005funpack_005fbframes">mpeg4_unpack_bframes</a></li>
  133. <li><a href="#noise">noise</a></li>
  134. <li><a href="#null">null</a></li>
  135. <li><a href="#pcm_005frechunk">pcm_rechunk</a></li>
  136. <li><a href="#pgs_005fframe_005fmerge">pgs_frame_merge</a></li>
  137. <li><a href="#prores_005fmetadata">prores_metadata</a></li>
  138. <li><a href="#remove_005fextra">remove_extra</a></li>
  139. <li><a href="#setts">setts</a></li>
  140. <li><a href="#text2movsub-1">text2movsub</a></li>
  141. <li><a href="#trace_005fheaders">trace_headers</a></li>
  142. <li><a href="#truehd_005fcore">truehd_core</a></li>
  143. <li><a href="#vp9_005fmetadata">vp9_metadata</a></li>
  144. <li><a href="#vp9_005fsuperframe">vp9_superframe</a></li>
  145. <li><a href="#vp9_005fsuperframe_005fsplit">vp9_superframe_split</a></li>
  146. <li><a href="#vp9_005fraw_005freorder">vp9_raw_reorder</a></li>
  147. </ul>
  148. <div class="section-level-extent" id="aac_005fadtstoasc">
  149. <h3 class="section">2.1 aac_adtstoasc</h3>
  150. <p>Convert MPEG-2/4 AAC ADTS to an MPEG-4 Audio Specific Configuration
  151. bitstream.
  152. </p>
  153. <p>This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4
  154. ADTS header and removes the ADTS header.
  155. </p>
  156. <p>This filter is required for example when copying an AAC stream from a
  157. raw ADTS AAC or an MPEG-TS container to MP4A-LATM, to an FLV file, or
  158. to MOV/MP4 files and related formats such as 3GP or M4A. Please note
  159. that it is auto-inserted for MP4A-LATM and MOV/MP4 and related formats.
  160. </p>
  161. </div>
  162. <div class="section-level-extent" id="av1_005fmetadata">
  163. <h3 class="section">2.2 av1_metadata</h3>
  164. <p>Modify metadata embedded in an AV1 stream.
  165. </p>
  166. <dl class="table">
  167. <dt><samp class="option">td</samp></dt>
  168. <dd><p>Insert or remove temporal delimiter OBUs in all temporal units of the
  169. stream.
  170. </p>
  171. <dl class="table">
  172. <dt>&lsquo;<samp class="samp">insert</samp>&rsquo;</dt>
  173. <dd><p>Insert a TD at the beginning of every TU which does not already have one.
  174. </p></dd>
  175. <dt>&lsquo;<samp class="samp">remove</samp>&rsquo;</dt>
  176. <dd><p>Remove the TD from the beginning of every TU which has one.
  177. </p></dd>
  178. </dl>
  179. </dd>
  180. <dt><samp class="option">color_primaries</samp></dt>
  181. <dt><samp class="option">transfer_characteristics</samp></dt>
  182. <dt><samp class="option">matrix_coefficients</samp></dt>
  183. <dd><p>Set the color description fields in the stream (see AV1 section 6.4.2).
  184. </p>
  185. </dd>
  186. <dt><samp class="option">color_range</samp></dt>
  187. <dd><p>Set the color range in the stream (see AV1 section 6.4.2; note that
  188. this cannot be set for streams using BT.709 primaries, sRGB transfer
  189. characteristic and identity (RGB) matrix coefficients).
  190. </p><dl class="table">
  191. <dt>&lsquo;<samp class="samp">tv</samp>&rsquo;</dt>
  192. <dd><p>Limited range.
  193. </p></dd>
  194. <dt>&lsquo;<samp class="samp">pc</samp>&rsquo;</dt>
  195. <dd><p>Full range.
  196. </p></dd>
  197. </dl>
  198. </dd>
  199. <dt><samp class="option">chroma_sample_position</samp></dt>
  200. <dd><p>Set the chroma sample location in the stream (see AV1 section 6.4.2).
  201. This can only be set for 4:2:0 streams.
  202. </p>
  203. <dl class="table">
  204. <dt>&lsquo;<samp class="samp">vertical</samp>&rsquo;</dt>
  205. <dd><p>Left position (matching the default in MPEG-2 and H.264).
  206. </p></dd>
  207. <dt>&lsquo;<samp class="samp">colocated</samp>&rsquo;</dt>
  208. <dd><p>Top-left position.
  209. </p></dd>
  210. </dl>
  211. </dd>
  212. <dt><samp class="option">tick_rate</samp></dt>
  213. <dd><p>Set the tick rate (<em class="emph">time_scale / num_units_in_display_tick</em>) in
  214. the timing info in the sequence header.
  215. </p></dd>
  216. <dt><samp class="option">num_ticks_per_picture</samp></dt>
  217. <dd><p>Set the number of ticks in each picture, to indicate that the stream
  218. has a fixed framerate. Ignored if <samp class="option">tick_rate</samp> is not also set.
  219. </p>
  220. </dd>
  221. <dt><samp class="option">delete_padding</samp></dt>
  222. <dd><p>Deletes Padding OBUs.
  223. </p>
  224. </dd>
  225. </dl>
  226. </div>
  227. <div class="section-level-extent" id="chomp">
  228. <h3 class="section">2.3 chomp</h3>
  229. <p>Remove zero padding at the end of a packet.
  230. </p>
  231. </div>
  232. <div class="section-level-extent" id="dca_005fcore">
  233. <h3 class="section">2.4 dca_core</h3>
  234. <p>Extract the core from a DCA/DTS stream, dropping extensions such as
  235. DTS-HD.
  236. </p>
  237. </div>
  238. <div class="section-level-extent" id="dump_005fextra">
  239. <h3 class="section">2.5 dump_extra</h3>
  240. <p>Add extradata to the beginning of the filtered packets except when
  241. said packets already exactly begin with the extradata that is intended
  242. to be added.
  243. </p>
  244. <dl class="table">
  245. <dt><samp class="option">freq</samp></dt>
  246. <dd><p>The additional argument specifies which packets should be filtered.
  247. It accepts the values:
  248. </p><dl class="table">
  249. <dt>&lsquo;<samp class="samp">k</samp>&rsquo;</dt>
  250. <dt>&lsquo;<samp class="samp">keyframe</samp>&rsquo;</dt>
  251. <dd><p>add extradata to all key packets
  252. </p>
  253. </dd>
  254. <dt>&lsquo;<samp class="samp">e</samp>&rsquo;</dt>
  255. <dt>&lsquo;<samp class="samp">all</samp>&rsquo;</dt>
  256. <dd><p>add extradata to all packets
  257. </p></dd>
  258. </dl>
  259. </dd>
  260. </dl>
  261. <p>If not specified it is assumed &lsquo;<samp class="samp">k</samp>&rsquo;.
  262. </p>
  263. <p>For example the following <code class="command">ffmpeg</code> command forces a global
  264. header (thus disabling individual packet headers) in the H.264 packets
  265. generated by the <code class="code">libx264</code> encoder, but corrects them by adding
  266. the header stored in extradata to the key packets:
  267. </p><div class="example">
  268. <pre class="example-preformatted">ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts
  269. </pre></div>
  270. </div>
  271. <div class="section-level-extent" id="dv_005ferror_005fmarker">
  272. <h3 class="section">2.6 dv_error_marker</h3>
  273. <p>Blocks in DV which are marked as damaged are replaced by blocks of the specified color.
  274. </p>
  275. <dl class="table">
  276. <dt><samp class="option">color</samp></dt>
  277. <dd><p>The color to replace damaged blocks by
  278. </p></dd>
  279. <dt><samp class="option">sta</samp></dt>
  280. <dd><p>A 16 bit mask which specifies which of the 16 possible error status values are
  281. to be replaced by colored blocks. 0xFFFE is the default which replaces all non 0
  282. error status values.
  283. </p><dl class="table">
  284. <dt>&lsquo;<samp class="samp">ok</samp>&rsquo;</dt>
  285. <dd><p>No error, no concealment
  286. </p></dd>
  287. <dt>&lsquo;<samp class="samp">err</samp>&rsquo;</dt>
  288. <dd><p>Error, No concealment
  289. </p></dd>
  290. <dt>&lsquo;<samp class="samp">res</samp>&rsquo;</dt>
  291. <dd><p>Reserved
  292. </p></dd>
  293. <dt>&lsquo;<samp class="samp">notok</samp>&rsquo;</dt>
  294. <dd><p>Error or concealment
  295. </p></dd>
  296. <dt>&lsquo;<samp class="samp">notres</samp>&rsquo;</dt>
  297. <dd><p>Not reserved
  298. </p></dd>
  299. <dt>&lsquo;<samp class="samp">Aa, Ba, Ca, Ab, Bb, Cb, A, B, C, a, b, erri, erru</samp>&rsquo;</dt>
  300. <dd><p>The specific error status code
  301. </p></dd>
  302. </dl>
  303. <p>see page 44-46 or section 5.5 of
  304. <a class="url" href="http://web.archive.org/web/20060927044735/http://www.smpte.org/smpte_store/standards/pdf/s314m.pdf">http://web.archive.org/web/20060927044735/http://www.smpte.org/smpte_store/standards/pdf/s314m.pdf</a>
  305. </p>
  306. </dd>
  307. </dl>
  308. </div>
  309. <div class="section-level-extent" id="eac3_005fcore">
  310. <h3 class="section">2.7 eac3_core</h3>
  311. <p>Extract the core from a E-AC-3 stream, dropping extra channels.
  312. </p>
  313. </div>
  314. <div class="section-level-extent" id="extract_005fextradata">
  315. <h3 class="section">2.8 extract_extradata</h3>
  316. <p>Extract the in-band extradata.
  317. </p>
  318. <p>Certain codecs allow the long-term headers (e.g. MPEG-2 sequence headers,
  319. or H.264/HEVC (VPS/)SPS/PPS) to be transmitted either &quot;in-band&quot; (i.e. as a part
  320. of the bitstream containing the coded frames) or &quot;out of band&quot; (e.g. on the
  321. container level). This latter form is called &quot;extradata&quot; in FFmpeg terminology.
  322. </p>
  323. <p>This bitstream filter detects the in-band headers and makes them available as
  324. extradata.
  325. </p>
  326. <dl class="table">
  327. <dt><samp class="option">remove</samp></dt>
  328. <dd><p>When this option is enabled, the long-term headers are removed from the
  329. bitstream after extraction.
  330. </p></dd>
  331. </dl>
  332. </div>
  333. <div class="section-level-extent" id="filter_005funits">
  334. <h3 class="section">2.9 filter_units</h3>
  335. <p>Remove units with types in or not in a given set from the stream.
  336. </p>
  337. <dl class="table">
  338. <dt><samp class="option">pass_types</samp></dt>
  339. <dd><p>List of unit types or ranges of unit types to pass through while removing
  340. all others. This is specified as a &rsquo;|&rsquo;-separated list of unit type values
  341. or ranges of values with &rsquo;-&rsquo;.
  342. </p>
  343. </dd>
  344. <dt><samp class="option">remove_types</samp></dt>
  345. <dd><p>Identical to <samp class="option">pass_types</samp>, except the units in the given set
  346. removed and all others passed through.
  347. </p></dd>
  348. </dl>
  349. <p>Extradata is unchanged by this transformation, but note that if the stream
  350. contains inline parameter sets then the output may be unusable if they are
  351. removed.
  352. </p>
  353. <p>For example, to remove all non-VCL NAL units from an H.264 stream:
  354. </p><div class="example">
  355. <pre class="example-preformatted">ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=pass_types=1-5' OUTPUT
  356. </pre></div>
  357. <p>To remove all AUDs, SEI and filler from an H.265 stream:
  358. </p><div class="example">
  359. <pre class="example-preformatted">ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=35|38-40' OUTPUT
  360. </pre></div>
  361. </div>
  362. <div class="section-level-extent" id="hapqa_005fextract">
  363. <h3 class="section">2.10 hapqa_extract</h3>
  364. <p>Extract Rgb or Alpha part of an HAPQA file, without recompression, in order to create an HAPQ or an HAPAlphaOnly file.
  365. </p>
  366. <dl class="table">
  367. <dt><samp class="option">texture</samp></dt>
  368. <dd><p>Specifies the texture to keep.
  369. </p>
  370. <dl class="table">
  371. <dt><samp class="option">color</samp></dt>
  372. <dt><samp class="option">alpha</samp></dt>
  373. </dl>
  374. </dd>
  375. </dl>
  376. <p>Convert HAPQA to HAPQ
  377. </p><div class="example">
  378. <pre class="example-preformatted">ffmpeg -i hapqa_inputfile.mov -c copy -bsf:v hapqa_extract=texture=color -tag:v HapY -metadata:s:v:0 encoder=&quot;HAPQ&quot; hapq_file.mov
  379. </pre></div>
  380. <p>Convert HAPQA to HAPAlphaOnly
  381. </p><div class="example">
  382. <pre class="example-preformatted">ffmpeg -i hapqa_inputfile.mov -c copy -bsf:v hapqa_extract=texture=alpha -tag:v HapA -metadata:s:v:0 encoder=&quot;HAPAlpha Only&quot; hapalphaonly_file.mov
  383. </pre></div>
  384. </div>
  385. <div class="section-level-extent" id="h264_005fmetadata">
  386. <h3 class="section">2.11 h264_metadata</h3>
  387. <p>Modify metadata embedded in an H.264 stream.
  388. </p>
  389. <dl class="table">
  390. <dt><samp class="option">aud</samp></dt>
  391. <dd><p>Insert or remove AUD NAL units in all access units of the stream.
  392. </p>
  393. <dl class="table">
  394. <dt>&lsquo;<samp class="samp">pass</samp>&rsquo;</dt>
  395. <dt>&lsquo;<samp class="samp">insert</samp>&rsquo;</dt>
  396. <dt>&lsquo;<samp class="samp">remove</samp>&rsquo;</dt>
  397. </dl>
  398. <p>Default is pass.
  399. </p>
  400. </dd>
  401. <dt><samp class="option">sample_aspect_ratio</samp></dt>
  402. <dd><p>Set the sample aspect ratio of the stream in the VUI parameters.
  403. See H.264 table E-1.
  404. </p>
  405. </dd>
  406. <dt><samp class="option">overscan_appropriate_flag</samp></dt>
  407. <dd><p>Set whether the stream is suitable for display using overscan
  408. or not (see H.264 section E.2.1).
  409. </p>
  410. </dd>
  411. <dt><samp class="option">video_format</samp></dt>
  412. <dt><samp class="option">video_full_range_flag</samp></dt>
  413. <dd><p>Set the video format in the stream (see H.264 section E.2.1 and
  414. table E-2).
  415. </p>
  416. </dd>
  417. <dt><samp class="option">colour_primaries</samp></dt>
  418. <dt><samp class="option">transfer_characteristics</samp></dt>
  419. <dt><samp class="option">matrix_coefficients</samp></dt>
  420. <dd><p>Set the colour description in the stream (see H.264 section E.2.1
  421. and tables E-3, E-4 and E-5).
  422. </p>
  423. </dd>
  424. <dt><samp class="option">chroma_sample_loc_type</samp></dt>
  425. <dd><p>Set the chroma sample location in the stream (see H.264 section
  426. E.2.1 and figure E-1).
  427. </p>
  428. </dd>
  429. <dt><samp class="option">tick_rate</samp></dt>
  430. <dd><p>Set the tick rate (time_scale / num_units_in_tick) in the VUI
  431. parameters. This is the smallest time unit representable in the
  432. stream, and in many cases represents the field rate of the stream
  433. (double the frame rate).
  434. </p></dd>
  435. <dt><samp class="option">fixed_frame_rate_flag</samp></dt>
  436. <dd><p>Set whether the stream has fixed framerate - typically this indicates
  437. that the framerate is exactly half the tick rate, but the exact
  438. meaning is dependent on interlacing and the picture structure (see
  439. H.264 section E.2.1 and table E-6).
  440. </p></dd>
  441. <dt><samp class="option">zero_new_constraint_set_flags</samp></dt>
  442. <dd><p>Zero constraint_set4_flag and constraint_set5_flag in the SPS. These
  443. bits were reserved in a previous version of the H.264 spec, and thus
  444. some hardware decoders require these to be zero. The result of zeroing
  445. this is still a valid bitstream.
  446. </p>
  447. </dd>
  448. <dt><samp class="option">crop_left</samp></dt>
  449. <dt><samp class="option">crop_right</samp></dt>
  450. <dt><samp class="option">crop_top</samp></dt>
  451. <dt><samp class="option">crop_bottom</samp></dt>
  452. <dd><p>Set the frame cropping offsets in the SPS. These values will replace
  453. the current ones if the stream is already cropped.
  454. </p>
  455. <p>These fields are set in pixels. Note that some sizes may not be
  456. representable if the chroma is subsampled or the stream is interlaced
  457. (see H.264 section 7.4.2.1.1).
  458. </p>
  459. </dd>
  460. <dt><samp class="option">sei_user_data</samp></dt>
  461. <dd><p>Insert a string as SEI unregistered user data. The argument must
  462. be of the form <em class="emph">UUID+string</em>, where the UUID is as hex digits
  463. possibly separated by hyphens, and the string can be anything.
  464. </p>
  465. <p>For example, &lsquo;<samp class="samp">086f3693-b7b3-4f2c-9653-21492feee5b8+hello</samp>&rsquo; will
  466. insert the string &ldquo;hello&rdquo; associated with the given UUID.
  467. </p>
  468. </dd>
  469. <dt><samp class="option">delete_filler</samp></dt>
  470. <dd><p>Deletes both filler NAL units and filler SEI messages.
  471. </p>
  472. </dd>
  473. <dt><samp class="option">display_orientation</samp></dt>
  474. <dd><p>Insert, extract or remove Display orientation SEI messages.
  475. See H.264 section D.1.27 and D.2.27 for syntax and semantics.
  476. </p>
  477. <dl class="table">
  478. <dt>&lsquo;<samp class="samp">pass</samp>&rsquo;</dt>
  479. <dt>&lsquo;<samp class="samp">insert</samp>&rsquo;</dt>
  480. <dt>&lsquo;<samp class="samp">remove</samp>&rsquo;</dt>
  481. <dt>&lsquo;<samp class="samp">extract</samp>&rsquo;</dt>
  482. </dl>
  483. <p>Default is pass.
  484. </p>
  485. <p>Insert mode works in conjunction with <code class="code">rotate</code> and <code class="code">flip</code> options.
  486. Any pre-existing Display orientation messages will be removed in insert or remove mode.
  487. Extract mode attaches the display matrix to the packet as side data.
  488. </p>
  489. </dd>
  490. <dt><samp class="option">rotate</samp></dt>
  491. <dd><p>Set rotation in display orientation SEI (anticlockwise angle in degrees).
  492. Range is -360 to +360. Default is NaN.
  493. </p>
  494. </dd>
  495. <dt><samp class="option">flip</samp></dt>
  496. <dd><p>Set flip in display orientation SEI.
  497. </p>
  498. <dl class="table">
  499. <dt>&lsquo;<samp class="samp">horizontal</samp>&rsquo;</dt>
  500. <dt>&lsquo;<samp class="samp">vertical</samp>&rsquo;</dt>
  501. </dl>
  502. <p>Default is unset.
  503. </p>
  504. </dd>
  505. <dt><samp class="option">level</samp></dt>
  506. <dd><p>Set the level in the SPS. Refer to H.264 section A.3 and tables A-1
  507. to A-5.
  508. </p>
  509. <p>The argument must be the name of a level (for example, &lsquo;<samp class="samp">4.2</samp>&rsquo;), a
  510. level_idc value (for example, &lsquo;<samp class="samp">42</samp>&rsquo;), or the special name &lsquo;<samp class="samp">auto</samp>&rsquo;
  511. indicating that the filter should attempt to guess the level from the
  512. input stream properties.
  513. </p>
  514. </dd>
  515. </dl>
  516. </div>
  517. <div class="section-level-extent" id="h264_005fmp4toannexb">
  518. <h3 class="section">2.12 h264_mp4toannexb</h3>
  519. <p>Convert an H.264 bitstream from length prefixed mode to start code
  520. prefixed mode (as defined in the Annex B of the ITU-T H.264
  521. specification).
  522. </p>
  523. <p>This is required by some streaming formats, typically the MPEG-2
  524. transport stream format (muxer <code class="code">mpegts</code>).
  525. </p>
  526. <p>For example to remux an MP4 file containing an H.264 stream to mpegts
  527. format with <code class="command">ffmpeg</code>, you can use the command:
  528. </p>
  529. <div class="example">
  530. <pre class="example-preformatted">ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
  531. </pre></div>
  532. <p>Please note that this filter is auto-inserted for MPEG-TS (muxer
  533. <code class="code">mpegts</code>) and raw H.264 (muxer <code class="code">h264</code>) output formats.
  534. </p>
  535. </div>
  536. <div class="section-level-extent" id="h264_005fredundant_005fpps">
  537. <h3 class="section">2.13 h264_redundant_pps</h3>
  538. <p>This applies a specific fixup to some Blu-ray streams which contain
  539. redundant PPSs modifying irrelevant parameters of the stream which
  540. confuse other transformations which require correct extradata.
  541. </p>
  542. </div>
  543. <div class="section-level-extent" id="hevc_005fmetadata">
  544. <h3 class="section">2.14 hevc_metadata</h3>
  545. <p>Modify metadata embedded in an HEVC stream.
  546. </p>
  547. <dl class="table">
  548. <dt><samp class="option">aud</samp></dt>
  549. <dd><p>Insert or remove AUD NAL units in all access units of the stream.
  550. </p>
  551. <dl class="table">
  552. <dt>&lsquo;<samp class="samp">insert</samp>&rsquo;</dt>
  553. <dt>&lsquo;<samp class="samp">remove</samp>&rsquo;</dt>
  554. </dl>
  555. </dd>
  556. <dt><samp class="option">sample_aspect_ratio</samp></dt>
  557. <dd><p>Set the sample aspect ratio in the stream in the VUI parameters.
  558. </p>
  559. </dd>
  560. <dt><samp class="option">video_format</samp></dt>
  561. <dt><samp class="option">video_full_range_flag</samp></dt>
  562. <dd><p>Set the video format in the stream (see H.265 section E.3.1 and
  563. table E.2).
  564. </p>
  565. </dd>
  566. <dt><samp class="option">colour_primaries</samp></dt>
  567. <dt><samp class="option">transfer_characteristics</samp></dt>
  568. <dt><samp class="option">matrix_coefficients</samp></dt>
  569. <dd><p>Set the colour description in the stream (see H.265 section E.3.1
  570. and tables E.3, E.4 and E.5).
  571. </p>
  572. </dd>
  573. <dt><samp class="option">chroma_sample_loc_type</samp></dt>
  574. <dd><p>Set the chroma sample location in the stream (see H.265 section
  575. E.3.1 and figure E.1).
  576. </p>
  577. </dd>
  578. <dt><samp class="option">tick_rate</samp></dt>
  579. <dd><p>Set the tick rate in the VPS and VUI parameters (time_scale /
  580. num_units_in_tick). Combined with <samp class="option">num_ticks_poc_diff_one</samp>, this can
  581. set a constant framerate in the stream. Note that it is likely to be
  582. overridden by container parameters when the stream is in a container.
  583. </p>
  584. </dd>
  585. <dt><samp class="option">num_ticks_poc_diff_one</samp></dt>
  586. <dd><p>Set poc_proportional_to_timing_flag in VPS and VUI and use this value
  587. to set num_ticks_poc_diff_one_minus1 (see H.265 sections 7.4.3.1 and
  588. E.3.1). Ignored if <samp class="option">tick_rate</samp> is not also set.
  589. </p>
  590. </dd>
  591. <dt><samp class="option">crop_left</samp></dt>
  592. <dt><samp class="option">crop_right</samp></dt>
  593. <dt><samp class="option">crop_top</samp></dt>
  594. <dt><samp class="option">crop_bottom</samp></dt>
  595. <dd><p>Set the conformance window cropping offsets in the SPS. These values
  596. will replace the current ones if the stream is already cropped.
  597. </p>
  598. <p>These fields are set in pixels. Note that some sizes may not be
  599. representable if the chroma is subsampled (H.265 section 7.4.3.2.1).
  600. </p>
  601. </dd>
  602. <dt><samp class="option">level</samp></dt>
  603. <dd><p>Set the level in the VPS and SPS. See H.265 section A.4 and tables
  604. A.6 and A.7.
  605. </p>
  606. <p>The argument must be the name of a level (for example, &lsquo;<samp class="samp">5.1</samp>&rsquo;), a
  607. <em class="emph">general_level_idc</em> value (for example, &lsquo;<samp class="samp">153</samp>&rsquo; for level 5.1),
  608. or the special name &lsquo;<samp class="samp">auto</samp>&rsquo; indicating that the filter should
  609. attempt to guess the level from the input stream properties.
  610. </p>
  611. </dd>
  612. </dl>
  613. </div>
  614. <div class="section-level-extent" id="hevc_005fmp4toannexb">
  615. <h3 class="section">2.15 hevc_mp4toannexb</h3>
  616. <p>Convert an HEVC/H.265 bitstream from length prefixed mode to start code
  617. prefixed mode (as defined in the Annex B of the ITU-T H.265
  618. specification).
  619. </p>
  620. <p>This is required by some streaming formats, typically the MPEG-2
  621. transport stream format (muxer <code class="code">mpegts</code>).
  622. </p>
  623. <p>For example to remux an MP4 file containing an HEVC stream to mpegts
  624. format with <code class="command">ffmpeg</code>, you can use the command:
  625. </p>
  626. <div class="example">
  627. <pre class="example-preformatted">ffmpeg -i INPUT.mp4 -codec copy -bsf:v hevc_mp4toannexb OUTPUT.ts
  628. </pre></div>
  629. <p>Please note that this filter is auto-inserted for MPEG-TS (muxer
  630. <code class="code">mpegts</code>) and raw HEVC/H.265 (muxer <code class="code">h265</code> or
  631. <code class="code">hevc</code>) output formats.
  632. </p>
  633. </div>
  634. <div class="section-level-extent" id="imxdump">
  635. <h3 class="section">2.16 imxdump</h3>
  636. <p>Modifies the bitstream to fit in MOV and to be usable by the Final Cut
  637. Pro decoder. This filter only applies to the mpeg2video codec, and is
  638. likely not needed for Final Cut Pro 7 and newer with the appropriate
  639. <samp class="option">-tag:v</samp>.
  640. </p>
  641. <p>For example, to remux 30 MB/sec NTSC IMX to MOV:
  642. </p>
  643. <div class="example">
  644. <pre class="example-preformatted">ffmpeg -i input.mxf -c copy -bsf:v imxdump -tag:v mx3n output.mov
  645. </pre></div>
  646. </div>
  647. <div class="section-level-extent" id="mjpeg2jpeg">
  648. <h3 class="section">2.17 mjpeg2jpeg</h3>
  649. <p>Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
  650. </p>
  651. <p>MJPEG is a video codec wherein each video frame is essentially a
  652. JPEG image. The individual frames can be extracted without loss,
  653. e.g. by
  654. </p>
  655. <div class="example">
  656. <pre class="example-preformatted">ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
  657. </pre></div>
  658. <p>Unfortunately, these chunks are incomplete JPEG images, because
  659. they lack the DHT segment required for decoding. Quoting from
  660. <a class="url" href="http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml">http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml</a>:
  661. </p>
  662. <p>Avery Lee, writing in the rec.video.desktop newsgroup in 2001,
  663. commented that &quot;MJPEG, or at least the MJPEG in AVIs having the
  664. MJPG fourcc, is restricted JPEG with a fixed &ndash; and *omitted* &ndash;
  665. Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2,
  666. and it must use basic Huffman encoding, not arithmetic or
  667. progressive. . . . You can indeed extract the MJPEG frames and
  668. decode them with a regular JPEG decoder, but you have to prepend
  669. the DHT segment to them, or else the decoder won&rsquo;t have any idea
  670. how to decompress the data. The exact table necessary is given in
  671. the OpenDML spec.&quot;
  672. </p>
  673. <p>This bitstream filter patches the header of frames extracted from an MJPEG
  674. stream (carrying the AVI1 header ID and lacking a DHT segment) to
  675. produce fully qualified JPEG images.
  676. </p>
  677. <div class="example">
  678. <pre class="example-preformatted">ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
  679. exiftran -i -9 frame*.jpg
  680. ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
  681. </pre></div>
  682. </div>
  683. <div class="section-level-extent" id="mjpegadump">
  684. <h3 class="section">2.18 mjpegadump</h3>
  685. <p>Add an MJPEG A header to the bitstream, to enable decoding by
  686. Quicktime.
  687. </p>
  688. <a class="anchor" id="mov2textsub"></a></div>
  689. <div class="section-level-extent" id="mov2textsub-1">
  690. <h3 class="section">2.19 mov2textsub</h3>
  691. <p>Extract a representable text file from MOV subtitles, stripping the
  692. metadata header from each subtitle packet.
  693. </p>
  694. <p>See also the <a class="ref" href="#text2movsub">text2movsub</a> filter.
  695. </p>
  696. </div>
  697. <div class="section-level-extent" id="mp3decomp">
  698. <h3 class="section">2.20 mp3decomp</h3>
  699. <p>Decompress non-standard compressed MP3 audio headers.
  700. </p>
  701. </div>
  702. <div class="section-level-extent" id="mpeg2_005fmetadata">
  703. <h3 class="section">2.21 mpeg2_metadata</h3>
  704. <p>Modify metadata embedded in an MPEG-2 stream.
  705. </p>
  706. <dl class="table">
  707. <dt><samp class="option">display_aspect_ratio</samp></dt>
  708. <dd><p>Set the display aspect ratio in the stream.
  709. </p>
  710. <p>The following fixed values are supported:
  711. </p><dl class="table">
  712. <dt><samp class="option">4/3</samp></dt>
  713. <dt><samp class="option">16/9</samp></dt>
  714. <dt><samp class="option">221/100</samp></dt>
  715. </dl>
  716. <p>Any other value will result in square pixels being signalled instead
  717. (see H.262 section 6.3.3 and table 6-3).
  718. </p>
  719. </dd>
  720. <dt><samp class="option">frame_rate</samp></dt>
  721. <dd><p>Set the frame rate in the stream. This is constructed from a table
  722. of known values combined with a small multiplier and divisor - if
  723. the supplied value is not exactly representable, the nearest
  724. representable value will be used instead (see H.262 section 6.3.3
  725. and table 6-4).
  726. </p>
  727. </dd>
  728. <dt><samp class="option">video_format</samp></dt>
  729. <dd><p>Set the video format in the stream (see H.262 section 6.3.6 and
  730. table 6-6).
  731. </p>
  732. </dd>
  733. <dt><samp class="option">colour_primaries</samp></dt>
  734. <dt><samp class="option">transfer_characteristics</samp></dt>
  735. <dt><samp class="option">matrix_coefficients</samp></dt>
  736. <dd><p>Set the colour description in the stream (see H.262 section 6.3.6
  737. and tables 6-7, 6-8 and 6-9).
  738. </p>
  739. </dd>
  740. </dl>
  741. </div>
  742. <div class="section-level-extent" id="mpeg4_005funpack_005fbframes">
  743. <h3 class="section">2.22 mpeg4_unpack_bframes</h3>
  744. <p>Unpack DivX-style packed B-frames.
  745. </p>
  746. <p>DivX-style packed B-frames are not valid MPEG-4 and were only a
  747. workaround for the broken Video for Windows subsystem.
  748. They use more space, can cause minor AV sync issues, require more
  749. CPU power to decode (unless the player has some decoded picture queue
  750. to compensate the 2,0,2,0 frame per packet style) and cause
  751. trouble if copied into a standard container like mp4 or mpeg-ps/ts,
  752. because MPEG-4 decoders may not be able to decode them, since they are
  753. not valid MPEG-4.
  754. </p>
  755. <p>For example to fix an AVI file containing an MPEG-4 stream with
  756. DivX-style packed B-frames using <code class="command">ffmpeg</code>, you can use the command:
  757. </p>
  758. <div class="example">
  759. <pre class="example-preformatted">ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi
  760. </pre></div>
  761. </div>
  762. <div class="section-level-extent" id="noise">
  763. <h3 class="section">2.23 noise</h3>
  764. <p>Damages the contents of packets or simply drops them without damaging the
  765. container. Can be used for fuzzing or testing error resilience/concealment.
  766. </p>
  767. <p>Parameters:
  768. </p><dl class="table">
  769. <dt><samp class="option">amount</samp></dt>
  770. <dd><p>Accepts an expression whose evaluation per-packet determines how often bytes in that
  771. packet will be modified. A value below 0 will result in a variable frequency.
  772. Default is 0 which results in no modification. However, if neither amount nor drop is specified,
  773. amount will be set to <var class="var">-1</var>. See below for accepted variables.
  774. </p></dd>
  775. <dt><samp class="option">drop</samp></dt>
  776. <dd><p>Accepts an expression evaluated per-packet whose value determines whether that packet is dropped.
  777. Evaluation to a positive value results in the packet being dropped. Evaluation to a negative
  778. value results in a variable chance of it being dropped, roughly inverse in proportion to the magnitude
  779. of the value. Default is 0 which results in no drops. See below for accepted variables.
  780. </p></dd>
  781. <dt><samp class="option">dropamount</samp></dt>
  782. <dd><p>Accepts a non-negative integer, which assigns a variable chance of it being dropped, roughly inverse
  783. in proportion to the value. Default is 0 which results in no drops. This option is kept for backwards
  784. compatibility and is equivalent to setting drop to a negative value with the same magnitude
  785. i.e. <code class="code">dropamount=4</code> is the same as <code class="code">drop=-4</code>. Ignored if drop is also specified.
  786. </p></dd>
  787. </dl>
  788. <p>Both <code class="code">amount</code> and <code class="code">drop</code> accept expressions containing the following variables:
  789. </p>
  790. <dl class="table">
  791. <dt>&lsquo;<samp class="samp">n</samp>&rsquo;</dt>
  792. <dd><p>The index of the packet, starting from zero.
  793. </p></dd>
  794. <dt>&lsquo;<samp class="samp">tb</samp>&rsquo;</dt>
  795. <dd><p>The timebase for packet timestamps.
  796. </p></dd>
  797. <dt>&lsquo;<samp class="samp">pts</samp>&rsquo;</dt>
  798. <dd><p>Packet presentation timestamp.
  799. </p></dd>
  800. <dt>&lsquo;<samp class="samp">dts</samp>&rsquo;</dt>
  801. <dd><p>Packet decoding timestamp.
  802. </p></dd>
  803. <dt>&lsquo;<samp class="samp">nopts</samp>&rsquo;</dt>
  804. <dd><p>Constant representing AV_NOPTS_VALUE.
  805. </p></dd>
  806. <dt>&lsquo;<samp class="samp">startpts</samp>&rsquo;</dt>
  807. <dd><p>First non-AV_NOPTS_VALUE PTS seen in the stream.
  808. </p></dd>
  809. <dt>&lsquo;<samp class="samp">startdts</samp>&rsquo;</dt>
  810. <dd><p>First non-AV_NOPTS_VALUE DTS seen in the stream.
  811. </p></dd>
  812. <dt>&lsquo;<samp class="samp">duration</samp>&rsquo;</dt>
  813. <dt>&lsquo;<samp class="samp">d</samp>&rsquo;</dt>
  814. <dd><p>Packet duration, in timebase units.
  815. </p></dd>
  816. <dt>&lsquo;<samp class="samp">pos</samp>&rsquo;</dt>
  817. <dd><p>Packet position in input; may be -1 when unknown or not set.
  818. </p></dd>
  819. <dt>&lsquo;<samp class="samp">size</samp>&rsquo;</dt>
  820. <dd><p>Packet size, in bytes.
  821. </p></dd>
  822. <dt>&lsquo;<samp class="samp">key</samp>&rsquo;</dt>
  823. <dd><p>Whether packet is marked as a keyframe.
  824. </p></dd>
  825. <dt>&lsquo;<samp class="samp">state</samp>&rsquo;</dt>
  826. <dd><p>A pseudo random integer, primarily derived from the content of packet payload.
  827. </p></dd>
  828. </dl>
  829. <ul class="mini-toc">
  830. <li><a href="#Examples" accesskey="1">Examples</a></li>
  831. </ul>
  832. <div class="subsection-level-extent" id="Examples">
  833. <h4 class="subsection">2.23.1 Examples</h4>
  834. <p>Apply modification to every byte but don&rsquo;t drop any packets.
  835. </p><div class="example">
  836. <pre class="example-preformatted">ffmpeg -i INPUT -c copy -bsf noise=1 output.mkv
  837. </pre></div>
  838. <p>Drop every video packet not marked as a keyframe after timestamp 30s but do not
  839. modify any of the remaining packets.
  840. </p><div class="example">
  841. <pre class="example-preformatted">ffmpeg -i INPUT -c copy -bsf:v noise=drop='gt(t\,30)*not(key)' output.mkv
  842. </pre></div>
  843. <p>Drop one second of audio every 10 seconds and add some random noise to the rest.
  844. </p><div class="example">
  845. <pre class="example-preformatted">ffmpeg -i INPUT -c copy -bsf:a noise=amount=-1:drop='between(mod(t\,10)\,9\,10)' output.mkv
  846. </pre></div>
  847. </div>
  848. </div>
  849. <div class="section-level-extent" id="null">
  850. <h3 class="section">2.24 null</h3>
  851. <p>This bitstream filter passes the packets through unchanged.
  852. </p>
  853. </div>
  854. <div class="section-level-extent" id="pcm_005frechunk">
  855. <h3 class="section">2.25 pcm_rechunk</h3>
  856. <p>Repacketize PCM audio to a fixed number of samples per packet or a fixed packet
  857. rate per second. This is similar to the <a data-manual="ffmpeg-filters" href="ffmpeg-filters.html#asetnsamples">(ffmpeg-filters)asetnsamples audio
  858. filter</a> but works on audio packets instead of audio frames.
  859. </p>
  860. <dl class="table">
  861. <dt><samp class="option">nb_out_samples, n</samp></dt>
  862. <dd><p>Set the number of samples per each output audio packet. The number is intended
  863. as the number of samples <em class="emph">per each channel</em>. Default value is 1024.
  864. </p>
  865. </dd>
  866. <dt><samp class="option">pad, p</samp></dt>
  867. <dd><p>If set to 1, the filter will pad the last audio packet with silence, so that it
  868. will contain the same number of samples (or roughly the same number of samples,
  869. see <samp class="option">frame_rate</samp>) as the previous ones. Default value is 1.
  870. </p>
  871. </dd>
  872. <dt><samp class="option">frame_rate, r</samp></dt>
  873. <dd><p>This option makes the filter output a fixed number of packets per second instead
  874. of a fixed number of samples per packet. If the audio sample rate is not
  875. divisible by the frame rate then the number of samples will not be constant but
  876. will vary slightly so that each packet will start as close to the frame
  877. boundary as possible. Using this option has precedence over <samp class="option">nb_out_samples</samp>.
  878. </p></dd>
  879. </dl>
  880. <p>You can generate the well known 1602-1601-1602-1601-1602 pattern of 48kHz audio
  881. for NTSC frame rate using the <samp class="option">frame_rate</samp> option.
  882. </p><div class="example">
  883. <pre class="example-preformatted">ffmpeg -f lavfi -i sine=r=48000:d=1 -c pcm_s16le -bsf pcm_rechunk=r=30000/1001 -f framecrc -
  884. </pre></div>
  885. </div>
  886. <div class="section-level-extent" id="pgs_005fframe_005fmerge">
  887. <h3 class="section">2.26 pgs_frame_merge</h3>
  888. <p>Merge a sequence of PGS Subtitle segments ending with an &quot;end of display set&quot;
  889. segment into a single packet.
  890. </p>
  891. <p>This is required by some containers that support PGS subtitles
  892. (muxer <code class="code">matroska</code>).
  893. </p>
  894. </div>
  895. <div class="section-level-extent" id="prores_005fmetadata">
  896. <h3 class="section">2.27 prores_metadata</h3>
  897. <p>Modify color property metadata embedded in prores stream.
  898. </p>
  899. <dl class="table">
  900. <dt><samp class="option">color_primaries</samp></dt>
  901. <dd><p>Set the color primaries.
  902. Available values are:
  903. </p>
  904. <dl class="table">
  905. <dt>&lsquo;<samp class="samp">auto</samp>&rsquo;</dt>
  906. <dd><p>Keep the same color primaries property (default).
  907. </p>
  908. </dd>
  909. <dt>&lsquo;<samp class="samp">unknown</samp>&rsquo;</dt>
  910. <dt>&lsquo;<samp class="samp">bt709</samp>&rsquo;</dt>
  911. <dt>&lsquo;<samp class="samp">bt470bg</samp>&rsquo;</dt>
  912. <dd><p>BT601 625
  913. </p>
  914. </dd>
  915. <dt>&lsquo;<samp class="samp">smpte170m</samp>&rsquo;</dt>
  916. <dd><p>BT601 525
  917. </p>
  918. </dd>
  919. <dt>&lsquo;<samp class="samp">bt2020</samp>&rsquo;</dt>
  920. <dt>&lsquo;<samp class="samp">smpte431</samp>&rsquo;</dt>
  921. <dd><p>DCI P3
  922. </p>
  923. </dd>
  924. <dt>&lsquo;<samp class="samp">smpte432</samp>&rsquo;</dt>
  925. <dd><p>P3 D65
  926. </p>
  927. </dd>
  928. </dl>
  929. </dd>
  930. <dt><samp class="option">transfer_characteristics</samp></dt>
  931. <dd><p>Set the color transfer.
  932. Available values are:
  933. </p>
  934. <dl class="table">
  935. <dt>&lsquo;<samp class="samp">auto</samp>&rsquo;</dt>
  936. <dd><p>Keep the same transfer characteristics property (default).
  937. </p>
  938. </dd>
  939. <dt>&lsquo;<samp class="samp">unknown</samp>&rsquo;</dt>
  940. <dt>&lsquo;<samp class="samp">bt709</samp>&rsquo;</dt>
  941. <dd><p>BT 601, BT 709, BT 2020
  942. </p></dd>
  943. <dt>&lsquo;<samp class="samp">smpte2084</samp>&rsquo;</dt>
  944. <dd><p>SMPTE ST 2084
  945. </p></dd>
  946. <dt>&lsquo;<samp class="samp">arib-std-b67</samp>&rsquo;</dt>
  947. <dd><p>ARIB STD-B67
  948. </p></dd>
  949. </dl>
  950. </dd>
  951. <dt><samp class="option">matrix_coefficients</samp></dt>
  952. <dd><p>Set the matrix coefficient.
  953. Available values are:
  954. </p>
  955. <dl class="table">
  956. <dt>&lsquo;<samp class="samp">auto</samp>&rsquo;</dt>
  957. <dd><p>Keep the same colorspace property (default).
  958. </p>
  959. </dd>
  960. <dt>&lsquo;<samp class="samp">unknown</samp>&rsquo;</dt>
  961. <dt>&lsquo;<samp class="samp">bt709</samp>&rsquo;</dt>
  962. <dt>&lsquo;<samp class="samp">smpte170m</samp>&rsquo;</dt>
  963. <dd><p>BT 601
  964. </p>
  965. </dd>
  966. <dt>&lsquo;<samp class="samp">bt2020nc</samp>&rsquo;</dt>
  967. </dl>
  968. </dd>
  969. </dl>
  970. <p>Set Rec709 colorspace for each frame of the file
  971. </p><div class="example">
  972. <pre class="example-preformatted">ffmpeg -i INPUT -c copy -bsf:v prores_metadata=color_primaries=bt709:color_trc=bt709:colorspace=bt709 output.mov
  973. </pre></div>
  974. <p>Set Hybrid Log-Gamma parameters for each frame of the file
  975. </p><div class="example">
  976. <pre class="example-preformatted">ffmpeg -i INPUT -c copy -bsf:v prores_metadata=color_primaries=bt2020:color_trc=arib-std-b67:colorspace=bt2020nc output.mov
  977. </pre></div>
  978. </div>
  979. <div class="section-level-extent" id="remove_005fextra">
  980. <h3 class="section">2.28 remove_extra</h3>
  981. <p>Remove extradata from packets.
  982. </p>
  983. <p>It accepts the following parameter:
  984. </p><dl class="table">
  985. <dt><samp class="option">freq</samp></dt>
  986. <dd><p>Set which frame types to remove extradata from.
  987. </p>
  988. <dl class="table">
  989. <dt>&lsquo;<samp class="samp">k</samp>&rsquo;</dt>
  990. <dd><p>Remove extradata from non-keyframes only.
  991. </p>
  992. </dd>
  993. <dt>&lsquo;<samp class="samp">keyframe</samp>&rsquo;</dt>
  994. <dd><p>Remove extradata from keyframes only.
  995. </p>
  996. </dd>
  997. <dt>&lsquo;<samp class="samp">e, all</samp>&rsquo;</dt>
  998. <dd><p>Remove extradata from all frames.
  999. </p>
  1000. </dd>
  1001. </dl>
  1002. </dd>
  1003. </dl>
  1004. </div>
  1005. <div class="section-level-extent" id="setts">
  1006. <h3 class="section">2.29 setts</h3>
  1007. <p>Set PTS and DTS in packets.
  1008. </p>
  1009. <p>It accepts the following parameters:
  1010. </p><dl class="table">
  1011. <dt><samp class="option">ts</samp></dt>
  1012. <dt><samp class="option">pts</samp></dt>
  1013. <dt><samp class="option">dts</samp></dt>
  1014. <dd><p>Set expressions for PTS, DTS or both.
  1015. </p></dd>
  1016. <dt><samp class="option">duration</samp></dt>
  1017. <dd><p>Set expression for duration.
  1018. </p></dd>
  1019. <dt><samp class="option">time_base</samp></dt>
  1020. <dd><p>Set output time base.
  1021. </p></dd>
  1022. </dl>
  1023. <p>The expressions are evaluated through the eval API and can contain the following
  1024. constants:
  1025. </p>
  1026. <dl class="table">
  1027. <dt><samp class="option">N</samp></dt>
  1028. <dd><p>The count of the input packet. Starting from 0.
  1029. </p>
  1030. </dd>
  1031. <dt><samp class="option">TS</samp></dt>
  1032. <dd><p>The demux timestamp in input in case of <code class="code">ts</code> or <code class="code">dts</code> option or presentation
  1033. timestamp in case of <code class="code">pts</code> option.
  1034. </p>
  1035. </dd>
  1036. <dt><samp class="option">POS</samp></dt>
  1037. <dd><p>The original position in the file of the packet, or undefined if undefined
  1038. for the current packet
  1039. </p>
  1040. </dd>
  1041. <dt><samp class="option">DTS</samp></dt>
  1042. <dd><p>The demux timestamp in input.
  1043. </p>
  1044. </dd>
  1045. <dt><samp class="option">PTS</samp></dt>
  1046. <dd><p>The presentation timestamp in input.
  1047. </p>
  1048. </dd>
  1049. <dt><samp class="option">DURATION</samp></dt>
  1050. <dd><p>The duration in input.
  1051. </p>
  1052. </dd>
  1053. <dt><samp class="option">STARTDTS</samp></dt>
  1054. <dd><p>The DTS of the first packet.
  1055. </p>
  1056. </dd>
  1057. <dt><samp class="option">STARTPTS</samp></dt>
  1058. <dd><p>The PTS of the first packet.
  1059. </p>
  1060. </dd>
  1061. <dt><samp class="option">PREV_INDTS</samp></dt>
  1062. <dd><p>The previous input DTS.
  1063. </p>
  1064. </dd>
  1065. <dt><samp class="option">PREV_INPTS</samp></dt>
  1066. <dd><p>The previous input PTS.
  1067. </p>
  1068. </dd>
  1069. <dt><samp class="option">PREV_INDURATION</samp></dt>
  1070. <dd><p>The previous input duration.
  1071. </p>
  1072. </dd>
  1073. <dt><samp class="option">PREV_OUTDTS</samp></dt>
  1074. <dd><p>The previous output DTS.
  1075. </p>
  1076. </dd>
  1077. <dt><samp class="option">PREV_OUTPTS</samp></dt>
  1078. <dd><p>The previous output PTS.
  1079. </p>
  1080. </dd>
  1081. <dt><samp class="option">PREV_OUTDURATION</samp></dt>
  1082. <dd><p>The previous output duration.
  1083. </p>
  1084. </dd>
  1085. <dt><samp class="option">NEXT_DTS</samp></dt>
  1086. <dd><p>The next input DTS.
  1087. </p>
  1088. </dd>
  1089. <dt><samp class="option">NEXT_PTS</samp></dt>
  1090. <dd><p>The next input PTS.
  1091. </p>
  1092. </dd>
  1093. <dt><samp class="option">NEXT_DURATION</samp></dt>
  1094. <dd><p>The next input duration.
  1095. </p>
  1096. </dd>
  1097. <dt><samp class="option">TB</samp></dt>
  1098. <dd><p>The timebase of stream packet belongs.
  1099. </p>
  1100. </dd>
  1101. <dt><samp class="option">TB_OUT</samp></dt>
  1102. <dd><p>The output timebase.
  1103. </p>
  1104. </dd>
  1105. <dt><samp class="option">SR</samp></dt>
  1106. <dd><p>The sample rate of stream packet belongs.
  1107. </p>
  1108. </dd>
  1109. <dt><samp class="option">NOPTS</samp></dt>
  1110. <dd><p>The AV_NOPTS_VALUE constant.
  1111. </p></dd>
  1112. </dl>
  1113. <a class="anchor" id="text2movsub"></a></div>
  1114. <div class="section-level-extent" id="text2movsub-1">
  1115. <h3 class="section">2.30 text2movsub</h3>
  1116. <p>Convert text subtitles to MOV subtitles (as used by the <code class="code">mov_text</code>
  1117. codec) with metadata headers.
  1118. </p>
  1119. <p>See also the <a class="ref" href="#mov2textsub">mov2textsub</a> filter.
  1120. </p>
  1121. </div>
  1122. <div class="section-level-extent" id="trace_005fheaders">
  1123. <h3 class="section">2.31 trace_headers</h3>
  1124. <p>Log trace output containing all syntax elements in the coded stream
  1125. headers (everything above the level of individual coded blocks).
  1126. This can be useful for debugging low-level stream issues.
  1127. </p>
  1128. <p>Supports AV1, H.264, H.265, (M)JPEG, MPEG-2 and VP9, but depending
  1129. on the build only a subset of these may be available.
  1130. </p>
  1131. </div>
  1132. <div class="section-level-extent" id="truehd_005fcore">
  1133. <h3 class="section">2.32 truehd_core</h3>
  1134. <p>Extract the core from a TrueHD stream, dropping ATMOS data.
  1135. </p>
  1136. </div>
  1137. <div class="section-level-extent" id="vp9_005fmetadata">
  1138. <h3 class="section">2.33 vp9_metadata</h3>
  1139. <p>Modify metadata embedded in a VP9 stream.
  1140. </p>
  1141. <dl class="table">
  1142. <dt><samp class="option">color_space</samp></dt>
  1143. <dd><p>Set the color space value in the frame header. Note that any frame
  1144. set to RGB will be implicitly set to PC range and that RGB is
  1145. incompatible with profiles 0 and 2.
  1146. </p><dl class="table">
  1147. <dt>&lsquo;<samp class="samp">unknown</samp>&rsquo;</dt>
  1148. <dt>&lsquo;<samp class="samp">bt601</samp>&rsquo;</dt>
  1149. <dt>&lsquo;<samp class="samp">bt709</samp>&rsquo;</dt>
  1150. <dt>&lsquo;<samp class="samp">smpte170</samp>&rsquo;</dt>
  1151. <dt>&lsquo;<samp class="samp">smpte240</samp>&rsquo;</dt>
  1152. <dt>&lsquo;<samp class="samp">bt2020</samp>&rsquo;</dt>
  1153. <dt>&lsquo;<samp class="samp">rgb</samp>&rsquo;</dt>
  1154. </dl>
  1155. </dd>
  1156. <dt><samp class="option">color_range</samp></dt>
  1157. <dd><p>Set the color range value in the frame header. Note that any value
  1158. imposed by the color space will take precedence over this value.
  1159. </p><dl class="table">
  1160. <dt>&lsquo;<samp class="samp">tv</samp>&rsquo;</dt>
  1161. <dt>&lsquo;<samp class="samp">pc</samp>&rsquo;</dt>
  1162. </dl>
  1163. </dd>
  1164. </dl>
  1165. </div>
  1166. <div class="section-level-extent" id="vp9_005fsuperframe">
  1167. <h3 class="section">2.34 vp9_superframe</h3>
  1168. <p>Merge VP9 invisible (alt-ref) frames back into VP9 superframes. This
  1169. fixes merging of split/segmented VP9 streams where the alt-ref frame
  1170. was split from its visible counterpart.
  1171. </p>
  1172. </div>
  1173. <div class="section-level-extent" id="vp9_005fsuperframe_005fsplit">
  1174. <h3 class="section">2.35 vp9_superframe_split</h3>
  1175. <p>Split VP9 superframes into single frames.
  1176. </p>
  1177. </div>
  1178. <div class="section-level-extent" id="vp9_005fraw_005freorder">
  1179. <h3 class="section">2.36 vp9_raw_reorder</h3>
  1180. <p>Given a VP9 stream with correct timestamps but possibly out of order,
  1181. insert additional show-existing-frame packets to correct the ordering.
  1182. </p>
  1183. </div>
  1184. </div>
  1185. <div class="chapter-level-extent" id="See-Also">
  1186. <h2 class="chapter">3 See Also</h2>
  1187. <p><a class="url" href="ffmpeg.html">ffmpeg</a>, <a class="url" href="ffplay.html">ffplay</a>, <a class="url" href="ffprobe.html">ffprobe</a>,
  1188. <a class="url" href="libavcodec.html">libavcodec</a>
  1189. </p>
  1190. </div>
  1191. <div class="chapter-level-extent" id="Authors">
  1192. <h2 class="chapter">4 Authors</h2>
  1193. <p>The FFmpeg developers.
  1194. </p>
  1195. <p>For details about the authorship, see the Git history of the project
  1196. (https://git.ffmpeg.org/ffmpeg), e.g. by typing the command
  1197. <code class="command">git log</code> in the FFmpeg source directory, or browsing the
  1198. online repository at <a class="url" href="https://git.ffmpeg.org/ffmpeg">https://git.ffmpeg.org/ffmpeg</a>.
  1199. </p>
  1200. <p>Maintainers for the specific components are listed in the file
  1201. <samp class="file">MAINTAINERS</samp> in the source code tree.
  1202. </p>
  1203. </div>
  1204. </div>
  1205. <p style="font-size: small;">
  1206. This document was generated using <a class="uref" href="https://www.gnu.org/software/texinfo/"><em class="emph">makeinfo</em></a>.
  1207. </p>
  1208. </div>
  1209. </body>
  1210. </html>