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.

1062 lines
31KB

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