avconv.texi 31 KB

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