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.

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