avconv.texi 30 KB

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