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.

1010 lines
29KB

  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 -absf @var{bitstream_filter}
  518. Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
  519. @end table
  520. @section Subtitle options:
  521. @table @option
  522. @item -scodec @var{codec}
  523. Force subtitle codec ('copy' to copy stream).
  524. @item -newsubtitle
  525. Add a new subtitle stream to the current output stream.
  526. @item -slang @var{code}
  527. Set the ISO 639 language code (3 letters) of the current subtitle stream.
  528. @item -sn
  529. Disable subtitle recording.
  530. @item -sbsf @var{bitstream_filter}
  531. Bitstream filters available are "mov2textsub", "text2movsub".
  532. @example
  533. ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
  534. @end example
  535. @end table
  536. @section Audio/Video grab options
  537. @table @option
  538. @item -vc @var{channel}
  539. Set video grab channel (DV1394 only).
  540. @item -tvstd @var{standard}
  541. Set television standard (NTSC, PAL (SECAM)).
  542. @item -isync
  543. Synchronize read on input.
  544. @end table
  545. @section Advanced options
  546. @table @option
  547. @item -map @var{input_stream_id}[:@var{sync_stream_id}]
  548. Set stream mapping from input streams to output streams.
  549. Just enumerate the input streams in the order you want them in the output.
  550. @var{sync_stream_id} if specified sets the input stream to sync
  551. against.
  552. @item -map_meta_data @var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}]
  553. Deprecated, use @var{-map_metadata} instead.
  554. @item -map_metadata @var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}]
  555. Set metadata information of @var{outfile} from @var{infile}. Note that those
  556. are file indices (zero-based), not filenames.
  557. Optional @var{metadata} parameters specify, which metadata to copy - (g)lobal
  558. (i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or
  559. per-(p)rogram. All metadata specifiers other than global must be followed by the
  560. stream/chapter/program number. If metadata specifier is omitted, it defaults to
  561. global.
  562. By default, global metadata is copied from the first input file to all output files,
  563. per-stream and per-chapter metadata is copied along with streams/chapters. These
  564. default mappings are disabled by creating any mapping of the relevant type. A negative
  565. file index can be used to create a dummy mapping that just disables automatic copying.
  566. For example to copy metadata from the first stream of the input file to global metadata
  567. of the output file:
  568. @example
  569. ffmpeg -i in.ogg -map_metadata 0:0,s0 out.mp3
  570. @end example
  571. @item -map_chapters @var{outfile}:@var{infile}
  572. Copy chapters from @var{infile} to @var{outfile}. If no chapter mapping is specified,
  573. then chapters are copied from the first input file with at least one chapter to all
  574. output files. Use a negative file index to disable any chapter copying.
  575. @item -debug
  576. Print specific debug info.
  577. @item -benchmark
  578. Show benchmarking information at the end of an encode.
  579. Shows CPU time used and maximum memory consumption.
  580. Maximum memory consumption is not supported on all systems,
  581. it will usually display as 0 if not supported.
  582. @item -dump
  583. Dump each input packet.
  584. @item -hex
  585. When dumping packets, also dump the payload.
  586. @item -bitexact
  587. Only use bit exact algorithms (for codec testing).
  588. @item -ps @var{size}
  589. Set RTP payload size in bytes.
  590. @item -re
  591. Read input at native frame rate. Mainly used to simulate a grab device.
  592. @item -loop_input
  593. Loop over the input stream. Currently it works only for image
  594. streams. This option is used for automatic FFserver testing.
  595. @item -loop_output @var{number_of_times}
  596. Repeatedly loop output for formats that support looping such as animated GIF
  597. (0 will loop the output infinitely).
  598. @item -threads @var{count}
  599. Thread count.
  600. @item -vsync @var{parameter}
  601. Video sync method.
  602. @table @option
  603. @item 0
  604. Each frame is passed with its timestamp from the demuxer to the muxer.
  605. @item 1
  606. Frames will be duplicated and dropped to achieve exactly the requested
  607. constant framerate.
  608. @item 2
  609. Frames are passed through with their timestamp or dropped so as to
  610. prevent 2 frames from having the same timestamp.
  611. @item -1
  612. Chooses between 1 and 2 depending on muxer capabilities. This is the
  613. default method.
  614. @end table
  615. With -map you can select from which stream the timestamps should be
  616. taken. You can leave either video or audio unchanged and sync the
  617. remaining stream(s) to the unchanged one.
  618. @item -async @var{samples_per_second}
  619. Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
  620. the parameter is the maximum samples per second by which the audio is changed.
  621. -async 1 is a special case where only the start of the audio stream is corrected
  622. without any later correction.
  623. @item -copyts
  624. Copy timestamps from input to output.
  625. @item -copytb
  626. Copy input stream time base from input to output when stream copying.
  627. @item -shortest
  628. Finish encoding when the shortest input stream ends.
  629. @item -dts_delta_threshold
  630. Timestamp discontinuity delta threshold.
  631. @item -muxdelay @var{seconds}
  632. Set the maximum demux-decode delay.
  633. @item -muxpreload @var{seconds}
  634. Set the initial demux-decode delay.
  635. @item -streamid @var{output-stream-index}:@var{new-value}
  636. Assign a new stream-id value to an output stream. This option should be
  637. specified prior to the output filename to which it applies.
  638. For the situation where multiple output files exist, a streamid
  639. may be reassigned to a different value.
  640. For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for
  641. an output mpegts file:
  642. @example
  643. ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts
  644. @end example
  645. @end table
  646. @section Preset files
  647. A preset file contains a sequence of @var{option}=@var{value} pairs,
  648. one for each line, specifying a sequence of options which would be
  649. awkward to specify on the command line. Lines starting with the hash
  650. ('#') character are ignored and are used to provide comments. Check
  651. the @file{ffpresets} directory in the FFmpeg source tree for examples.
  652. Preset files are specified with the @code{vpre}, @code{apre},
  653. @code{spre}, and @code{fpre} options. The @code{fpre} option takes the
  654. filename of the preset instead of a preset name as input and can be
  655. used for any kind of codec. For the @code{vpre}, @code{apre}, and
  656. @code{spre} options, the options specified in a preset file are
  657. applied to the currently selected codec of the same type as the preset
  658. option.
  659. The argument passed to the @code{vpre}, @code{apre}, and @code{spre}
  660. preset options identifies the preset file to use according to the
  661. following rules:
  662. First ffmpeg searches for a file named @var{arg}.ffpreset in the
  663. directories @file{$FFMPEG_DATADIR} (if set), and @file{$HOME/.ffmpeg}, and in
  664. the datadir defined at configuration time (usually @file{PREFIX/share/ffmpeg})
  665. in that order. For example, if the argument is @code{libx264-max}, it will
  666. search for the file @file{libx264-max.ffpreset}.
  667. If no such file is found, then ffmpeg will search for a file named
  668. @var{codec_name}-@var{arg}.ffpreset in the above-mentioned
  669. directories, where @var{codec_name} is the name of the codec to which
  670. the preset file options will be applied. For example, if you select
  671. the video codec with @code{-vcodec libx264} and use @code{-vpre max},
  672. then it will search for the file @file{libx264-max.ffpreset}.
  673. @c man end
  674. @chapter Tips
  675. @c man begin TIPS
  676. @itemize
  677. @item
  678. For streaming at very low bitrate application, use a low frame rate
  679. and a small GOP size. This is especially true for RealVideo where
  680. the Linux player does not seem to be very fast, so it can miss
  681. frames. An example is:
  682. @example
  683. ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
  684. @end example
  685. @item
  686. The parameter 'q' which is displayed while encoding is the current
  687. quantizer. The value 1 indicates that a very good quality could
  688. be achieved. The value 31 indicates the worst quality. If q=31 appears
  689. too often, it means that the encoder cannot compress enough to meet
  690. your bitrate. You must either increase the bitrate, decrease the
  691. frame rate or decrease the frame size.
  692. @item
  693. If your computer is not fast enough, you can speed up the
  694. compression at the expense of the compression ratio. You can use
  695. '-me zero' to speed up motion estimation, and '-intra' to disable
  696. motion estimation completely (you have only I-frames, which means it
  697. is about as good as JPEG compression).
  698. @item
  699. To have very low audio bitrates, reduce the sampling frequency
  700. (down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).
  701. @item
  702. To have a constant quality (but a variable bitrate), use the option
  703. '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
  704. quality).
  705. @item
  706. When converting video files, you can use the '-sameq' option which
  707. uses the same quality factor in the encoder as in the decoder.
  708. It allows almost lossless encoding.
  709. @end itemize
  710. @c man end TIPS
  711. @chapter Examples
  712. @c man begin EXAMPLES
  713. @section Video and Audio grabbing
  714. FFmpeg can grab video and audio from devices given that you specify the input
  715. format and device.
  716. @example
  717. ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
  718. @end example
  719. Note that you must activate the right video source and channel before
  720. launching FFmpeg with any TV viewer such as xawtv
  721. (@url{http://linux.bytesex.org/xawtv/}) by Gerd Knorr. You also
  722. have to set the audio recording levels correctly with a
  723. standard mixer.
  724. @section X11 grabbing
  725. FFmpeg can grab the X11 display.
  726. @example
  727. ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg
  728. @end example
  729. 0.0 is display.screen number of your X11 server, same as
  730. the DISPLAY environment variable.
  731. @example
  732. ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg
  733. @end example
  734. 0.0 is display.screen number of your X11 server, same as the DISPLAY environment
  735. variable. 10 is the x-offset and 20 the y-offset for the grabbing.
  736. @section Video and Audio file format conversion
  737. FFmpeg can use any supported file format and protocol as input:
  738. Examples:
  739. @itemize
  740. @item
  741. You can use YUV files as input:
  742. @example
  743. ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
  744. @end example
  745. It will use the files:
  746. @example
  747. /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
  748. /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
  749. @end example
  750. The Y files use twice the resolution of the U and V files. They are
  751. raw files, without header. They can be generated by all decent video
  752. decoders. You must specify the size of the image with the @option{-s} option
  753. if FFmpeg cannot guess it.
  754. @item
  755. You can input from a raw YUV420P file:
  756. @example
  757. ffmpeg -i /tmp/test.yuv /tmp/out.avi
  758. @end example
  759. test.yuv is a file containing raw YUV planar data. Each frame is composed
  760. of the Y plane followed by the U and V planes at half vertical and
  761. horizontal resolution.
  762. @item
  763. You can output to a raw YUV420P file:
  764. @example
  765. ffmpeg -i mydivx.avi hugefile.yuv
  766. @end example
  767. @item
  768. You can set several input files and output files:
  769. @example
  770. ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
  771. @end example
  772. Converts the audio file a.wav and the raw YUV video file a.yuv
  773. to MPEG file a.mpg.
  774. @item
  775. You can also do audio and video conversions at the same time:
  776. @example
  777. ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
  778. @end example
  779. Converts a.wav to MPEG audio at 22050 Hz sample rate.
  780. @item
  781. You can encode to several formats at the same time and define a
  782. mapping from input stream to output streams:
  783. @example
  784. ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0
  785. @end example
  786. Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map
  787. file:index' specifies which input stream is used for each output
  788. stream, in the order of the definition of output streams.
  789. @item
  790. You can transcode decrypted VOBs:
  791. @example
  792. ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128k snatch.avi
  793. @end example
  794. This is a typical DVD ripping example; the input is a VOB file, the
  795. output an AVI file with MPEG-4 video and MP3 audio. Note that in this
  796. command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
  797. GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
  798. input video. Furthermore, the audio stream is MP3-encoded so you need
  799. to enable LAME support by passing @code{--enable-libmp3lame} to configure.
  800. The mapping is particularly useful for DVD transcoding
  801. to get the desired audio language.
  802. NOTE: To see the supported input formats, use @code{ffmpeg -formats}.
  803. @item
  804. You can extract images from a video, or create a video from many images:
  805. For extracting images from a video:
  806. @example
  807. ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
  808. @end example
  809. This will extract one video frame per second from the video and will
  810. output them in files named @file{foo-001.jpeg}, @file{foo-002.jpeg},
  811. etc. Images will be rescaled to fit the new WxH values.
  812. If you want to extract just a limited number of frames, you can use the
  813. above command in combination with the -vframes or -t option, or in
  814. combination with -ss to start extracting from a certain point in time.
  815. For creating a video from many images:
  816. @example
  817. ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
  818. @end example
  819. The syntax @code{foo-%03d.jpeg} specifies to use a decimal number
  820. composed of three digits padded with zeroes to express the sequence
  821. number. It is the same syntax supported by the C printf function, but
  822. only formats accepting a normal integer are suitable.
  823. @item
  824. You can put many streams of the same type in the output:
  825. @example
  826. ffmpeg -i test1.avi -i test2.avi -vcodec copy -acodec copy -vcodec copy -acodec copy test12.avi -newvideo -newaudio
  827. @end example
  828. In addition to the first video and audio streams, the resulting
  829. output file @file{test12.avi} will contain the second video
  830. and the second audio stream found in the input streams list.
  831. The @code{-newvideo}, @code{-newaudio} and @code{-newsubtitle}
  832. options have to be specified immediately after the name of the output
  833. file to which you want to add them.
  834. @end itemize
  835. @c man end EXAMPLES
  836. @include eval.texi
  837. @include encoders.texi
  838. @include demuxers.texi
  839. @include muxers.texi
  840. @include indevs.texi
  841. @include outdevs.texi
  842. @include protocols.texi
  843. @include bitstream_filters.texi
  844. @include filters.texi
  845. @include metadata.texi
  846. @ignore
  847. @setfilename ffmpeg
  848. @settitle FFmpeg video converter
  849. @c man begin SEEALSO
  850. ffplay(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation
  851. @c man end
  852. @c man begin AUTHORS
  853. The FFmpeg developers
  854. @c man end
  855. @end ignore
  856. @bye