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.

959 lines
29KB

  1. \input texinfo @c -*- texinfo -*-
  2. @settitle avconv Documentation
  3. @titlepage
  4. @center @titlefont{avconv Documentation}
  5. @end titlepage
  6. @top
  7. @contents
  8. @chapter Synopsis
  9. The generic syntax is:
  10. @example
  11. @c man begin SYNOPSIS
  12. avconv [global options] [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
  13. @c man end
  14. @end example
  15. @chapter Description
  16. @c man begin DESCRIPTION
  17. avconv is a very fast video and audio converter that can also grab from
  18. a live audio/video source. It can also convert between arbitrary sample
  19. rates and resize video on the fly with a high quality polyphase filter.
  20. As a general rule, options are applied to the next specified
  21. file. Therefore, order is important, and you can have the same
  22. option on the command line multiple times. Each occurrence is
  23. then applied to the next input or output file.
  24. Exceptions from this rule are the global options (e.g. verbosity level),
  25. which should be specified first.
  26. @itemize
  27. @item
  28. To set the video bitrate of the output file to 64kbit/s:
  29. @example
  30. avconv -i input.avi -b 64k output.avi
  31. @end example
  32. @item
  33. To force the frame rate of the output file to 24 fps:
  34. @example
  35. avconv -i input.avi -r 24 output.avi
  36. @end example
  37. @item
  38. To force the frame rate of the input file (valid for raw formats only)
  39. to 1 fps and the frame rate of the output file to 24 fps:
  40. @example
  41. avconv -r 1 -i input.m2v -r 24 output.avi
  42. @end example
  43. @end itemize
  44. The format option may be needed for raw input files.
  45. @c man end DESCRIPTION
  46. @chapter Stream selection
  47. @c man begin STREAM SELECTION
  48. By default avconv tries to pick the "best" stream of each type present in input
  49. files and add them to each output file. For video, this means the highest
  50. resolution, for audio the highest channel count. For subtitle it's simply the
  51. first subtitle stream.
  52. You can disable some of those defaults by using @code{-vn/-an/-sn} options. For
  53. full manual control, use the @code{-map} option, which disables the defaults just
  54. described.
  55. @c man end STREAM SELECTION
  56. @chapter Options
  57. @c man begin OPTIONS
  58. @include avtools-common-opts.texi
  59. @section Main options
  60. @table @option
  61. @item -f @var{fmt} (@emph{input/output})
  62. Force format.
  63. @item -i @var{filename} (@emph{input})
  64. input file name
  65. @item -y (@emph{global})
  66. Overwrite output files.
  67. @item -c[:@var{stream_specifier}] @var{codec} (@emph{input/output,per-stream})
  68. @itemx -codec[:@var{stream_specifier}] @var{codec} (@emph{input/output,per-stream})
  69. Select an encoder (when used before an output file) or a decoder (when used
  70. before an input file) for one or more streams. @var{codec} is the name of a
  71. decoder/encoder or a special value @code{copy} (output only) to indicate that
  72. the stream is not to be reencoded.
  73. For example
  74. @example
  75. avconv -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT
  76. @end example
  77. encodes all video streams with libx264 and copies all audio streams.
  78. For each stream, the last matching @code{c} option is applied, so
  79. @example
  80. avconv -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT
  81. @end example
  82. will copy all the streams except the second video, which will be encoded with
  83. libx264, and the 138th audio, which will be encoded with libvorbis.
  84. @item -t @var{duration} (@emph{output})
  85. Restrict the transcoded/captured video sequence
  86. to the duration specified in seconds.
  87. @code{hh:mm:ss[.xxx]} syntax is also supported.
  88. @item -fs @var{limit_size} (@emph{output})
  89. Set the file size limit.
  90. @item -ss @var{position} (@emph{input/output})
  91. When used as an input option (before @code{-i}), seeks in this input file to
  92. @var{position}. When used as an output option (before an output filename),
  93. decodes but discards input until the timestamps reach @var{position}. This is
  94. slower, but more accurate.
  95. @var{position} may be either in seconds or in @code{hh:mm:ss[.xxx]} form.
  96. @item -itsoffset @var{offset} (@emph{input})
  97. Set the input time offset in seconds.
  98. @code{[-]hh:mm:ss[.xxx]} syntax is also supported.
  99. The offset is added to the timestamps of the input files.
  100. Specifying a positive offset means that the corresponding
  101. streams are delayed by 'offset' seconds.
  102. @item -metadata[:metadata_specifier] @var{key}=@var{value} (@emph{output,per-metadata})
  103. Set a metadata key/value pair.
  104. An optional @var{metadata_specifier} may be given to set metadata
  105. on streams or chapters. See @code{-map_metadata} documentation for
  106. details.
  107. This option overrides metadata set with @code{-map_metadata}. It is
  108. also possible to delete metadata by using an empty value.
  109. For example, for setting the title in the output file:
  110. @example
  111. avconv -i in.avi -metadata title="my title" out.flv
  112. @end example
  113. To set the language of the second stream:
  114. @example
  115. avconv -i INPUT -metadata:s:1 language=eng OUTPUT
  116. @end example
  117. @item -v @var{number} (@emph{global})
  118. Set the logging verbosity level.
  119. @item -target @var{type} (@emph{output})
  120. Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd",
  121. "ntsc-svcd", ... ). All the format options (bitrate, codecs,
  122. buffer sizes) are then set automatically. You can just type:
  123. @example
  124. avconv -i myfile.avi -target vcd /tmp/vcd.mpg
  125. @end example
  126. Nevertheless you can specify additional options as long as you know
  127. they do not conflict with the standard, as in:
  128. @example
  129. avconv -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
  130. @end example
  131. @item -dframes @var{number} (@emph{output})
  132. Set the number of data frames to record. This is an alias for @code{-frames:d}.
  133. @item -frames[:@var{stream_specifier}] @var{framecount} (@emph{output,per-stream})
  134. Stop writing to the stream after @var{framecount} frames.
  135. @item -q[:@var{stream_specifier}] @var{q} (@emph{output,per-stream})
  136. @itemx -qscale[:@var{stream_specifier}] @var{q} (@emph{output,per-stream})
  137. Use fixed quality scale (VBR). The meaning of @var{q} is
  138. codec-dependent.
  139. @item -filter[:@var{stream_specifier}] @var{filter_graph}
  140. @var{filter_graph} is a description of the filter graph to apply to
  141. the stream. Use @code{-filters} to show all the available filters
  142. (including also sources and sinks).
  143. @end table
  144. @section Video Options
  145. @table @option
  146. @item -vframes @var{number} (@emph{output})
  147. Set the number of video frames to record. This is an alias for @code{-frames:v}.
  148. @item -r[:@var{stream_specifier}] @var{fps} (@emph{input/output,per-stream})
  149. Set frame rate (Hz value, fraction or abbreviation), (default = 25).
  150. @item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream})
  151. Set frame size. The format is @samp{wxh} (ffserver default = 160x128, avconv default = same as source).
  152. The following abbreviations are recognized:
  153. @table @samp
  154. @item sqcif
  155. 128x96
  156. @item qcif
  157. 176x144
  158. @item cif
  159. 352x288
  160. @item 4cif
  161. 704x576
  162. @item 16cif
  163. 1408x1152
  164. @item qqvga
  165. 160x120
  166. @item qvga
  167. 320x240
  168. @item vga
  169. 640x480
  170. @item svga
  171. 800x600
  172. @item xga
  173. 1024x768
  174. @item uxga
  175. 1600x1200
  176. @item qxga
  177. 2048x1536
  178. @item sxga
  179. 1280x1024
  180. @item qsxga
  181. 2560x2048
  182. @item hsxga
  183. 5120x4096
  184. @item wvga
  185. 852x480
  186. @item wxga
  187. 1366x768
  188. @item wsxga
  189. 1600x1024
  190. @item wuxga
  191. 1920x1200
  192. @item woxga
  193. 2560x1600
  194. @item wqsxga
  195. 3200x2048
  196. @item wquxga
  197. 3840x2400
  198. @item whsxga
  199. 6400x4096
  200. @item whuxga
  201. 7680x4800
  202. @item cga
  203. 320x200
  204. @item ega
  205. 640x350
  206. @item hd480
  207. 852x480
  208. @item hd720
  209. 1280x720
  210. @item hd1080
  211. 1920x1080
  212. @end table
  213. @item -aspect[:@var{stream_specifier}] @var{aspect} (@emph{output,per-stream})
  214. Set the video display aspect ratio specified by @var{aspect}.
  215. @var{aspect} can be a floating point number string, or a string of the
  216. form @var{num}:@var{den}, where @var{num} and @var{den} are the
  217. numerator and denominator of the aspect ratio. For example "4:3",
  218. "16:9", "1.3333", and "1.7777" are valid argument values.
  219. @item -vn (@emph{output})
  220. Disable video recording.
  221. @item -bt @var{tolerance}
  222. Set video bitrate tolerance (in bits, default 4000k).
  223. Has a minimum value of: (target_bitrate/target_framerate).
  224. In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
  225. willing to deviate from the target average bitrate value. This is
  226. not related to min/max bitrate. Lowering tolerance too much has
  227. an adverse effect on quality.
  228. @item -maxrate @var{bitrate}
  229. Set max video bitrate (in bit/s).
  230. Requires -bufsize to be set.
  231. @item -minrate @var{bitrate}
  232. Set min video bitrate (in bit/s).
  233. Most useful in setting up a CBR encode:
  234. @example
  235. avconv -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
  236. @end example
  237. It is of little use elsewise.
  238. @item -bufsize @var{size}
  239. Set video buffer verifier buffer size (in bits).
  240. @item -vcodec @var{codec} (@emph{output})
  241. Set the video codec. This is an alias for @code{-codec:v}.
  242. @item -same_quant
  243. Use same quantizer as source (implies VBR).
  244. Note that this is NOT SAME QUALITY. Do not use this option unless you know you
  245. need it.
  246. @item -pass @var{n}
  247. Select the pass number (1 or 2). It is used to do two-pass
  248. video encoding. The statistics of the video are recorded in the first
  249. pass into a log file (see also the option -passlogfile),
  250. and in the second pass that log file is used to generate the video
  251. at the exact requested bitrate.
  252. On pass 1, you may just deactivate audio and set output to null,
  253. examples for Windows and Unix:
  254. @example
  255. avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL
  256. avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null
  257. @end example
  258. @item -passlogfile @var{prefix} (@emph{global})
  259. Set two-pass log file name prefix to @var{prefix}, the default file name
  260. prefix is ``av2pass''. The complete file name will be
  261. @file{PREFIX-N.log}, where N is a number specific to the output
  262. stream.
  263. @item -vf @var{filter_graph} (@emph{output})
  264. @var{filter_graph} is a description of the filter graph to apply to
  265. the input video.
  266. Use the option "-filters" to show all the available filters (including
  267. also sources and sinks). This is an alias for @code{-filter:v}.
  268. @end table
  269. @section Advanced Video Options
  270. @table @option
  271. @item -pix_fmt[:@var{stream_specifier}] @var{format} (@emph{input/output,per-stream})
  272. Set pixel format. Use @code{-pix_fmts} to show all the supported
  273. pixel formats.
  274. @item -sws_flags @var{flags} (@emph{input/output})
  275. Set SwScaler flags.
  276. @item -g @var{gop_size}
  277. Set the group of pictures size.
  278. @item -vdt @var{n}
  279. Discard threshold.
  280. @item -qmin @var{q}
  281. minimum video quantizer scale (VBR)
  282. @item -qmax @var{q}
  283. maximum video quantizer scale (VBR)
  284. @item -qdiff @var{q}
  285. maximum difference between the quantizer scales (VBR)
  286. @item -qblur @var{blur}
  287. video quantizer scale blur (VBR) (range 0.0 - 1.0)
  288. @item -qcomp @var{compression}
  289. video quantizer scale compression (VBR) (default 0.5).
  290. Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
  291. @item -lmin @var{lambda}
  292. minimum video lagrange factor (VBR)
  293. @item -lmax @var{lambda}
  294. max video lagrange factor (VBR)
  295. @item -mblmin @var{lambda}
  296. minimum macroblock quantizer scale (VBR)
  297. @item -mblmax @var{lambda}
  298. maximum macroblock quantizer scale (VBR)
  299. These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
  300. but you may use the QP2LAMBDA constant to easily convert from 'q' units:
  301. @example
  302. avconv -i src.ext -lmax 21*QP2LAMBDA dst.ext
  303. @end example
  304. @item -rc_init_cplx @var{complexity}
  305. initial complexity for single pass encoding
  306. @item -b_qfactor @var{factor}
  307. qp factor between P- and B-frames
  308. @item -i_qfactor @var{factor}
  309. qp factor between P- and I-frames
  310. @item -b_qoffset @var{offset}
  311. qp offset between P- and B-frames
  312. @item -i_qoffset @var{offset}
  313. qp offset between P- and I-frames
  314. @item -rc_eq @var{equation}
  315. Set rate control equation (see section "Expression Evaluation")
  316. (default = @code{tex^qComp}).
  317. When computing the rate control equation expression, besides the
  318. standard functions defined in the section "Expression Evaluation", the
  319. following functions are available:
  320. @table @var
  321. @item bits2qp(bits)
  322. @item qp2bits(qp)
  323. @end table
  324. and the following constants are available:
  325. @table @var
  326. @item iTex
  327. @item pTex
  328. @item tex
  329. @item mv
  330. @item fCode
  331. @item iCount
  332. @item mcVar
  333. @item var
  334. @item isI
  335. @item isP
  336. @item isB
  337. @item avgQP
  338. @item qComp
  339. @item avgIITex
  340. @item avgPITex
  341. @item avgPPTex
  342. @item avgBPTex
  343. @item avgTex
  344. @end table
  345. @item -rc_override[:@var{stream_specifier}] @var{override} (@emph{output,per-stream})
  346. rate control override for specific intervals
  347. @item -me_method @var{method}
  348. Set motion estimation method to @var{method}.
  349. Available methods are (from lowest to best quality):
  350. @table @samp
  351. @item zero
  352. Try just the (0, 0) vector.
  353. @item phods
  354. @item log
  355. @item x1
  356. @item hex
  357. @item umh
  358. @item epzs
  359. (default method)
  360. @item full
  361. exhaustive search (slow and marginally better than epzs)
  362. @end table
  363. @item -er @var{n}
  364. Set error resilience to @var{n}.
  365. @table @samp
  366. @item 1
  367. FF_ER_CAREFUL (default)
  368. @item 2
  369. FF_ER_COMPLIANT
  370. @item 3
  371. FF_ER_AGGRESSIVE
  372. @item 4
  373. FF_ER_VERY_AGGRESSIVE
  374. @end table
  375. @item -ec @var{bit_mask}
  376. Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
  377. the following values:
  378. @table @samp
  379. @item 1
  380. FF_EC_GUESS_MVS (default = enabled)
  381. @item 2
  382. FF_EC_DEBLOCK (default = enabled)
  383. @end table
  384. @item -bf @var{frames}
  385. Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
  386. @item -mbd @var{mode}
  387. macroblock decision
  388. @table @samp
  389. @item 0
  390. FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in avconv).
  391. @item 1
  392. FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
  393. @item 2
  394. FF_MB_DECISION_RD: rate distortion
  395. @end table
  396. @item -bug @var{param}
  397. Work around encoder bugs that are not auto-detected.
  398. @item -strict @var{strictness}
  399. How strictly to follow the standards.
  400. @item -deinterlace
  401. Deinterlace pictures.
  402. @item -vstats
  403. Dump video coding statistics to @file{vstats_HHMMSS.log}.
  404. @item -vstats_file @var{file}
  405. Dump video coding statistics to @var{file}.
  406. @item -top[:@var{stream_specifier}] @var{n} (@emph{output,per-stream})
  407. top=1/bottom=0/auto=-1 field first
  408. @item -dc @var{precision}
  409. Intra_dc_precision.
  410. @item -vtag @var{fourcc/tag} (@emph{output})
  411. Force video tag/fourcc. This is an alias for @code{-tag:v}.
  412. @item -qphist (@emph{global})
  413. Show QP histogram.
  414. @item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream})
  415. Force key frames at the specified timestamps, more precisely at the first
  416. frames after each specified time.
  417. This option can be useful to ensure that a seek point is present at a
  418. chapter mark or any other designated place in the output file.
  419. The timestamps must be specified in ascending order.
  420. @end table
  421. @section Audio Options
  422. @table @option
  423. @item -aframes @var{number} (@emph{output})
  424. Set the number of audio frames to record. This is an alias for @code{-frames:a}.
  425. @item -ar[:@var{stream_specifier}] @var{freq} (@emph{input/output,per-stream})
  426. Set the audio sampling frequency. For output streams it is set by
  427. default to the frequency of the corresponding input stream. For input
  428. streams this option only makes sense for audio grabbing devices and raw
  429. demuxers and is mapped to the corresponding demuxer options.
  430. @item -aq @var{q} (@emph{output})
  431. Set the audio quality (codec-specific, VBR). This is an alias for -q:a.
  432. @item -ac[:@var{stream_specifier}] @var{channels} (@emph{input/output,per-stream})
  433. Set the number of audio channels. For output streams it is set by
  434. default to the number of input audio channels. For input streams
  435. this option only makes sense for audio grabbing devices and raw demuxers
  436. and is mapped to the corresponding demuxer options.
  437. @item -an (@emph{output})
  438. Disable audio recording.
  439. @item -acodec @var{codec} (@emph{input/output})
  440. Set the audio codec. This is an alias for @code{-codec:a}.
  441. @item -sample_fmt[:@var{stream_specifier}] @var{sample_fmt} (@emph{output,per-stream})
  442. Set the audio sample format. Use @code{-help sample_fmts} to get a list
  443. of supported sample formats.
  444. @end table
  445. @section Advanced Audio options:
  446. @table @option
  447. @item -atag @var{fourcc/tag} (@emph{output})
  448. Force audio tag/fourcc. This is an alias for @code{-tag:a}.
  449. @item -audio_service_type @var{type}
  450. Set the type of service that the audio stream contains.
  451. @table @option
  452. @item ma
  453. Main Audio Service (default)
  454. @item ef
  455. Effects
  456. @item vi
  457. Visually Impaired
  458. @item hi
  459. Hearing Impaired
  460. @item di
  461. Dialogue
  462. @item co
  463. Commentary
  464. @item em
  465. Emergency
  466. @item vo
  467. Voice Over
  468. @item ka
  469. Karaoke
  470. @end table
  471. @end table
  472. @section Subtitle options:
  473. @table @option
  474. @item -scodec @var{codec} (@emph{input/output})
  475. Set the subtitle codec. This is an alias for @code{-codec:s}.
  476. @item -sn (@emph{output})
  477. Disable subtitle recording.
  478. @end table
  479. @section Audio/Video grab options
  480. @table @option
  481. @item -isync (@emph{global})
  482. Synchronize read on input.
  483. @end table
  484. @section Advanced options
  485. @table @option
  486. @item -map [-]@var{input_file_id}[:@var{stream_specifier}][,@var{sync_file_id}[:@var{stream_specifier}]] (@emph{output})
  487. Designate one or more input streams as a source for the output file. Each input
  488. stream is identified by the input file index @var{input_file_id} and
  489. the input stream index @var{input_stream_id} within the input
  490. file. Both indices start at 0. If specified,
  491. @var{sync_file_id}:@var{stream_specifier} sets which input stream
  492. is used as a presentation sync reference.
  493. The first @code{-map} option on the command line specifies the
  494. source for output stream 0, the second @code{-map} option specifies
  495. the source for output stream 1, etc.
  496. A @code{-} character before the stream identifier creates a "negative" mapping.
  497. It disables matching streams from already created mappings.
  498. For example, to map ALL streams from the first input file to output
  499. @example
  500. avconv -i INPUT -map 0 output
  501. @end example
  502. For example, if you have two audio streams in the first input file,
  503. these streams are identified by "0:0" and "0:1". You can use
  504. @code{-map} to select which streams to place in an output file. For
  505. example:
  506. @example
  507. avconv -i INPUT -map 0:1 out.wav
  508. @end example
  509. will map the input stream in @file{INPUT} identified by "0:1" to
  510. the (single) output stream in @file{out.wav}.
  511. For example, to select the stream with index 2 from input file
  512. @file{a.mov} (specified by the identifier "0:2"), and stream with
  513. index 6 from input @file{b.mov} (specified by the identifier "1:6"),
  514. and copy them to the output file @file{out.mov}:
  515. @example
  516. avconv -i a.mov -i b.mov -c copy -map 0:2 -map 1:6 out.mov
  517. @end example
  518. To select all video and the third audio stream from an input file:
  519. @example
  520. avconv -i INPUT -map 0:v -map 0:a:2 OUTPUT
  521. @end example
  522. To map all the streams except the second audio, use negative mappings
  523. @example
  524. avconv -i INPUT -map 0 -map -0:a:1 OUTPUT
  525. @end example
  526. Note that using this option disables the default mappings for this output file.
  527. @item -map_metadata[:@var{metadata_type}][:@var{index}] @var{infile}[:@var{metadata_type}][:@var{index}] (@emph{output,per-metadata})
  528. Set metadata information of the next output file from @var{infile}. Note that
  529. those are file indices (zero-based), not filenames.
  530. Optional @var{metadata_type} parameters specify, which metadata to copy - (g)lobal
  531. (i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or
  532. per-(p)rogram. All metadata specifiers other than global must be followed by the
  533. stream/chapter/program index. If metadata specifier is omitted, it defaults to
  534. global.
  535. By default, global metadata is copied from the first input file,
  536. per-stream and per-chapter metadata is copied along with streams/chapters. These
  537. default mappings are disabled by creating any mapping of the relevant type. A negative
  538. file index can be used to create a dummy mapping that just disables automatic copying.
  539. For example to copy metadata from the first stream of the input file to global metadata
  540. of the output file:
  541. @example
  542. avconv -i in.ogg -map_metadata 0:s:0 out.mp3
  543. @end example
  544. @item -map_chapters @var{input_file_index} (@emph{output})
  545. Copy chapters from input file with index @var{input_file_index} to the next
  546. output file. If no chapter mapping is specified, then chapters are copied from
  547. the first input file with at least one chapter. Use a negative file index to
  548. disable any chapter copying.
  549. @item -debug
  550. Print specific debug info.
  551. @item -benchmark (@emph{global})
  552. Show benchmarking information at the end of an encode.
  553. Shows CPU time used and maximum memory consumption.
  554. Maximum memory consumption is not supported on all systems,
  555. it will usually display as 0 if not supported.
  556. @item -dump (@emph{global})
  557. Dump each input packet.
  558. @item -hex (@emph{global})
  559. When dumping packets, also dump the payload.
  560. @item -ps @var{size}
  561. Set RTP payload size in bytes.
  562. @item -re (@emph{input})
  563. Read input at native frame rate. Mainly used to simulate a grab device.
  564. @item -threads @var{count}
  565. Thread count.
  566. @item -vsync @var{parameter}
  567. Video sync method.
  568. @table @option
  569. @item 0
  570. Each frame is passed with its timestamp from the demuxer to the muxer.
  571. @item 1
  572. Frames will be duplicated and dropped to achieve exactly the requested
  573. constant framerate.
  574. @item 2
  575. Frames are passed through with their timestamp or dropped so as to
  576. prevent 2 frames from having the same timestamp.
  577. @item -1
  578. Chooses between 1 and 2 depending on muxer capabilities. This is the
  579. default method.
  580. @end table
  581. With -map you can select from which stream the timestamps should be
  582. taken. You can leave either video or audio unchanged and sync the
  583. remaining stream(s) to the unchanged one.
  584. @item -async @var{samples_per_second}
  585. Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
  586. the parameter is the maximum samples per second by which the audio is changed.
  587. -async 1 is a special case where only the start of the audio stream is corrected
  588. without any later correction.
  589. @item -copyts
  590. Copy timestamps from input to output.
  591. @item -copytb
  592. Copy input stream time base from input to output when stream copying.
  593. @item -shortest
  594. Finish encoding when the shortest input stream ends.
  595. @item -dts_delta_threshold
  596. Timestamp discontinuity delta threshold.
  597. @item -muxdelay @var{seconds} (@emph{input})
  598. Set the maximum demux-decode delay.
  599. @item -muxpreload @var{seconds} (@emph{input})
  600. Set the initial demux-decode delay.
  601. @item -streamid @var{output-stream-index}:@var{new-value} (@emph{output})
  602. Assign a new stream-id value to an output stream. This option should be
  603. specified prior to the output filename to which it applies.
  604. For the situation where multiple output files exist, a streamid
  605. may be reassigned to a different value.
  606. For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for
  607. an output mpegts file:
  608. @example
  609. avconv -i infile -streamid 0:33 -streamid 1:36 out.ts
  610. @end example
  611. @item -bsf[:@var{stream_specifier}] @var{bitstream_filters} (@emph{output,per-stream})
  612. Set bitstream filters for matching streams. @var{bistream_filters} is
  613. a comma-separated list of bitstream filters. Use the @code{-bsfs} option
  614. to get the list of bitstream filters.
  615. @example
  616. avconv -i h264.mp4 -c:v copy -vbsf h264_mp4toannexb -an out.h264
  617. @end example
  618. @example
  619. avconv -i file.mov -an -vn -sbsf mov2textsub -c:s copy -f rawvideo sub.txt
  620. @end example
  621. @item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{output,per-stream})
  622. Force a tag/fourcc for matching streams.
  623. @end table
  624. @c man end OPTIONS
  625. @chapter Tips
  626. @c man begin TIPS
  627. @itemize
  628. @item
  629. For streaming at very low bitrate application, use a low frame rate
  630. and a small GOP size. This is especially true for RealVideo where
  631. the Linux player does not seem to be very fast, so it can miss
  632. frames. An example is:
  633. @example
  634. avconv -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
  635. @end example
  636. @item
  637. The parameter 'q' which is displayed while encoding is the current
  638. quantizer. The value 1 indicates that a very good quality could
  639. be achieved. The value 31 indicates the worst quality. If q=31 appears
  640. too often, it means that the encoder cannot compress enough to meet
  641. your bitrate. You must either increase the bitrate, decrease the
  642. frame rate or decrease the frame size.
  643. @item
  644. If your computer is not fast enough, you can speed up the
  645. compression at the expense of the compression ratio. You can use
  646. '-me zero' to speed up motion estimation, and '-intra' to disable
  647. motion estimation completely (you have only I-frames, which means it
  648. is about as good as JPEG compression).
  649. @item
  650. To have very low audio bitrates, reduce the sampling frequency
  651. (down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).
  652. @item
  653. To have a constant quality (but a variable bitrate), use the option
  654. '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
  655. quality).
  656. @end itemize
  657. @c man end TIPS
  658. @chapter Examples
  659. @c man begin EXAMPLES
  660. @section Video and Audio grabbing
  661. If you specify the input format and device then avconv can grab video
  662. and audio directly.
  663. @example
  664. avconv -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
  665. @end example
  666. Note that you must activate the right video source and channel before
  667. launching avconv with any TV viewer such as
  668. @uref{http://linux.bytesex.org/xawtv/, xawtv} by Gerd Knorr. You also
  669. have to set the audio recording levels correctly with a
  670. standard mixer.
  671. @section X11 grabbing
  672. Grab the X11 display with avconv via
  673. @example
  674. avconv -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg
  675. @end example
  676. 0.0 is display.screen number of your X11 server, same as
  677. the DISPLAY environment variable.
  678. @example
  679. avconv -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg
  680. @end example
  681. 0.0 is display.screen number of your X11 server, same as the DISPLAY environment
  682. variable. 10 is the x-offset and 20 the y-offset for the grabbing.
  683. @section Video and Audio file format conversion
  684. Any supported file format and protocol can serve as input to avconv:
  685. Examples:
  686. @itemize
  687. @item
  688. You can use YUV files as input:
  689. @example
  690. avconv -i /tmp/test%d.Y /tmp/out.mpg
  691. @end example
  692. It will use the files:
  693. @example
  694. /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
  695. /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
  696. @end example
  697. The Y files use twice the resolution of the U and V files. They are
  698. raw files, without header. They can be generated by all decent video
  699. decoders. You must specify the size of the image with the @option{-s} option
  700. if avconv cannot guess it.
  701. @item
  702. You can input from a raw YUV420P file:
  703. @example
  704. avconv -i /tmp/test.yuv /tmp/out.avi
  705. @end example
  706. test.yuv is a file containing raw YUV planar data. Each frame is composed
  707. of the Y plane followed by the U and V planes at half vertical and
  708. horizontal resolution.
  709. @item
  710. You can output to a raw YUV420P file:
  711. @example
  712. avconv -i mydivx.avi hugefile.yuv
  713. @end example
  714. @item
  715. You can set several input files and output files:
  716. @example
  717. avconv -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
  718. @end example
  719. Converts the audio file a.wav and the raw YUV video file a.yuv
  720. to MPEG file a.mpg.
  721. @item
  722. You can also do audio and video conversions at the same time:
  723. @example
  724. avconv -i /tmp/a.wav -ar 22050 /tmp/a.mp2
  725. @end example
  726. Converts a.wav to MPEG audio at 22050 Hz sample rate.
  727. @item
  728. You can encode to several formats at the same time and define a
  729. mapping from input stream to output streams:
  730. @example
  731. avconv -i /tmp/a.wav -map 0:a -b 64k /tmp/a.mp2 -map 0:a -b 128k /tmp/b.mp2
  732. @end example
  733. Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map
  734. file:index' specifies which input stream is used for each output
  735. stream, in the order of the definition of output streams.
  736. @item
  737. You can transcode decrypted VOBs:
  738. @example
  739. avconv -i snatch_1.vob -f avi -c:v mpeg4 -b:v 800k -g 300 -bf 2 -c:a libmp3lame -b:a 128k snatch.avi
  740. @end example
  741. This is a typical DVD ripping example; the input is a VOB file, the
  742. output an AVI file with MPEG-4 video and MP3 audio. Note that in this
  743. command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
  744. GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
  745. input video. Furthermore, the audio stream is MP3-encoded so you need
  746. to enable LAME support by passing @code{--enable-libmp3lame} to configure.
  747. The mapping is particularly useful for DVD transcoding
  748. to get the desired audio language.
  749. NOTE: To see the supported input formats, use @code{avconv -formats}.
  750. @item
  751. You can extract images from a video, or create a video from many images:
  752. For extracting images from a video:
  753. @example
  754. avconv -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
  755. @end example
  756. This will extract one video frame per second from the video and will
  757. output them in files named @file{foo-001.jpeg}, @file{foo-002.jpeg},
  758. etc. Images will be rescaled to fit the new WxH values.
  759. If you want to extract just a limited number of frames, you can use the
  760. above command in combination with the -vframes or -t option, or in
  761. combination with -ss to start extracting from a certain point in time.
  762. For creating a video from many images:
  763. @example
  764. avconv -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
  765. @end example
  766. The syntax @code{foo-%03d.jpeg} specifies to use a decimal number
  767. composed of three digits padded with zeroes to express the sequence
  768. number. It is the same syntax supported by the C printf function, but
  769. only formats accepting a normal integer are suitable.
  770. @item
  771. You can put many streams of the same type in the output:
  772. @example
  773. avconv -i test1.avi -i test2.avi -map 0.3 -map 0.2 -map 0.1 -map 0.0 -c copy test12.nut
  774. @end example
  775. The resulting output file @file{test12.avi} will contain first four streams from
  776. the input file in reverse order.
  777. @end itemize
  778. @c man end EXAMPLES
  779. @include eval.texi
  780. @include encoders.texi
  781. @include demuxers.texi
  782. @include muxers.texi
  783. @include indevs.texi
  784. @include outdevs.texi
  785. @include protocols.texi
  786. @include bitstream_filters.texi
  787. @include filters.texi
  788. @include metadata.texi
  789. @ignore
  790. @setfilename avconv
  791. @settitle avconv video converter
  792. @c man begin SEEALSO
  793. ffplay(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation
  794. @c man end
  795. @c man begin AUTHORS
  796. The Libav developers
  797. @c man end
  798. @end ignore
  799. @bye