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

2426 lines
67KB

  1. @chapter Filtergraph description
  2. @c man begin FILTERGRAPH DESCRIPTION
  3. A filtergraph is a directed graph of connected filters. It can contain
  4. cycles, and there can be multiple links between a pair of
  5. filters. Each link has one input pad on one side connecting it to one
  6. filter from which it takes its input, and one output pad on the other
  7. side connecting it to the one filter accepting its output.
  8. Each filter in a filtergraph is an instance of a filter class
  9. registered in the application, which defines the features and the
  10. number of input and output pads of the filter.
  11. A filter with no input pads is called a "source", a filter with no
  12. output pads is called a "sink".
  13. @section Filtergraph syntax
  14. A filtergraph can be represented using a textual representation, which
  15. is recognized by the @code{-vf} and @code{-af} options of the ff*
  16. tools, and by the @code{avfilter_graph_parse()} function defined in
  17. @file{libavfilter/avfiltergraph.h}.
  18. A filterchain consists of a sequence of connected filters, each one
  19. connected to the previous one in the sequence. A filterchain is
  20. represented by a list of ","-separated filter descriptions.
  21. A filtergraph consists of a sequence of filterchains. A sequence of
  22. filterchains is represented by a list of ";"-separated filterchain
  23. descriptions.
  24. A filter is represented by a string of the form:
  25. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  26. @var{filter_name} is the name of the filter class of which the
  27. described filter is an instance of, and has to be the name of one of
  28. the filter classes registered in the program.
  29. The name of the filter class is optionally followed by a string
  30. "=@var{arguments}".
  31. @var{arguments} is a string which contains the parameters used to
  32. initialize the filter instance, and are described in the filter
  33. descriptions below.
  34. The list of arguments can be quoted using the character "'" as initial
  35. and ending mark, and the character '\' for escaping the characters
  36. within the quoted text; otherwise the argument string is considered
  37. terminated when the next special character (belonging to the set
  38. "[]=;,") is encountered.
  39. The name and arguments of the filter are optionally preceded and
  40. followed by a list of link labels.
  41. A link label allows to name a link and associate it to a filter output
  42. or input pad. The preceding labels @var{in_link_1}
  43. ... @var{in_link_N}, are associated to the filter input pads,
  44. the following labels @var{out_link_1} ... @var{out_link_M}, are
  45. associated to the output pads.
  46. When two link labels with the same name are found in the
  47. filtergraph, a link between the corresponding input and output pad is
  48. created.
  49. If an output pad is not labelled, it is linked by default to the first
  50. unlabelled input pad of the next filter in the filterchain.
  51. For example in the filterchain:
  52. @example
  53. nullsrc, split[L1], [L2]overlay, nullsink
  54. @end example
  55. the split filter instance has two output pads, and the overlay filter
  56. instance two input pads. The first output pad of split is labelled
  57. "L1", the first input pad of overlay is labelled "L2", and the second
  58. output pad of split is linked to the second input pad of overlay,
  59. which are both unlabelled.
  60. In a complete filterchain all the unlabelled filter input and output
  61. pads must be connected. A filtergraph is considered valid if all the
  62. filter input and output pads of all the filterchains are connected.
  63. Follows a BNF description for the filtergraph syntax:
  64. @example
  65. @var{NAME} ::= sequence of alphanumeric characters and '_'
  66. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  67. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  68. @var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
  69. @var{FILTER} ::= [@var{LINKNAMES}] @var{NAME} ["=" @var{ARGUMENTS}] [@var{LINKNAMES}]
  70. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  71. @var{FILTERGRAPH} ::= @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  72. @end example
  73. @c man end FILTERGRAPH DESCRIPTION
  74. @chapter Audio Filters
  75. @c man begin AUDIO FILTERS
  76. When you configure your FFmpeg build, you can disable any of the
  77. existing filters using --disable-filters.
  78. The configure output will show the audio filters included in your
  79. build.
  80. Below is a description of the currently available audio filters.
  81. @section aformat
  82. Convert the input audio to one of the specified formats. The framework will
  83. negotiate the most appropriate format to minimize conversions.
  84. The filter accepts three lists of formats, separated by ":", in the form:
  85. "@var{sample_formats}:@var{channel_layouts}:@var{packing_formats}".
  86. Elements in each list are separated by "," which has to be escaped in the
  87. filtergraph specification.
  88. The special parameter "all", in place of a list of elements, signifies all
  89. supported formats.
  90. Some examples follow:
  91. @example
  92. aformat=u8\\,s16:mono:packed
  93. aformat=s16:mono\\,stereo:all
  94. @end example
  95. @section anull
  96. Pass the audio source unchanged to the output.
  97. @section aresample
  98. Resample the input audio to the specified sample rate.
  99. The filter accepts exactly one parameter, the output sample rate. If not
  100. specified then the filter will automatically convert between its input
  101. and output sample rates.
  102. For example, to resample the input audio to 44100Hz:
  103. @example
  104. aresample=44100
  105. @end example
  106. @section ashowinfo
  107. Show a line containing various information for each input audio frame.
  108. The input audio is not modified.
  109. The shown line contains a sequence of key/value pairs of the form
  110. @var{key}:@var{value}.
  111. A description of each shown parameter follows:
  112. @table @option
  113. @item n
  114. sequential number of the input frame, starting from 0
  115. @item pts
  116. presentation TimeStamp of the input frame, expressed as a number of
  117. time base units. The time base unit depends on the filter input pad, and
  118. is usually 1/@var{sample_rate}.
  119. @item pts_time
  120. presentation TimeStamp of the input frame, expressed as a number of
  121. seconds
  122. @item pos
  123. position of the frame in the input stream, -1 if this information in
  124. unavailable and/or meanigless (for example in case of synthetic audio)
  125. @item fmt
  126. sample format name
  127. @item chlayout
  128. channel layout description
  129. @item nb_samples
  130. number of samples (per each channel) contained in the filtered frame
  131. @item rate
  132. sample rate for the audio frame
  133. @item planar
  134. if the packing format is planar, 0 if packed
  135. @item checksum
  136. Adler-32 checksum of all the planes of the input frame
  137. @item plane_checksum
  138. Adler-32 checksum for each input frame plane, expressed in the form
  139. "[@var{c0} @var{c1} @var{c2} @var{c3} @var{c4} @var{c5} @var{c6} @var{c7}]"
  140. @end table
  141. @c man end AUDIO FILTERS
  142. @chapter Audio Sources
  143. @c man begin AUDIO SOURCES
  144. Below is a description of the currently available audio sources.
  145. @section abuffer
  146. Buffer audio frames, and make them available to the filter chain.
  147. This source is mainly intended for a programmatic use, in particular
  148. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  149. It accepts the following mandatory parameters:
  150. @var{sample_rate}:@var{sample_fmt}:@var{channel_layout}:@var{packing}
  151. @table @option
  152. @item sample_rate
  153. The sample rate of the incoming audio buffers.
  154. @item sample_fmt
  155. The sample format of the incoming audio buffers.
  156. Either a sample format name or its corresponging integer representation from
  157. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  158. @item channel_layout
  159. The channel layout of the incoming audio buffers.
  160. Either a channel layout name from channel_layout_map in
  161. @file{libavutil/audioconvert.c} or its corresponding integer representation
  162. from the AV_CH_LAYOUT_* macros in @file{libavutil/audioconvert.h}
  163. @item packing
  164. Either "packed" or "planar", or their integer representation: 0 or 1
  165. respectively.
  166. @end table
  167. For example:
  168. @example
  169. abuffer=44100:s16:stereo:planar
  170. @end example
  171. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  172. Since the sample format with name "s16" corresponds to the number
  173. 1 and the "stereo" channel layout corresponds to the value 3, this is
  174. equivalent to:
  175. @example
  176. abuffer=44100:1:3:1
  177. @end example
  178. @section amovie
  179. Read an audio stream from a movie container.
  180. It accepts the syntax: @var{movie_name}[:@var{options}] where
  181. @var{movie_name} is the name of the resource to read (not necessarily
  182. a file but also a device or a stream accessed through some protocol),
  183. and @var{options} is an optional sequence of @var{key}=@var{value}
  184. pairs, separated by ":".
  185. The description of the accepted options follows.
  186. @table @option
  187. @item format_name, f
  188. Specify the format assumed for the movie to read, and can be either
  189. the name of a container or an input device. If not specified the
  190. format is guessed from @var{movie_name} or by probing.
  191. @item seek_point, sp
  192. Specify the seek point in seconds, the frames will be output
  193. starting from this seek point, the parameter is evaluated with
  194. @code{av_strtod} so the numerical value may be suffixed by an IS
  195. postfix. Default value is "0".
  196. @item stream_index, si
  197. Specify the index of the audio stream to read. If the value is -1,
  198. the best suited audio stream will be automatically selected. Default
  199. value is "-1".
  200. @end table
  201. @section anullsrc
  202. Null audio source, never return audio frames. It is mainly useful as a
  203. template and to be employed in analysis / debugging tools.
  204. It accepts as optional parameter a string of the form
  205. @var{sample_rate}:@var{channel_layout}.
  206. @var{sample_rate} specify the sample rate, and defaults to 44100.
  207. @var{channel_layout} specify the channel layout, and can be either an
  208. integer or a string representing a channel layout. The default value
  209. of @var{channel_layout} is 3, which corresponds to CH_LAYOUT_STEREO.
  210. Check the channel_layout_map definition in
  211. @file{libavcodec/audioconvert.c} for the mapping between strings and
  212. channel layout values.
  213. Follow some examples:
  214. @example
  215. # set the sample rate to 48000 Hz and the channel layout to CH_LAYOUT_MONO.
  216. anullsrc=48000:4
  217. # same as
  218. anullsrc=48000:mono
  219. @end example
  220. @c man end AUDIO SOURCES
  221. @chapter Audio Sinks
  222. @c man begin AUDIO SINKS
  223. Below is a description of the currently available audio sinks.
  224. @section abuffersink
  225. Buffer audio frames, and make them available to the end of filter chain.
  226. This sink is mainly intended for programmatic use, in particular
  227. through the interface defined in @file{libavfilter/buffersink.h}.
  228. It requires a pointer to an AVABufferSinkContext structure, which
  229. defines the incoming buffers' formats, to be passed as the opaque
  230. parameter to @code{avfilter_init_filter} for initialization.
  231. @section anullsink
  232. Null audio sink, do absolutely nothing with the input audio. It is
  233. mainly useful as a template and to be employed in analysis / debugging
  234. tools.
  235. @c man end AUDIO SINKS
  236. @chapter Video Filters
  237. @c man begin VIDEO FILTERS
  238. When you configure your FFmpeg build, you can disable any of the
  239. existing filters using --disable-filters.
  240. The configure output will show the video filters included in your
  241. build.
  242. Below is a description of the currently available video filters.
  243. @section blackframe
  244. Detect frames that are (almost) completely black. Can be useful to
  245. detect chapter transitions or commercials. Output lines consist of
  246. the frame number of the detected frame, the percentage of blackness,
  247. the position in the file if known or -1 and the timestamp in seconds.
  248. In order to display the output lines, you need to set the loglevel at
  249. least to the AV_LOG_INFO value.
  250. The filter accepts the syntax:
  251. @example
  252. blackframe[=@var{amount}:[@var{threshold}]]
  253. @end example
  254. @var{amount} is the percentage of the pixels that have to be below the
  255. threshold, and defaults to 98.
  256. @var{threshold} is the threshold below which a pixel value is
  257. considered black, and defaults to 32.
  258. @section boxblur
  259. Apply boxblur algorithm to the input video.
  260. This filter accepts the parameters:
  261. @var{luma_radius}:@var{luma_power}:@var{chroma_radius}:@var{chroma_power}:@var{alpha_radius}:@var{alpha_power}
  262. Chroma and alpha parameters are optional, if not specified they default
  263. to the corresponding values set for @var{luma_radius} and
  264. @var{luma_power}.
  265. @var{luma_radius}, @var{chroma_radius}, and @var{alpha_radius} represent
  266. the radius in pixels of the box used for blurring the corresponding
  267. input plane. They are expressions, and can contain the following
  268. constants:
  269. @table @option
  270. @item w, h
  271. the input width and heigth in pixels
  272. @item cw, ch
  273. the input chroma image width and height in pixels
  274. @item hsub, vsub
  275. horizontal and vertical chroma subsample values. For example for the
  276. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  277. @end table
  278. The radius must be a non-negative number, and must be not greater than
  279. the value of the expression @code{min(w,h)/2} for the luma and alpha planes,
  280. and of @code{min(cw,ch)/2} for the chroma planes.
  281. @var{luma_power}, @var{chroma_power}, and @var{alpha_power} represent
  282. how many times the boxblur filter is applied to the corresponding
  283. plane.
  284. Some examples follow:
  285. @itemize
  286. @item
  287. Apply a boxblur filter with luma, chroma, and alpha radius
  288. set to 2:
  289. @example
  290. boxblur=2:1
  291. @end example
  292. @item
  293. Set luma radius to 2, alpha and chroma radius to 0
  294. @example
  295. boxblur=2:1:0:0:0:0
  296. @end example
  297. @item
  298. Set luma and chroma radius to a fraction of the video dimension
  299. @example
  300. boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
  301. @end example
  302. @end itemize
  303. @section copy
  304. Copy the input source unchanged to the output. Mainly useful for
  305. testing purposes.
  306. @section crop
  307. Crop the input video to @var{out_w}:@var{out_h}:@var{x}:@var{y}.
  308. The parameters are expressions containing the following constants:
  309. @table @option
  310. @item E, PI, PHI
  311. the corresponding mathematical approximated values for e
  312. (euler number), pi (greek PI), PHI (golden ratio)
  313. @item x, y
  314. the computed values for @var{x} and @var{y}. They are evaluated for
  315. each new frame.
  316. @item in_w, in_h
  317. the input width and heigth
  318. @item iw, ih
  319. same as @var{in_w} and @var{in_h}
  320. @item out_w, out_h
  321. the output (cropped) width and heigth
  322. @item ow, oh
  323. same as @var{out_w} and @var{out_h}
  324. @item a
  325. same as @var{iw} / @var{ih}
  326. @item sar
  327. input sample aspect ratio
  328. @item dar
  329. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  330. @item hsub, vsub
  331. horizontal and vertical chroma subsample values. For example for the
  332. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  333. @item n
  334. the number of input frame, starting from 0
  335. @item pos
  336. the position in the file of the input frame, NAN if unknown
  337. @item t
  338. timestamp expressed in seconds, NAN if the input timestamp is unknown
  339. @end table
  340. The @var{out_w} and @var{out_h} parameters specify the expressions for
  341. the width and height of the output (cropped) video. They are
  342. evaluated just at the configuration of the filter.
  343. The default value of @var{out_w} is "in_w", and the default value of
  344. @var{out_h} is "in_h".
  345. The expression for @var{out_w} may depend on the value of @var{out_h},
  346. and the expression for @var{out_h} may depend on @var{out_w}, but they
  347. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  348. evaluated after @var{out_w} and @var{out_h}.
  349. The @var{x} and @var{y} parameters specify the expressions for the
  350. position of the top-left corner of the output (non-cropped) area. They
  351. are evaluated for each frame. If the evaluated value is not valid, it
  352. is approximated to the nearest valid value.
  353. The default value of @var{x} is "(in_w-out_w)/2", and the default
  354. value for @var{y} is "(in_h-out_h)/2", which set the cropped area at
  355. the center of the input image.
  356. The expression for @var{x} may depend on @var{y}, and the expression
  357. for @var{y} may depend on @var{x}.
  358. Follow some examples:
  359. @example
  360. # crop the central input area with size 100x100
  361. crop=100:100
  362. # crop the central input area with size 2/3 of the input video
  363. "crop=2/3*in_w:2/3*in_h"
  364. # crop the input video central square
  365. crop=in_h
  366. # delimit the rectangle with the top-left corner placed at position
  367. # 100:100 and the right-bottom corner corresponding to the right-bottom
  368. # corner of the input image.
  369. crop=in_w-100:in_h-100:100:100
  370. # crop 10 pixels from the left and right borders, and 20 pixels from
  371. # the top and bottom borders
  372. "crop=in_w-2*10:in_h-2*20"
  373. # keep only the bottom right quarter of the input image
  374. "crop=in_w/2:in_h/2:in_w/2:in_h/2"
  375. # crop height for getting Greek harmony
  376. "crop=in_w:1/PHI*in_w"
  377. # trembling effect
  378. "crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)"
  379. # erratic camera effect depending on timestamp
  380. "crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
  381. # set x depending on the value of y
  382. "crop=in_w/2:in_h/2:y:10+10*sin(n/10)"
  383. @end example
  384. @section cropdetect
  385. Auto-detect crop size.
  386. Calculate necessary cropping parameters and prints the recommended
  387. parameters through the logging system. The detected dimensions
  388. correspond to the non-black area of the input video.
  389. It accepts the syntax:
  390. @example
  391. cropdetect[=@var{limit}[:@var{round}[:@var{reset}]]]
  392. @end example
  393. @table @option
  394. @item limit
  395. Threshold, which can be optionally specified from nothing (0) to
  396. everything (255), defaults to 24.
  397. @item round
  398. Value which the width/height should be divisible by, defaults to
  399. 16. The offset is automatically adjusted to center the video. Use 2 to
  400. get only even dimensions (needed for 4:2:2 video). 16 is best when
  401. encoding to most video codecs.
  402. @item reset
  403. Counter that determines after how many frames cropdetect will reset
  404. the previously detected largest video area and start over to detect
  405. the current optimal crop area. Defaults to 0.
  406. This can be useful when channel logos distort the video area. 0
  407. indicates never reset and return the largest area encountered during
  408. playback.
  409. @end table
  410. @section delogo
  411. Suppress a TV station logo by a simple interpolation of the surrounding
  412. pixels. Just set a rectangle covering the logo and watch it disappear
  413. (and sometimes something even uglier appear - your mileage may vary).
  414. The filter accepts parameters as a string of the form
  415. "@var{x}:@var{y}:@var{w}:@var{h}:@var{band}", or as a list of
  416. @var{key}=@var{value} pairs, separated by ":".
  417. The description of the accepted parameters follows.
  418. @table @option
  419. @item x, y
  420. Specify the top left corner coordinates of the logo. They must be
  421. specified.
  422. @item w, h
  423. Specify the width and height of the logo to clear. They must be
  424. specified.
  425. @item band, t
  426. Specify the thickness of the fuzzy edge of the rectangle (added to
  427. @var{w} and @var{h}). The default value is 4.
  428. @item show
  429. When set to 1, a green rectangle is drawn on the screen to simplify
  430. finding the right @var{x}, @var{y}, @var{w}, @var{h} parameters, and
  431. @var{band} is set to 4. The default value is 0.
  432. @end table
  433. Some examples follow.
  434. @itemize
  435. @item
  436. Set a rectangle covering the area with top left corner coordinates 0,0
  437. and size 100x77, setting a band of size 10:
  438. @example
  439. delogo=0:0:100:77:10
  440. @end example
  441. @item
  442. As the previous example, but use named options:
  443. @example
  444. delogo=x=0:y=0:w=100:h=77:band=10
  445. @end example
  446. @end itemize
  447. @section drawbox
  448. Draw a colored box on the input image.
  449. It accepts the syntax:
  450. @example
  451. drawbox=@var{x}:@var{y}:@var{width}:@var{height}:@var{color}
  452. @end example
  453. @table @option
  454. @item x, y
  455. Specify the top left corner coordinates of the box. Default to 0.
  456. @item width, height
  457. Specify the width and height of the box, if 0 they are interpreted as
  458. the input width and height. Default to 0.
  459. @item color
  460. Specify the color of the box to write, it can be the name of a color
  461. (case insensitive match) or a 0xRRGGBB[AA] sequence.
  462. @end table
  463. Follow some examples:
  464. @example
  465. # draw a black box around the edge of the input image
  466. drawbox
  467. # draw a box with color red and an opacity of 50%
  468. drawbox=10:20:200:60:red@@0.5"
  469. @end example
  470. @section drawtext
  471. Draw text string or text from specified file on top of video using the
  472. libfreetype library.
  473. To enable compilation of this filter you need to configure FFmpeg with
  474. @code{--enable-libfreetype}.
  475. The filter also recognizes strftime() sequences in the provided text
  476. and expands them accordingly. Check the documentation of strftime().
  477. The filter accepts parameters as a list of @var{key}=@var{value} pairs,
  478. separated by ":".
  479. The description of the accepted parameters follows.
  480. @table @option
  481. @item fontfile
  482. The font file to be used for drawing text. Path must be included.
  483. This parameter is mandatory.
  484. @item text
  485. The text string to be drawn. The text must be a sequence of UTF-8
  486. encoded characters.
  487. This parameter is mandatory if no file is specified with the parameter
  488. @var{textfile}.
  489. @item textfile
  490. A text file containing text to be drawn. The text must be a sequence
  491. of UTF-8 encoded characters.
  492. This parameter is mandatory if no text string is specified with the
  493. parameter @var{text}.
  494. If both text and textfile are specified, an error is thrown.
  495. @item x, y
  496. The offsets where text will be drawn within the video frame.
  497. Relative to the top/left border of the output image.
  498. The default value of @var{x} and @var{y} is 0.
  499. @item fontsize
  500. The font size to be used for drawing text.
  501. The default value of @var{fontsize} is 16.
  502. @item fontcolor
  503. The color to be used for drawing fonts.
  504. Either a string (e.g. "red") or in 0xRRGGBB[AA] format
  505. (e.g. "0xff000033"), possibly followed by an alpha specifier.
  506. The default value of @var{fontcolor} is "black".
  507. @item boxcolor
  508. The color to be used for drawing box around text.
  509. Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
  510. (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  511. The default value of @var{boxcolor} is "white".
  512. @item box
  513. Used to draw a box around text using background color.
  514. Value should be either 1 (enable) or 0 (disable).
  515. The default value of @var{box} is 0.
  516. @item shadowx, shadowy
  517. The x and y offsets for the text shadow position with respect to the
  518. position of the text. They can be either positive or negative
  519. values. Default value for both is "0".
  520. @item shadowcolor
  521. The color to be used for drawing a shadow behind the drawn text. It
  522. can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA]
  523. form (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  524. The default value of @var{shadowcolor} is "black".
  525. @item ft_load_flags
  526. Flags to be used for loading the fonts.
  527. The flags map the corresponding flags supported by libfreetype, and are
  528. a combination of the following values:
  529. @table @var
  530. @item default
  531. @item no_scale
  532. @item no_hinting
  533. @item render
  534. @item no_bitmap
  535. @item vertical_layout
  536. @item force_autohint
  537. @item crop_bitmap
  538. @item pedantic
  539. @item ignore_global_advance_width
  540. @item no_recurse
  541. @item ignore_transform
  542. @item monochrome
  543. @item linear_design
  544. @item no_autohint
  545. @item end table
  546. @end table
  547. Default value is "render".
  548. For more information consult the documentation for the FT_LOAD_*
  549. libfreetype flags.
  550. @item tabsize
  551. The size in number of spaces to use for rendering the tab.
  552. Default value is 4.
  553. @end table
  554. For example the command:
  555. @example
  556. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  557. @end example
  558. will draw "Test Text" with font FreeSerif, using the default values
  559. for the optional parameters.
  560. The command:
  561. @example
  562. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  563. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  564. @end example
  565. will draw 'Test Text' with font FreeSerif of size 24 at position x=100
  566. and y=50 (counting from the top-left corner of the screen), text is
  567. yellow with a red box around it. Both the text and the box have an
  568. opacity of 20%.
  569. Note that the double quotes are not necessary if spaces are not used
  570. within the parameter list.
  571. For more information about libfreetype, check:
  572. @url{http://www.freetype.org/}.
  573. @section fade
  574. Apply fade-in/out effect to input video.
  575. It accepts the parameters:
  576. @var{type}:@var{start_frame}:@var{nb_frames}
  577. @var{type} specifies if the effect type, can be either "in" for
  578. fade-in, or "out" for a fade-out effect.
  579. @var{start_frame} specifies the number of the start frame for starting
  580. to apply the fade effect.
  581. @var{nb_frames} specifies the number of frames for which the fade
  582. effect has to last. At the end of the fade-in effect the output video
  583. will have the same intensity as the input video, at the end of the
  584. fade-out transition the output video will be completely black.
  585. A few usage examples follow, usable too as test scenarios.
  586. @example
  587. # fade in first 30 frames of video
  588. fade=in:0:30
  589. # fade out last 45 frames of a 200-frame video
  590. fade=out:155:45
  591. # fade in first 25 frames and fade out last 25 frames of a 1000-frame video
  592. fade=in:0:25, fade=out:975:25
  593. # make first 5 frames black, then fade in from frame 5-24
  594. fade=in:5:20
  595. @end example
  596. @section fieldorder
  597. Transform the field order of the input video.
  598. It accepts one parameter which specifies the required field order that
  599. the input interlaced video will be transformed to. The parameter can
  600. assume one of the following values:
  601. @table @option
  602. @item 0 or bff
  603. output bottom field first
  604. @item 1 or tff
  605. output top field first
  606. @end table
  607. Default value is "tff".
  608. Transformation is achieved by shifting the picture content up or down
  609. by one line, and filling the remaining line with appropriate picture content.
  610. This method is consistent with most broadcast field order converters.
  611. If the input video is not flagged as being interlaced, or it is already
  612. flagged as being of the required output field order then this filter does
  613. not alter the incoming video.
  614. This filter is very useful when converting to or from PAL DV material,
  615. which is bottom field first.
  616. For example:
  617. @example
  618. ./ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  619. @end example
  620. @section fifo
  621. Buffer input images and send them when they are requested.
  622. This filter is mainly useful when auto-inserted by the libavfilter
  623. framework.
  624. The filter does not take parameters.
  625. @section format
  626. Convert the input video to one of the specified pixel formats.
  627. Libavfilter will try to pick one that is supported for the input to
  628. the next filter.
  629. The filter accepts a list of pixel format names, separated by ":",
  630. for example "yuv420p:monow:rgb24".
  631. Some examples follow:
  632. @example
  633. # convert the input video to the format "yuv420p"
  634. format=yuv420p
  635. # convert the input video to any of the formats in the list
  636. format=yuv420p:yuv444p:yuv410p
  637. @end example
  638. @anchor{frei0r}
  639. @section frei0r
  640. Apply a frei0r effect to the input video.
  641. To enable compilation of this filter you need to install the frei0r
  642. header and configure FFmpeg with --enable-frei0r.
  643. The filter supports the syntax:
  644. @example
  645. @var{filter_name}[@{:|=@}@var{param1}:@var{param2}:...:@var{paramN}]
  646. @end example
  647. @var{filter_name} is the name to the frei0r effect to load. If the
  648. environment variable @env{FREI0R_PATH} is defined, the frei0r effect
  649. is searched in each one of the directories specified by the colon
  650. separated list in @env{FREIOR_PATH}, otherwise in the standard frei0r
  651. paths, which are in this order: @file{HOME/.frei0r-1/lib/},
  652. @file{/usr/local/lib/frei0r-1/}, @file{/usr/lib/frei0r-1/}.
  653. @var{param1}, @var{param2}, ... , @var{paramN} specify the parameters
  654. for the frei0r effect.
  655. A frei0r effect parameter can be a boolean (whose values are specified
  656. with "y" and "n"), a double, a color (specified by the syntax
  657. @var{R}/@var{G}/@var{B}, @var{R}, @var{G}, and @var{B} being float
  658. numbers from 0.0 to 1.0) or by an @code{av_parse_color()} color
  659. description), a position (specified by the syntax @var{X}/@var{Y},
  660. @var{X} and @var{Y} being float numbers) and a string.
  661. The number and kind of parameters depend on the loaded effect. If an
  662. effect parameter is not specified the default value is set.
  663. Some examples follow:
  664. @example
  665. # apply the distort0r effect, set the first two double parameters
  666. frei0r=distort0r:0.5:0.01
  667. # apply the colordistance effect, takes a color as first parameter
  668. frei0r=colordistance:0.2/0.3/0.4
  669. frei0r=colordistance:violet
  670. frei0r=colordistance:0x112233
  671. # apply the perspective effect, specify the top left and top right
  672. # image positions
  673. frei0r=perspective:0.2/0.2:0.8/0.2
  674. @end example
  675. For more information see:
  676. @url{http://piksel.org/frei0r}
  677. @section gradfun
  678. Fix the banding artifacts that are sometimes introduced into nearly flat
  679. regions by truncation to 8bit colordepth.
  680. Interpolate the gradients that should go where the bands are, and
  681. dither them.
  682. This filter is designed for playback only. Do not use it prior to
  683. lossy compression, because compression tends to lose the dither and
  684. bring back the bands.
  685. The filter takes two optional parameters, separated by ':':
  686. @var{strength}:@var{radius}
  687. @var{strength} is the maximum amount by which the filter will change
  688. any one pixel. Also the threshold for detecting nearly flat
  689. regions. Acceptable values range from .51 to 255, default value is
  690. 1.2, out-of-range values will be clipped to the valid range.
  691. @var{radius} is the neighborhood to fit the gradient to. A larger
  692. radius makes for smoother gradients, but also prevents the filter from
  693. modifying the pixels near detailed regions. Acceptable values are
  694. 8-32, default value is 16, out-of-range values will be clipped to the
  695. valid range.
  696. @example
  697. # default parameters
  698. gradfun=1.2:16
  699. # omitting radius
  700. gradfun=1.2
  701. @end example
  702. @section hflip
  703. Flip the input video horizontally.
  704. For example to horizontally flip the video in input with
  705. @file{ffmpeg}:
  706. @example
  707. ffmpeg -i in.avi -vf "hflip" out.avi
  708. @end example
  709. @section hqdn3d
  710. High precision/quality 3d denoise filter. This filter aims to reduce
  711. image noise producing smooth images and making still images really
  712. still. It should enhance compressibility.
  713. It accepts the following optional parameters:
  714. @var{luma_spatial}:@var{chroma_spatial}:@var{luma_tmp}:@var{chroma_tmp}
  715. @table @option
  716. @item luma_spatial
  717. a non-negative float number which specifies spatial luma strength,
  718. defaults to 4.0
  719. @item chroma_spatial
  720. a non-negative float number which specifies spatial chroma strength,
  721. defaults to 3.0*@var{luma_spatial}/4.0
  722. @item luma_tmp
  723. a float number which specifies luma temporal strength, defaults to
  724. 6.0*@var{luma_spatial}/4.0
  725. @item chroma_tmp
  726. a float number which specifies chroma temporal strength, defaults to
  727. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
  728. @end table
  729. @section lut, lutrgb, lutyuv
  730. Compute a look-up table for binding each pixel component input value
  731. to an output value, and apply it to input video.
  732. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  733. to an RGB input video.
  734. These filters accept in input a ":"-separated list of options, which
  735. specify the expressions used for computing the lookup table for the
  736. corresponding pixel component values.
  737. The @var{lut} filter requires either YUV or RGB pixel formats in
  738. input, and accepts the options:
  739. @table @option
  740. @var{c0} (first pixel component)
  741. @var{c1} (second pixel component)
  742. @var{c2} (third pixel component)
  743. @var{c3} (fourth pixel component, corresponds to the alpha component)
  744. @end table
  745. The exact component associated to each option depends on the format in
  746. input.
  747. The @var{lutrgb} filter requires RGB pixel formats in input, and
  748. accepts the options:
  749. @table @option
  750. @var{r} (red component)
  751. @var{g} (green component)
  752. @var{b} (blue component)
  753. @var{a} (alpha component)
  754. @end table
  755. The @var{lutyuv} filter requires YUV pixel formats in input, and
  756. accepts the options:
  757. @table @option
  758. @var{y} (Y/luminance component)
  759. @var{u} (U/Cb component)
  760. @var{v} (V/Cr component)
  761. @var{a} (alpha component)
  762. @end table
  763. The expressions can contain the following constants and functions:
  764. @table @option
  765. @item E, PI, PHI
  766. the corresponding mathematical approximated values for e
  767. (euler number), pi (greek PI), PHI (golden ratio)
  768. @item w, h
  769. the input width and heigth
  770. @item val
  771. input value for the pixel component
  772. @item clipval
  773. the input value clipped in the @var{minval}-@var{maxval} range
  774. @item maxval
  775. maximum value for the pixel component
  776. @item minval
  777. minimum value for the pixel component
  778. @item negval
  779. the negated value for the pixel component value clipped in the
  780. @var{minval}-@var{maxval} range , it corresponds to the expression
  781. "maxval-clipval+minval"
  782. @item clip(val)
  783. the computed value in @var{val} clipped in the
  784. @var{minval}-@var{maxval} range
  785. @item gammaval(gamma)
  786. the computed gamma correction value of the pixel component value
  787. clipped in the @var{minval}-@var{maxval} range, corresponds to the
  788. expression
  789. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  790. @end table
  791. All expressions default to "val".
  792. Some examples follow:
  793. @example
  794. # negate input video
  795. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  796. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  797. # the above is the same as
  798. lutrgb="r=negval:g=negval:b=negval"
  799. lutyuv="y=negval:u=negval:v=negval"
  800. # negate luminance
  801. lutyuv=negval
  802. # remove chroma components, turns the video into a graytone image
  803. lutyuv="u=128:v=128"
  804. # apply a luma burning effect
  805. lutyuv="y=2*val"
  806. # remove green and blue components
  807. lutrgb="g=0:b=0"
  808. # set a constant alpha channel value on input
  809. format=rgba,lutrgb=a="maxval-minval/2"
  810. # correct luminance gamma by a 0.5 factor
  811. lutyuv=y=gammaval(0.5)
  812. @end example
  813. @section mp
  814. Apply an MPlayer filter to the input video.
  815. This filter provides a wrapper around most of the filters of
  816. MPlayer/MEncoder.
  817. This wrapper is considered experimental. Some of the wrapped filters
  818. may not work properly and we may drop support for them, as they will
  819. be implemented natively into FFmpeg. Thus you should avoid
  820. depending on them when writing portable scripts.
  821. The filters accepts the parameters:
  822. @var{filter_name}[:=]@var{filter_params}
  823. @var{filter_name} is the name of a supported MPlayer filter,
  824. @var{filter_params} is a string containing the parameters accepted by
  825. the named filter.
  826. The list of the currently supported filters follows:
  827. @table @var
  828. @item 2xsai
  829. @item decimate
  830. @item denoise3d
  831. @item detc
  832. @item dint
  833. @item divtc
  834. @item down3dright
  835. @item dsize
  836. @item eq2
  837. @item eq
  838. @item field
  839. @item fil
  840. @item fixpts
  841. @item framestep
  842. @item fspp
  843. @item geq
  844. @item harddup
  845. @item hqdn3d
  846. @item hue
  847. @item il
  848. @item ilpack
  849. @item ivtc
  850. @item kerndeint
  851. @item mcdeint
  852. @item mirror
  853. @item noise
  854. @item ow
  855. @item palette
  856. @item perspective
  857. @item phase
  858. @item pp7
  859. @item pullup
  860. @item qp
  861. @item rectangle
  862. @item remove-logo
  863. @item rotate
  864. @item sab
  865. @item screenshot
  866. @item smartblur
  867. @item softpulldown
  868. @item softskip
  869. @item spp
  870. @item swapuv
  871. @item telecine
  872. @item tile
  873. @item tinterlace
  874. @item unsharp
  875. @item uspp
  876. @item yuvcsp
  877. @item yvu9
  878. @end table
  879. The parameter syntax and behavior for the listed filters are the same
  880. of the corresponding MPlayer filters. For detailed instructions check
  881. the "VIDEO FILTERS" section in the MPlayer manual.
  882. Some examples follow:
  883. @example
  884. # remove a logo by interpolating the surrounding pixels
  885. mp=delogo=200:200:80:20:1
  886. # adjust gamma, brightness, contrast
  887. mp=eq2=1.0:2:0.5
  888. # tweak hue and saturation
  889. mp=hue=100:-10
  890. @end example
  891. See also mplayer(1), @url{http://www.mplayerhq.hu/}.
  892. @section negate
  893. Negate input video.
  894. This filter accepts an integer in input, if non-zero it negates the
  895. alpha component (if available). The default value in input is 0.
  896. @section noformat
  897. Force libavfilter not to use any of the specified pixel formats for the
  898. input to the next filter.
  899. The filter accepts a list of pixel format names, separated by ":",
  900. for example "yuv420p:monow:rgb24".
  901. Some examples follow:
  902. @example
  903. # force libavfilter to use a format different from "yuv420p" for the
  904. # input to the vflip filter
  905. noformat=yuv420p,vflip
  906. # convert the input video to any of the formats not contained in the list
  907. noformat=yuv420p:yuv444p:yuv410p
  908. @end example
  909. @section null
  910. Pass the video source unchanged to the output.
  911. @section ocv
  912. Apply video transform using libopencv.
  913. To enable this filter install libopencv library and headers and
  914. configure FFmpeg with --enable-libopencv.
  915. The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}.
  916. @var{filter_name} is the name of the libopencv filter to apply.
  917. @var{filter_params} specifies the parameters to pass to the libopencv
  918. filter. If not specified the default values are assumed.
  919. Refer to the official libopencv documentation for more precise
  920. informations:
  921. @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
  922. Follows the list of supported libopencv filters.
  923. @anchor{dilate}
  924. @subsection dilate
  925. Dilate an image by using a specific structuring element.
  926. This filter corresponds to the libopencv function @code{cvDilate}.
  927. It accepts the parameters: @var{struct_el}:@var{nb_iterations}.
  928. @var{struct_el} represents a structuring element, and has the syntax:
  929. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  930. @var{cols} and @var{rows} represent the number of colums and rows of
  931. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  932. point, and @var{shape} the shape for the structuring element, and
  933. can be one of the values "rect", "cross", "ellipse", "custom".
  934. If the value for @var{shape} is "custom", it must be followed by a
  935. string of the form "=@var{filename}". The file with name
  936. @var{filename} is assumed to represent a binary image, with each
  937. printable character corresponding to a bright pixel. When a custom
  938. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  939. or columns and rows of the read file are assumed instead.
  940. The default value for @var{struct_el} is "3x3+0x0/rect".
  941. @var{nb_iterations} specifies the number of times the transform is
  942. applied to the image, and defaults to 1.
  943. Follow some example:
  944. @example
  945. # use the default values
  946. ocv=dilate
  947. # dilate using a structuring element with a 5x5 cross, iterate two times
  948. ocv=dilate=5x5+2x2/cross:2
  949. # read the shape from the file diamond.shape, iterate two times
  950. # the file diamond.shape may contain a pattern of characters like this:
  951. # *
  952. # ***
  953. # *****
  954. # ***
  955. # *
  956. # the specified cols and rows are ignored (but not the anchor point coordinates)
  957. ocv=0x0+2x2/custom=diamond.shape:2
  958. @end example
  959. @subsection erode
  960. Erode an image by using a specific structuring element.
  961. This filter corresponds to the libopencv function @code{cvErode}.
  962. The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
  963. with the same syntax and semantics as the @ref{dilate} filter.
  964. @subsection smooth
  965. Smooth the input video.
  966. The filter takes the following parameters:
  967. @var{type}:@var{param1}:@var{param2}:@var{param3}:@var{param4}.
  968. @var{type} is the type of smooth filter to apply, and can be one of
  969. the following values: "blur", "blur_no_scale", "median", "gaussian",
  970. "bilateral". The default value is "gaussian".
  971. @var{param1}, @var{param2}, @var{param3}, and @var{param4} are
  972. parameters whose meanings depend on smooth type. @var{param1} and
  973. @var{param2} accept integer positive values or 0, @var{param3} and
  974. @var{param4} accept float values.
  975. The default value for @var{param1} is 3, the default value for the
  976. other parameters is 0.
  977. These parameters correspond to the parameters assigned to the
  978. libopencv function @code{cvSmooth}.
  979. @section overlay
  980. Overlay one video on top of another.
  981. It takes two inputs and one output, the first input is the "main"
  982. video on which the second input is overlayed.
  983. It accepts the parameters: @var{x}:@var{y}.
  984. @var{x} is the x coordinate of the overlayed video on the main video,
  985. @var{y} is the y coordinate. The parameters are expressions containing
  986. the following parameters:
  987. @table @option
  988. @item main_w, main_h
  989. main input width and height
  990. @item W, H
  991. same as @var{main_w} and @var{main_h}
  992. @item overlay_w, overlay_h
  993. overlay input width and height
  994. @item w, h
  995. same as @var{overlay_w} and @var{overlay_h}
  996. @end table
  997. Be aware that frames are taken from each input video in timestamp
  998. order, hence, if their initial timestamps differ, it is a a good idea
  999. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  1000. have them begin in the same zero timestamp, as it does the example for
  1001. the @var{movie} filter.
  1002. Follow some examples:
  1003. @example
  1004. # draw the overlay at 10 pixels from the bottom right
  1005. # corner of the main video.
  1006. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  1007. # insert a transparent PNG logo in the bottom left corner of the input
  1008. movie=logo.png [logo];
  1009. [in][logo] overlay=10:main_h-overlay_h-10 [out]
  1010. # insert 2 different transparent PNG logos (second logo on bottom
  1011. # right corner):
  1012. movie=logo1.png [logo1];
  1013. movie=logo2.png [logo2];
  1014. [in][logo1] overlay=10:H-h-10 [in+logo1];
  1015. [in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
  1016. # add a transparent color layer on top of the main video,
  1017. # WxH specifies the size of the main input to the overlay filter
  1018. color=red@.3:WxH [over]; [in][over] overlay [out]
  1019. @end example
  1020. You can chain togheter more overlays but the efficiency of such
  1021. approach is yet to be tested.
  1022. @section pad
  1023. Add paddings to the input image, and places the original input at the
  1024. given coordinates @var{x}, @var{y}.
  1025. It accepts the following parameters:
  1026. @var{width}:@var{height}:@var{x}:@var{y}:@var{color}.
  1027. The parameters @var{width}, @var{height}, @var{x}, and @var{y} are
  1028. expressions containing the following constants:
  1029. @table @option
  1030. @item E, PI, PHI
  1031. the corresponding mathematical approximated values for e
  1032. (euler number), pi (greek PI), phi (golden ratio)
  1033. @item in_w, in_h
  1034. the input video width and heigth
  1035. @item iw, ih
  1036. same as @var{in_w} and @var{in_h}
  1037. @item out_w, out_h
  1038. the output width and heigth, that is the size of the padded area as
  1039. specified by the @var{width} and @var{height} expressions
  1040. @item ow, oh
  1041. same as @var{out_w} and @var{out_h}
  1042. @item x, y
  1043. x and y offsets as specified by the @var{x} and @var{y}
  1044. expressions, or NAN if not yet specified
  1045. @item a
  1046. same as @var{iw} / @var{ih}
  1047. @item sar
  1048. input sample aspect ratio
  1049. @item dar
  1050. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  1051. @item hsub, vsub
  1052. horizontal and vertical chroma subsample values. For example for the
  1053. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  1054. @end table
  1055. Follows the description of the accepted parameters.
  1056. @table @option
  1057. @item width, height
  1058. Specify the size of the output image with the paddings added. If the
  1059. value for @var{width} or @var{height} is 0, the corresponding input size
  1060. is used for the output.
  1061. The @var{width} expression can reference the value set by the
  1062. @var{height} expression, and viceversa.
  1063. The default value of @var{width} and @var{height} is 0.
  1064. @item x, y
  1065. Specify the offsets where to place the input image in the padded area
  1066. with respect to the top/left border of the output image.
  1067. The @var{x} expression can reference the value set by the @var{y}
  1068. expression, and viceversa.
  1069. The default value of @var{x} and @var{y} is 0.
  1070. @item color
  1071. Specify the color of the padded area, it can be the name of a color
  1072. (case insensitive match) or a 0xRRGGBB[AA] sequence.
  1073. The default value of @var{color} is "black".
  1074. @end table
  1075. Some examples follow:
  1076. @example
  1077. # Add paddings with color "violet" to the input video. Output video
  1078. # size is 640x480, the top-left corner of the input video is placed at
  1079. # column 0, row 40.
  1080. pad=640:480:0:40:violet
  1081. # pad the input to get an output with dimensions increased bt 3/2,
  1082. # and put the input video at the center of the padded area
  1083. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  1084. # pad the input to get a squared output with size equal to the maximum
  1085. # value between the input width and height, and put the input video at
  1086. # the center of the padded area
  1087. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  1088. # pad the input to get a final w/h ratio of 16:9
  1089. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  1090. # for anamorphic video, in order to set the output display aspect ratio,
  1091. # it is necessary to use sar in the expression, according to the relation:
  1092. # (ih * X / ih) * sar = output_dar
  1093. # X = output_dar / sar
  1094. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  1095. # double output size and put the input video in the bottom-right
  1096. # corner of the output padded area
  1097. pad="2*iw:2*ih:ow-iw:oh-ih"
  1098. @end example
  1099. @section pixdesctest
  1100. Pixel format descriptor test filter, mainly useful for internal
  1101. testing. The output video should be equal to the input video.
  1102. For example:
  1103. @example
  1104. format=monow, pixdesctest
  1105. @end example
  1106. can be used to test the monowhite pixel format descriptor definition.
  1107. @section scale
  1108. Scale the input video to @var{width}:@var{height} and/or convert the image format.
  1109. The parameters @var{width} and @var{height} are expressions containing
  1110. the following constants:
  1111. @table @option
  1112. @item E, PI, PHI
  1113. the corresponding mathematical approximated values for e
  1114. (euler number), pi (greek PI), phi (golden ratio)
  1115. @item in_w, in_h
  1116. the input width and heigth
  1117. @item iw, ih
  1118. same as @var{in_w} and @var{in_h}
  1119. @item out_w, out_h
  1120. the output (cropped) width and heigth
  1121. @item ow, oh
  1122. same as @var{out_w} and @var{out_h}
  1123. @item a
  1124. same as @var{iw} / @var{ih}
  1125. @item sar
  1126. input sample aspect ratio
  1127. @item dar
  1128. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  1129. @item hsub, vsub
  1130. horizontal and vertical chroma subsample values. For example for the
  1131. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  1132. @end table
  1133. If the input image format is different from the format requested by
  1134. the next filter, the scale filter will convert the input to the
  1135. requested format.
  1136. If the value for @var{width} or @var{height} is 0, the respective input
  1137. size is used for the output.
  1138. If the value for @var{width} or @var{height} is -1, the scale filter will
  1139. use, for the respective output size, a value that maintains the aspect
  1140. ratio of the input image.
  1141. The default value of @var{width} and @var{height} is 0.
  1142. Some examples follow:
  1143. @example
  1144. # scale the input video to a size of 200x100.
  1145. scale=200:100
  1146. # scale the input to 2x
  1147. scale=2*iw:2*ih
  1148. # the above is the same as
  1149. scale=2*in_w:2*in_h
  1150. # scale the input to half size
  1151. scale=iw/2:ih/2
  1152. # increase the width, and set the height to the same size
  1153. scale=3/2*iw:ow
  1154. # seek for Greek harmony
  1155. scale=iw:1/PHI*iw
  1156. scale=ih*PHI:ih
  1157. # increase the height, and set the width to 3/2 of the height
  1158. scale=3/2*oh:3/5*ih
  1159. # increase the size, but make the size a multiple of the chroma
  1160. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  1161. # increase the width to a maximum of 500 pixels, keep the same input aspect ratio
  1162. scale='min(500\, iw*3/2):-1'
  1163. @end example
  1164. @section select
  1165. Select frames to pass in output.
  1166. It accepts in input an expression, which is evaluated for each input
  1167. frame. If the expression is evaluated to a non-zero value, the frame
  1168. is selected and passed to the output, otherwise it is discarded.
  1169. The expression can contain the following constants:
  1170. @table @option
  1171. @item PI
  1172. Greek PI
  1173. @item PHI
  1174. golden ratio
  1175. @item E
  1176. Euler number
  1177. @item n
  1178. the sequential number of the filtered frame, starting from 0
  1179. @item selected_n
  1180. the sequential number of the selected frame, starting from 0
  1181. @item prev_selected_n
  1182. the sequential number of the last selected frame, NAN if undefined
  1183. @item TB
  1184. timebase of the input timestamps
  1185. @item pts
  1186. the PTS (Presentation TimeStamp) of the filtered video frame,
  1187. expressed in @var{TB} units, NAN if undefined
  1188. @item t
  1189. the PTS (Presentation TimeStamp) of the filtered video frame,
  1190. expressed in seconds, NAN if undefined
  1191. @item prev_pts
  1192. the PTS of the previously filtered video frame, NAN if undefined
  1193. @item prev_selected_pts
  1194. the PTS of the last previously filtered video frame, NAN if undefined
  1195. @item prev_selected_t
  1196. the PTS of the last previously selected video frame, NAN if undefined
  1197. @item start_pts
  1198. the PTS of the first video frame in the video, NAN if undefined
  1199. @item start_t
  1200. the time of the first video frame in the video, NAN if undefined
  1201. @item pict_type
  1202. the picture type of the filtered frame, can assume one of the following
  1203. values:
  1204. @table @option
  1205. @item PICT_TYPE_I
  1206. @item PICT_TYPE_P
  1207. @item PICT_TYPE_B
  1208. @item PICT_TYPE_S
  1209. @item PICT_TYPE_SI
  1210. @item PICT_TYPE_SP
  1211. @item PICT_TYPE_BI
  1212. @end table
  1213. @item interlace_type
  1214. the frame interlace type, can assume one of the following values:
  1215. @table @option
  1216. @item INTERLACE_TYPE_P
  1217. the frame is progressive (not interlaced)
  1218. @item INTERLACE_TYPE_T
  1219. the frame is top-field-first
  1220. @item INTERLACE_TYPE_B
  1221. the frame is bottom-field-first
  1222. @end table
  1223. @item key
  1224. 1 if the filtered frame is a key-frame, 0 otherwise
  1225. @item pos
  1226. the position in the file of the filtered frame, -1 if the information
  1227. is not available (e.g. for synthetic video)
  1228. @end table
  1229. The default value of the select expression is "1".
  1230. Some examples follow:
  1231. @example
  1232. # select all frames in input
  1233. select
  1234. # the above is the same as:
  1235. select=1
  1236. # skip all frames:
  1237. select=0
  1238. # select only I-frames
  1239. select='eq(pict_type\,PICT_TYPE_I)'
  1240. # select one frame every 100
  1241. select='not(mod(n\,100))'
  1242. # select only frames contained in the 10-20 time interval
  1243. select='gte(t\,10)*lte(t\,20)'
  1244. # select only I frames contained in the 10-20 time interval
  1245. select='gte(t\,10)*lte(t\,20)*eq(pict_type\,PICT_TYPE_I)'
  1246. # select frames with a minimum distance of 10 seconds
  1247. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  1248. @end example
  1249. @anchor{setdar}
  1250. @section setdar
  1251. Set the Display Aspect Ratio for the filter output video.
  1252. This is done by changing the specified Sample (aka Pixel) Aspect
  1253. Ratio, according to the following equation:
  1254. @math{DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR}
  1255. Keep in mind that this filter does not modify the pixel dimensions of
  1256. the video frame. Also the display aspect ratio set by this filter may
  1257. be changed by later filters in the filterchain, e.g. in case of
  1258. scaling or if another "setdar" or a "setsar" filter is applied.
  1259. The filter accepts a parameter string which represents the wanted
  1260. display aspect ratio.
  1261. The parameter can be a floating point number string, or an expression
  1262. of the form @var{num}:@var{den}, where @var{num} and @var{den} are the
  1263. numerator and denominator of the aspect ratio.
  1264. If the parameter is not specified, it is assumed the value "0:1".
  1265. For example to change the display aspect ratio to 16:9, specify:
  1266. @example
  1267. setdar=16:9
  1268. # the above is equivalent to
  1269. setdar=1.77777
  1270. @end example
  1271. See also the @ref{setsar} filter documentation.
  1272. @section setpts
  1273. Change the PTS (presentation timestamp) of the input video frames.
  1274. Accept in input an expression evaluated through the eval API, which
  1275. can contain the following constants:
  1276. @table @option
  1277. @item PTS
  1278. the presentation timestamp in input
  1279. @item PI
  1280. Greek PI
  1281. @item PHI
  1282. golden ratio
  1283. @item E
  1284. Euler number
  1285. @item N
  1286. the count of the input frame, starting from 0.
  1287. @item STARTPTS
  1288. the PTS of the first video frame
  1289. @item INTERLACED
  1290. tell if the current frame is interlaced
  1291. @item POS
  1292. original position in the file of the frame, or undefined if undefined
  1293. for the current frame
  1294. @item PREV_INPTS
  1295. previous input PTS
  1296. @item PREV_OUTPTS
  1297. previous output PTS
  1298. @end table
  1299. Some examples follow:
  1300. @example
  1301. # start counting PTS from zero
  1302. setpts=PTS-STARTPTS
  1303. # fast motion
  1304. setpts=0.5*PTS
  1305. # slow motion
  1306. setpts=2.0*PTS
  1307. # fixed rate 25 fps
  1308. setpts=N/(25*TB)
  1309. # fixed rate 25 fps with some jitter
  1310. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  1311. @end example
  1312. @anchor{setsar}
  1313. @section setsar
  1314. Set the Sample (aka Pixel) Aspect Ratio for the filter output video.
  1315. Note that as a consequence of the application of this filter, the
  1316. output display aspect ratio will change according to the following
  1317. equation:
  1318. @math{DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR}
  1319. Keep in mind that the sample aspect ratio set by this filter may be
  1320. changed by later filters in the filterchain, e.g. if another "setsar"
  1321. or a "setdar" filter is applied.
  1322. The filter accepts a parameter string which represents the wanted
  1323. sample aspect ratio.
  1324. The parameter can be a floating point number string, or an expression
  1325. of the form @var{num}:@var{den}, where @var{num} and @var{den} are the
  1326. numerator and denominator of the aspect ratio.
  1327. If the parameter is not specified, it is assumed the value "0:1".
  1328. For example to change the sample aspect ratio to 10:11, specify:
  1329. @example
  1330. setsar=10:11
  1331. @end example
  1332. @section settb
  1333. Set the timebase to use for the output frames timestamps.
  1334. It is mainly useful for testing timebase configuration.
  1335. It accepts in input an arithmetic expression representing a rational.
  1336. The expression can contain the constants "PI", "E", "PHI", "AVTB" (the
  1337. default timebase), and "intb" (the input timebase).
  1338. The default value for the input is "intb".
  1339. Follow some examples.
  1340. @example
  1341. # set the timebase to 1/25
  1342. settb=1/25
  1343. # set the timebase to 1/10
  1344. settb=0.1
  1345. #set the timebase to 1001/1000
  1346. settb=1+0.001
  1347. #set the timebase to 2*intb
  1348. settb=2*intb
  1349. #set the default timebase value
  1350. settb=AVTB
  1351. @end example
  1352. @section showinfo
  1353. Show a line containing various information for each input video frame.
  1354. The input video is not modified.
  1355. The shown line contains a sequence of key/value pairs of the form
  1356. @var{key}:@var{value}.
  1357. A description of each shown parameter follows:
  1358. @table @option
  1359. @item n
  1360. sequential number of the input frame, starting from 0
  1361. @item pts
  1362. Presentation TimeStamp of the input frame, expressed as a number of
  1363. time base units. The time base unit depends on the filter input pad.
  1364. @item pts_time
  1365. Presentation TimeStamp of the input frame, expressed as a number of
  1366. seconds
  1367. @item pos
  1368. position of the frame in the input stream, -1 if this information in
  1369. unavailable and/or meanigless (for example in case of synthetic video)
  1370. @item fmt
  1371. pixel format name
  1372. @item sar
  1373. sample aspect ratio of the input frame, expressed in the form
  1374. @var{num}/@var{den}
  1375. @item s
  1376. size of the input frame, expressed in the form
  1377. @var{width}x@var{height}
  1378. @item i
  1379. interlaced mode ("P" for "progressive", "T" for top field first, "B"
  1380. for bottom field first)
  1381. @item iskey
  1382. 1 if the frame is a key frame, 0 otherwise
  1383. @item type
  1384. picture type of the input frame ("I" for an I-frame, "P" for a
  1385. P-frame, "B" for a B-frame, "?" for unknown type).
  1386. Check also the documentation of the @code{AVPictureType} enum and of
  1387. the @code{av_get_picture_type_char} function defined in
  1388. @file{libavutil/avutil.h}.
  1389. @item checksum
  1390. Adler-32 checksum of all the planes of the input frame
  1391. @item plane_checksum
  1392. Adler-32 checksum of each plane of the input frame, expressed in the form
  1393. "[@var{c0} @var{c1} @var{c2} @var{c3}]"
  1394. @end table
  1395. @section slicify
  1396. Pass the images of input video on to next video filter as multiple
  1397. slices.
  1398. @example
  1399. ./ffmpeg -i in.avi -vf "slicify=32" out.avi
  1400. @end example
  1401. The filter accepts the slice height as parameter. If the parameter is
  1402. not specified it will use the default value of 16.
  1403. Adding this in the beginning of filter chains should make filtering
  1404. faster due to better use of the memory cache.
  1405. @section split
  1406. Pass on the input video to two outputs. Both outputs are identical to
  1407. the input video.
  1408. For example:
  1409. @example
  1410. [in] split [splitout1][splitout2];
  1411. [splitout1] crop=100:100:0:0 [cropout];
  1412. [splitout2] pad=200:200:100:100 [padout];
  1413. @end example
  1414. will create two separate outputs from the same input, one cropped and
  1415. one padded.
  1416. @section transpose
  1417. Transpose rows with columns in the input video and optionally flip it.
  1418. It accepts a parameter representing an integer, which can assume the
  1419. values:
  1420. @table @samp
  1421. @item 0
  1422. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  1423. @example
  1424. L.R L.l
  1425. . . -> . .
  1426. l.r R.r
  1427. @end example
  1428. @item 1
  1429. Rotate by 90 degrees clockwise, that is:
  1430. @example
  1431. L.R l.L
  1432. . . -> . .
  1433. l.r r.R
  1434. @end example
  1435. @item 2
  1436. Rotate by 90 degrees counterclockwise, that is:
  1437. @example
  1438. L.R R.r
  1439. . . -> . .
  1440. l.r L.l
  1441. @end example
  1442. @item 3
  1443. Rotate by 90 degrees clockwise and vertically flip, that is:
  1444. @example
  1445. L.R r.R
  1446. . . -> . .
  1447. l.r l.L
  1448. @end example
  1449. @end table
  1450. @section unsharp
  1451. Sharpen or blur the input video.
  1452. It accepts the following parameters:
  1453. @var{luma_msize_x}:@var{luma_msize_y}:@var{luma_amount}:@var{chroma_msize_x}:@var{chroma_msize_y}:@var{chroma_amount}
  1454. Negative values for the amount will blur the input video, while positive
  1455. values will sharpen. All parameters are optional and default to the
  1456. equivalent of the string '5:5:1.0:5:5:0.0'.
  1457. @table @option
  1458. @item luma_msize_x
  1459. Set the luma matrix horizontal size. It can be an integer between 3
  1460. and 13, default value is 5.
  1461. @item luma_msize_y
  1462. Set the luma matrix vertical size. It can be an integer between 3
  1463. and 13, default value is 5.
  1464. @item luma_amount
  1465. Set the luma effect strength. It can be a float number between -2.0
  1466. and 5.0, default value is 1.0.
  1467. @item chroma_msize_x
  1468. Set the chroma matrix horizontal size. It can be an integer between 3
  1469. and 13, default value is 5.
  1470. @item chroma_msize_y
  1471. Set the chroma matrix vertical size. It can be an integer between 3
  1472. and 13, default value is 5.
  1473. @item chroma_amount
  1474. Set the chroma effect strength. It can be a float number between -2.0
  1475. and 5.0, default value is 0.0.
  1476. @end table
  1477. @example
  1478. # Strong luma sharpen effect parameters
  1479. unsharp=7:7:2.5
  1480. # Strong blur of both luma and chroma parameters
  1481. unsharp=7:7:-2:7:7:-2
  1482. # Use the default values with @command{ffmpeg}
  1483. ./ffmpeg -i in.avi -vf "unsharp" out.mp4
  1484. @end example
  1485. @section vflip
  1486. Flip the input video vertically.
  1487. @example
  1488. ./ffmpeg -i in.avi -vf "vflip" out.avi
  1489. @end example
  1490. @section yadif
  1491. Deinterlace the input video ("yadif" means "yet another deinterlacing
  1492. filter").
  1493. It accepts the optional parameters: @var{mode}:@var{parity}:@var{auto}.
  1494. @var{mode} specifies the interlacing mode to adopt, accepts one of the
  1495. following values:
  1496. @table @option
  1497. @item 0
  1498. output 1 frame for each frame
  1499. @item 1
  1500. output 1 frame for each field
  1501. @item 2
  1502. like 0 but skips spatial interlacing check
  1503. @item 3
  1504. like 1 but skips spatial interlacing check
  1505. @end table
  1506. Default value is 0.
  1507. @var{parity} specifies the picture field parity assumed for the input
  1508. interlaced video, accepts one of the following values:
  1509. @table @option
  1510. @item 0
  1511. assume top field first
  1512. @item 1
  1513. assume bottom field first
  1514. @item -1
  1515. enable automatic detection
  1516. @end table
  1517. Default value is -1.
  1518. If interlacing is unknown or decoder does not export this information,
  1519. top field first will be assumed.
  1520. @var{auto} specifies if deinterlacer should trust the interlaced flag
  1521. and only deinterlace frames marked as interlaced
  1522. @table @option
  1523. @item 0
  1524. deinterlace all frames
  1525. @item 1
  1526. only deinterlace frames marked as interlaced
  1527. @end table
  1528. Default value is 0.
  1529. @c man end VIDEO FILTERS
  1530. @chapter Video Sources
  1531. @c man begin VIDEO SOURCES
  1532. Below is a description of the currently available video sources.
  1533. @section buffer
  1534. Buffer video frames, and make them available to the filter chain.
  1535. This source is mainly intended for a programmatic use, in particular
  1536. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  1537. It accepts the following parameters:
  1538. @var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den}:@var{sample_aspect_ratio_num}:@var{sample_aspect_ratio.den}:@var{scale_params}
  1539. All the parameters but @var{scale_params} need to be explicitely
  1540. defined.
  1541. Follows the list of the accepted parameters.
  1542. @table @option
  1543. @item width, height
  1544. Specify the width and height of the buffered video frames.
  1545. @item pix_fmt_string
  1546. A string representing the pixel format of the buffered video frames.
  1547. It may be a number corresponding to a pixel format, or a pixel format
  1548. name.
  1549. @item timebase_num, timebase_den
  1550. Specify numerator and denomitor of the timebase assumed by the
  1551. timestamps of the buffered frames.
  1552. @item sample_aspect_ratio.num, sample_aspect_ratio.den
  1553. Specify numerator and denominator of the sample aspect ratio assumed
  1554. by the video frames.
  1555. @item scale_params
  1556. Specify the optional parameters to be used for the scale filter which
  1557. is automatically inserted when an input change is detected in the
  1558. input size or format.
  1559. @end table
  1560. For example:
  1561. @example
  1562. buffer=320:240:yuv410p:1:24:1:1
  1563. @end example
  1564. will instruct the source to accept video frames with size 320x240 and
  1565. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  1566. square pixels (1:1 sample aspect ratio).
  1567. Since the pixel format with name "yuv410p" corresponds to the number 6
  1568. (check the enum PixelFormat definition in @file{libavutil/pixfmt.h}),
  1569. this example corresponds to:
  1570. @example
  1571. buffer=320:240:6:1:24:1:1
  1572. @end example
  1573. @section color
  1574. Provide an uniformly colored input.
  1575. It accepts the following parameters:
  1576. @var{color}:@var{frame_size}:@var{frame_rate}
  1577. Follows the description of the accepted parameters.
  1578. @table @option
  1579. @item color
  1580. Specify the color of the source. It can be the name of a color (case
  1581. insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an
  1582. alpha specifier. The default value is "black".
  1583. @item frame_size
  1584. Specify the size of the sourced video, it may be a string of the form
  1585. @var{width}x@var{heigth}, or the name of a size abbreviation. The
  1586. default value is "320x240".
  1587. @item frame_rate
  1588. Specify the frame rate of the sourced video, as the number of frames
  1589. generated per second. It has to be a string in the format
  1590. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  1591. number or a valid video frame rate abbreviation. The default value is
  1592. "25".
  1593. @end table
  1594. For example the following graph description will generate a red source
  1595. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  1596. frames per second, which will be overlayed over the source connected
  1597. to the pad with identifier "in".
  1598. @example
  1599. "color=red@@0.2:qcif:10 [color]; [in][color] overlay [out]"
  1600. @end example
  1601. @section movie
  1602. Read a video stream from a movie container.
  1603. It accepts the syntax: @var{movie_name}[:@var{options}] where
  1604. @var{movie_name} is the name of the resource to read (not necessarily
  1605. a file but also a device or a stream accessed through some protocol),
  1606. and @var{options} is an optional sequence of @var{key}=@var{value}
  1607. pairs, separated by ":".
  1608. The description of the accepted options follows.
  1609. @table @option
  1610. @item format_name, f
  1611. Specifies the format assumed for the movie to read, and can be either
  1612. the name of a container or an input device. If not specified the
  1613. format is guessed from @var{movie_name} or by probing.
  1614. @item seek_point, sp
  1615. Specifies the seek point in seconds, the frames will be output
  1616. starting from this seek point, the parameter is evaluated with
  1617. @code{av_strtod} so the numerical value may be suffixed by an IS
  1618. postfix. Default value is "0".
  1619. @item stream_index, si
  1620. Specifies the index of the video stream to read. If the value is -1,
  1621. the best suited video stream will be automatically selected. Default
  1622. value is "-1".
  1623. @end table
  1624. This filter allows to overlay a second video on top of main input of
  1625. a filtergraph as shown in this graph:
  1626. @example
  1627. input -----------> deltapts0 --> overlay --> output
  1628. ^
  1629. |
  1630. movie --> scale--> deltapts1 -------+
  1631. @end example
  1632. Some examples follow:
  1633. @example
  1634. # skip 3.2 seconds from the start of the avi file in.avi, and overlay it
  1635. # on top of the input labelled as "in".
  1636. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
  1637. [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
  1638. # read from a video4linux2 device, and overlay it on top of the input
  1639. # labelled as "in"
  1640. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
  1641. [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
  1642. @end example
  1643. @section mptestsrc
  1644. Generate various test patterns, as generated by the MPlayer test filter.
  1645. The size of the generated video is fixed, and is 256x256.
  1646. This source is useful in particular for testing encoding features.
  1647. This source accepts an optional sequence of @var{key}=@var{value} pairs,
  1648. separated by ":". The description of the accepted options follows.
  1649. @table @option
  1650. @item rate, r
  1651. Specify the frame rate of the sourced video, as the number of frames
  1652. generated per second. It has to be a string in the format
  1653. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  1654. number or a valid video frame rate abbreviation. The default value is
  1655. "25".
  1656. @item duration, d
  1657. Set the video duration of the sourced video. The accepted syntax is:
  1658. @example
  1659. [-]HH[:MM[:SS[.m...]]]
  1660. [-]S+[.m...]
  1661. @end example
  1662. See also the function @code{av_parse_time()}.
  1663. If not specified, or the expressed duration is negative, the video is
  1664. supposed to be generated forever.
  1665. @item test, t
  1666. Set the number or the name of the test to perform. Supported tests are:
  1667. @table @option
  1668. @item dc_luma
  1669. @item dc_chroma
  1670. @item freq_luma
  1671. @item freq_chroma
  1672. @item amp_luma
  1673. @item amp_chroma
  1674. @item cbp
  1675. @item mv
  1676. @item ring1
  1677. @item ring2
  1678. @item all
  1679. @end table
  1680. Default value is "all", which will cycle through the list of all tests.
  1681. @end table
  1682. For example the following:
  1683. @example
  1684. testsrc=t=dc_luma
  1685. @end example
  1686. will generate a "dc_luma" test pattern.
  1687. @section nullsrc
  1688. Null video source, never return images. It is mainly useful as a
  1689. template and to be employed in analysis / debugging tools.
  1690. It accepts as optional parameter a string of the form
  1691. @var{width}:@var{height}:@var{timebase}.
  1692. @var{width} and @var{height} specify the size of the configured
  1693. source. The default values of @var{width} and @var{height} are
  1694. respectively 352 and 288 (corresponding to the CIF size format).
  1695. @var{timebase} specifies an arithmetic expression representing a
  1696. timebase. The expression can contain the constants "PI", "E", "PHI",
  1697. "AVTB" (the default timebase), and defaults to the value "AVTB".
  1698. @section frei0r_src
  1699. Provide a frei0r source.
  1700. To enable compilation of this filter you need to install the frei0r
  1701. header and configure FFmpeg with --enable-frei0r.
  1702. The source supports the syntax:
  1703. @example
  1704. @var{size}:@var{rate}:@var{src_name}[@{=|:@}@var{param1}:@var{param2}:...:@var{paramN}]
  1705. @end example
  1706. @var{size} is the size of the video to generate, may be a string of the
  1707. form @var{width}x@var{height} or a frame size abbreviation.
  1708. @var{rate} is the rate of the video to generate, may be a string of
  1709. the form @var{num}/@var{den} or a frame rate abbreviation.
  1710. @var{src_name} is the name to the frei0r source to load. For more
  1711. information regarding frei0r and how to set the parameters read the
  1712. section @ref{frei0r} in the description of the video filters.
  1713. Some examples follow:
  1714. @example
  1715. # generate a frei0r partik0l source with size 200x200 and framerate 10
  1716. # which is overlayed on the overlay filter main input
  1717. frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
  1718. @end example
  1719. @section rgbtestsrc, testsrc
  1720. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  1721. detecting RGB vs BGR issues. You should see a red, green and blue
  1722. stripe from top to bottom.
  1723. The @code{testsrc} source generates a test video pattern, showing a
  1724. color pattern, a scrolling gradient and a timestamp. This is mainly
  1725. intended for testing purposes.
  1726. Both sources accept an optional sequence of @var{key}=@var{value} pairs,
  1727. separated by ":". The description of the accepted options follows.
  1728. @table @option
  1729. @item size, s
  1730. Specify the size of the sourced video, it may be a string of the form
  1731. @var{width}x@var{heigth}, or the name of a size abbreviation. The
  1732. default value is "320x240".
  1733. @item rate, r
  1734. Specify the frame rate of the sourced video, as the number of frames
  1735. generated per second. It has to be a string in the format
  1736. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  1737. number or a valid video frame rate abbreviation. The default value is
  1738. "25".
  1739. @item sar
  1740. Set the sample aspect ratio of the sourced video.
  1741. @item duration
  1742. Set the video duration of the sourced video. The accepted syntax is:
  1743. @example
  1744. [-]HH[:MM[:SS[.m...]]]
  1745. [-]S+[.m...]
  1746. @end example
  1747. See also the function @code{av_parse_time()}.
  1748. If not specified, or the expressed duration is negative, the video is
  1749. supposed to be generated forever.
  1750. @end table
  1751. For example the following:
  1752. @example
  1753. testsrc=duration=5.3:size=qcif:rate=10
  1754. @end example
  1755. will generate a video with a duration of 5.3 seconds, with size
  1756. 176x144 and a framerate of 10 frames per second.
  1757. @c man end VIDEO SOURCES
  1758. @chapter Video Sinks
  1759. @c man begin VIDEO SINKS
  1760. Below is a description of the currently available video sinks.
  1761. @section buffersink
  1762. Buffer video frames, and make them available to the end of the filter
  1763. graph.
  1764. This sink is mainly intended for a programmatic use, in particular
  1765. through the interface defined in @file{libavfilter/buffersink.h}.
  1766. It does not require a string parameter in input, but you need to
  1767. specify a pointer to a list of supported pixel formats terminated by
  1768. -1 in the opaque parameter provided to @code{avfilter_init_filter}
  1769. when initializing this sink.
  1770. @section nullsink
  1771. Null video sink, do absolutely nothing with the input video. It is
  1772. mainly useful as a template and to be employed in analysis / debugging
  1773. tools.
  1774. @c man end VIDEO SINKS