avconv.texi 29 KB

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