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.

2435 lines
68KB

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