You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

963 lines
29KB

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