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.

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