avconv.texi 30 KB

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