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.

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