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.

890 lines
23KB

  1. \input texinfo @c -*- texinfo -*-
  2. @settitle FFmpeg Documentation
  3. @titlepage
  4. @sp 7
  5. @center @titlefont{FFmpeg Documentation}
  6. @sp 3
  7. @end titlepage
  8. @chapter Introduction
  9. FFmpeg is a very fast video and audio converter. It can also grab from
  10. a live audio/video source.
  11. The command line interface is designed to be intuitive, in the sense
  12. that FFmpeg tries to figure out all parameters that can possibly be
  13. derived automatically. You usually only have to specify the target
  14. bitrate you want.
  15. FFmpeg can also convert from any sample rate to any other, and resize
  16. video on the fly with a high quality polyphase filter.
  17. @chapter Quick Start
  18. @c man begin EXAMPLES
  19. @section Video and Audio grabbing
  20. FFmpeg can grab video and audio from devices given that you specify the input
  21. format and device.
  22. @example
  23. ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
  24. @end example
  25. Note that you must activate the right video source and channel before
  26. launching FFmpeg with any TV viewer such as xawtv
  27. (@url{http://bytesex.org/xawtv/}) by Gerd Knorr. You also
  28. have to set the audio recording levels correctly with a
  29. standard mixer.
  30. @section X11 grabbing
  31. FFmpeg can grab the X11 display.
  32. @example
  33. ffmpeg -f x11grab -s cif -i :0.0 /tmp/out.mpg
  34. @end example
  35. 0.0 is display.screen number of your X11 server, same as
  36. the DISPLAY environment variable.
  37. @example
  38. ffmpeg -f x11grab -s cif -i :0.0+10,20 /tmp/out.mpg
  39. @end example
  40. 0.0 is display.screen number of your X11 server, same as the DISPLAY environment
  41. variable. 10 is the x-offset and 20 the y-offset for the grabbing.
  42. @section Video and Audio file format conversion
  43. * FFmpeg can use any supported file format and protocol as input:
  44. Examples:
  45. * You can use YUV files as input:
  46. @example
  47. ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
  48. @end example
  49. It will use the files:
  50. @example
  51. /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
  52. /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
  53. @end example
  54. The Y files use twice the resolution of the U and V files. They are
  55. raw files, without header. They can be generated by all decent video
  56. decoders. You must specify the size of the image with the @option{-s} option
  57. if FFmpeg cannot guess it.
  58. * You can input from a raw YUV420P file:
  59. @example
  60. ffmpeg -i /tmp/test.yuv /tmp/out.avi
  61. @end example
  62. test.yuv is a file containing raw YUV planar data. Each frame is composed
  63. of the Y plane followed by the U and V planes at half vertical and
  64. horizontal resolution.
  65. * You can output to a raw YUV420P file:
  66. @example
  67. ffmpeg -i mydivx.avi hugefile.yuv
  68. @end example
  69. * You can set several input files and output files:
  70. @example
  71. ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
  72. @end example
  73. Converts the audio file a.wav and the raw YUV video file a.yuv
  74. to MPEG file a.mpg.
  75. * You can also do audio and video conversions at the same time:
  76. @example
  77. ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
  78. @end example
  79. Converts a.wav to MPEG audio at 22050Hz sample rate.
  80. * You can encode to several formats at the same time and define a
  81. mapping from input stream to output streams:
  82. @example
  83. ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0
  84. @end example
  85. Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map
  86. file:index' specifies which input stream is used for each output
  87. stream, in the order of the definition of output streams.
  88. * You can transcode decrypted VOBs:
  89. @example
  90. ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128k snatch.avi
  91. @end example
  92. This is a typical DVD ripping example; the input is a VOB file, the
  93. output an AVI file with MPEG-4 video and MP3 audio. Note that in this
  94. command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
  95. GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
  96. input video. Furthermore, the audio stream is MP3-encoded so you need
  97. to enable LAME support by passing @code{--enable-libmp3lame} to configure.
  98. The mapping is particularly useful for DVD transcoding
  99. to get the desired audio language.
  100. NOTE: To see the supported input formats, use @code{ffmpeg -formats}.
  101. * You can extract images from a video:
  102. @example
  103. ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
  104. @end example
  105. This will extract one video frame per second from the video and will
  106. output them in files named @file{foo-001.jpeg}, @file{foo-002.jpeg},
  107. etc. Images will be rescaled to fit the new WxH values.
  108. The syntax @code{foo-%03d.jpeg} specifies to use a decimal number
  109. composed of three digits padded with zeroes to express the sequence
  110. number. It is the same syntax supported by the C printf function, but
  111. only formats accepting a normal integer are suitable.
  112. If you want to extract just a limited number of frames, you can use the
  113. above command in combination with the -vframes or -t option, or in
  114. combination with -ss to start extracting from a certain point in time.
  115. @c man end
  116. @chapter Invocation
  117. @section Syntax
  118. The generic syntax is:
  119. @example
  120. @c man begin SYNOPSIS
  121. ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
  122. @c man end
  123. @end example
  124. @c man begin DESCRIPTION
  125. As a general rule, options are applied to the next specified
  126. file. Therefore, order is important, and you can have the same
  127. option on the command line multiple times. Each occurrence is
  128. then applied to the next input or output file.
  129. * To set the video bitrate of the output file to 64kbit/s:
  130. @example
  131. ffmpeg -i input.avi -b 64k output.avi
  132. @end example
  133. * To force the frame rate of the output file to 24 fps:
  134. @example
  135. ffmpeg -i input.avi -r 24 output.avi
  136. @end example
  137. * To force the frame rate of the input file (valid for raw formats only)
  138. to 1 fps and the frame rate of the output file to 24 fps:
  139. @example
  140. ffmpeg -r 1 -i input.m2v -r 24 output.avi
  141. @end example
  142. The format option may be needed for raw input files.
  143. By default, FFmpeg tries to convert as losslessly as possible: It
  144. uses the same audio and video parameters for the outputs as the one
  145. specified for the inputs.
  146. @c man end
  147. @c man begin OPTIONS
  148. @section Main options
  149. @table @option
  150. @item -L
  151. Show license.
  152. @item -h
  153. Show help.
  154. @item -version
  155. Show version.
  156. @item -formats
  157. Show available formats, codecs, protocols, ...
  158. @item -f @var{fmt}
  159. Force format.
  160. @item -i @var{filename}
  161. input file name
  162. @item -y
  163. Overwrite output files.
  164. @item -t @var{duration}
  165. Restrict the transcoded/captured video sequence
  166. to the duration specified in seconds.
  167. @code{hh:mm:ss[.xxx]} syntax is also supported.
  168. @item -fs @var{limit_size}
  169. Set the file size limit.
  170. @item -ss @var{position}
  171. Seek to given time position in seconds.
  172. @code{hh:mm:ss[.xxx]} syntax is also supported.
  173. @item -itsoffset @var{offset}
  174. Set the input time offset in seconds.
  175. @code{[-]hh:mm:ss[.xxx]} syntax is also supported.
  176. This option affects all the input files that follow it.
  177. The offset is added to the timestamps of the input files.
  178. Specifying a positive offset means that the corresponding
  179. streams are delayed by 'offset' seconds.
  180. @item -title @var{string}
  181. Set the title.
  182. @item -timestamp @var{time}
  183. Set the timestamp.
  184. @item -author @var{string}
  185. Set the author.
  186. @item -copyright @var{string}
  187. Set the copyright.
  188. @item -comment @var{string}
  189. Set the comment.
  190. @item -album @var{string}
  191. Set the album.
  192. @item -track @var{number}
  193. Set the track.
  194. @item -year @var{number}
  195. Set the year.
  196. @item -v @var{number}
  197. Set the logging verbosity level.
  198. @item -target @var{type}
  199. Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd",
  200. "ntsc-svcd", ... ). All the format options (bitrate, codecs,
  201. buffer sizes) are then set automatically. You can just type:
  202. @example
  203. ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
  204. @end example
  205. Nevertheless you can specify additional options as long as you know
  206. they do not conflict with the standard, as in:
  207. @example
  208. ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
  209. @end example
  210. @item -dframes @var{number}
  211. Set the number of data frames to record.
  212. @item -scodec @var{codec}
  213. Force subtitle codec ('copy' to copy stream).
  214. @item -newsubtitle
  215. Add a new subtitle stream to the current output stream.
  216. @item -slang @var{code}
  217. Set the ISO 639 language code (3 letters) of the current subtitle stream.
  218. @end table
  219. @section Video Options
  220. @table @option
  221. @item -b @var{bitrate}
  222. Set the video bitrate in bit/s (default = 200 kb/s).
  223. @item -vframes @var{number}
  224. Set the number of video frames to record.
  225. @item -r @var{fps}
  226. Set frame rate (Hz value, fraction or abbreviation), (default = 25).
  227. @item -s @var{size}
  228. Set frame size. The format is @samp{wxh} (ffserver default = 160x128, ffmpeg default = same as source).
  229. The following abbreviations are recognized:
  230. @table @samp
  231. @item sqcif
  232. 128x96
  233. @item qcif
  234. 176x144
  235. @item cif
  236. 352x288
  237. @item 4cif
  238. 704x576
  239. @item qqvga
  240. 160x120
  241. @item qvga
  242. 320x240
  243. @item vga
  244. 640x480
  245. @item svga
  246. 800x600
  247. @item xga
  248. 1024x768
  249. @item uxga
  250. 1600x1200
  251. @item qxga
  252. 2048x1536
  253. @item sxga
  254. 1280x1024
  255. @item qsxga
  256. 2560x2048
  257. @item hsxga
  258. 5120x4096
  259. @item wvga
  260. 852x480
  261. @item wxga
  262. 1366x768
  263. @item wsxga
  264. 1600x1024
  265. @item wuxga
  266. 1920x1200
  267. @item woxga
  268. 2560x1600
  269. @item wqsxga
  270. 3200x2048
  271. @item wquxga
  272. 3840x2400
  273. @item whsxga
  274. 6400x4096
  275. @item whuxga
  276. 7680x4800
  277. @item cga
  278. 320x200
  279. @item ega
  280. 640x350
  281. @item hd480
  282. 852x480
  283. @item hd720
  284. 1280x720
  285. @item hd1080
  286. 1920x1080
  287. @end table
  288. @item -aspect @var{aspect}
  289. Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
  290. @item -croptop @var{size}
  291. Set top crop band size (in pixels).
  292. @item -cropbottom @var{size}
  293. Set bottom crop band size (in pixels).
  294. @item -cropleft @var{size}
  295. Set left crop band size (in pixels).
  296. @item -cropright @var{size}
  297. Set right crop band size (in pixels).
  298. @item -padtop @var{size}
  299. Set top pad band size (in pixels).
  300. @item -padbottom @var{size}
  301. Set bottom pad band size (in pixels).
  302. @item -padleft @var{size}
  303. Set left pad band size (in pixels).
  304. @item -padright @var{size}
  305. Set right pad band size (in pixels).
  306. @item -padcolor @var{hex_color}
  307. Set color of padded bands. The value for padcolor is expressed
  308. as a six digit hexadecimal number where the first two digits
  309. represent red, the middle two digits green and last two digits
  310. blue (default = 000000 (black)).
  311. @item -vn
  312. Disable video recording.
  313. @item -bt @var{tolerance}
  314. Set video bitrate tolerance (in bits, default 4000k).
  315. Has a minimum value of: (target_bitrate/target_framerate).
  316. In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
  317. willing to deviate from the target average bitrate value. This is
  318. not related to min/max bitrate. Lowering tolerance too much has
  319. an adverse effect on quality.
  320. @item -maxrate @var{bitrate}
  321. Set max video bitrate (in bit/s).
  322. Requires -bufsize to be set.
  323. @item -minrate @var{bitrate}
  324. Set min video bitrate (in bit/s).
  325. Most useful in setting up a CBR encode:
  326. @example
  327. ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
  328. @end example
  329. It is of little use elsewise.
  330. @item -bufsize @var{size}
  331. Set video buffer verifier buffer size (in bits).
  332. @item -vcodec @var{codec}
  333. Force video codec to @var{codec}. Use the @code{copy} special value to
  334. tell that the raw codec data must be copied as is.
  335. @item -sameq
  336. Use same video quality as source (implies VBR).
  337. @item -pass @var{n}
  338. Select the pass number (1 or 2). It is useful to do two pass
  339. encoding. The statistics of the video are recorded in the first
  340. pass and the video is generated at the exact requested bitrate
  341. in the second pass.
  342. @item -passlogfile @var{file}
  343. Set two pass logfile name to @var{file}.
  344. @item -newvideo
  345. Add a new video stream to the current output stream.
  346. @end table
  347. @section Advanced Video Options
  348. @table @option
  349. @item -pix_fmt @var{format}
  350. Set pixel format. Use 'list' as parameter to show all the supported
  351. pixel formats.
  352. @item -sws_flags @var{flags}
  353. Set SwScaler flags (only available when compiled with swscale support).
  354. @item -g @var{gop_size}
  355. Set the group of pictures size.
  356. @item -intra
  357. Use only intra frames.
  358. @item -vdt @var{n}
  359. Discard threshold.
  360. @item -qscale @var{q}
  361. Use fixed video quantizer scale (VBR).
  362. @item -qmin @var{q}
  363. minimum video quantizer scale (VBR)
  364. @item -qmax @var{q}
  365. maximum video quantizer scale (VBR)
  366. @item -qdiff @var{q}
  367. maximum difference between the quantizer scales (VBR)
  368. @item -qblur @var{blur}
  369. video quantizer scale blur (VBR) (range 0.0 - 1.0)
  370. @item -qcomp @var{compression}
  371. video quantizer scale compression (VBR) (default 0.5).
  372. Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
  373. @item -lmin @var{lambda}
  374. minimum video lagrange factor (VBR)
  375. @item -lmax @var{lambda}
  376. max video lagrange factor (VBR)
  377. @item -mblmin @var{lambda}
  378. minimum macroblock quantizer scale (VBR)
  379. @item -mblmax @var{lambda}
  380. maximum macroblock quantizer scale (VBR)
  381. These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
  382. but you may use the QP2LAMBDA constant to easily convert from 'q' units:
  383. @example
  384. ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
  385. @end example
  386. @item -rc_init_cplx @var{complexity}
  387. initial complexity for single pass encoding
  388. @item -b_qfactor @var{factor}
  389. qp factor between P- and B-frames
  390. @item -i_qfactor @var{factor}
  391. qp factor between P- and I-frames
  392. @item -b_qoffset @var{offset}
  393. qp offset between P- and B-frames
  394. @item -i_qoffset @var{offset}
  395. qp offset between P- and I-frames
  396. @item -rc_eq @var{equation}
  397. Set rate control equation (@pxref{FFmpeg formula
  398. evaluator}) (default = @code{tex^qComp}).
  399. @item -rc_override @var{override}
  400. rate control override for specific intervals
  401. @item -me_method @var{method}
  402. Set motion estimation method to @var{method}.
  403. Available methods are (from lowest to best quality):
  404. @table @samp
  405. @item zero
  406. Try just the (0, 0) vector.
  407. @item phods
  408. @item log
  409. @item x1
  410. @item hex
  411. @item umh
  412. @item epzs
  413. (default method)
  414. @item full
  415. exhaustive search (slow and marginally better than epzs)
  416. @end table
  417. @item -dct_algo @var{algo}
  418. Set DCT algorithm to @var{algo}. Available values are:
  419. @table @samp
  420. @item 0
  421. FF_DCT_AUTO (default)
  422. @item 1
  423. FF_DCT_FASTINT
  424. @item 2
  425. FF_DCT_INT
  426. @item 3
  427. FF_DCT_MMX
  428. @item 4
  429. FF_DCT_MLIB
  430. @item 5
  431. FF_DCT_ALTIVEC
  432. @end table
  433. @item -idct_algo @var{algo}
  434. Set IDCT algorithm to @var{algo}. Available values are:
  435. @table @samp
  436. @item 0
  437. FF_IDCT_AUTO (default)
  438. @item 1
  439. FF_IDCT_INT
  440. @item 2
  441. FF_IDCT_SIMPLE
  442. @item 3
  443. FF_IDCT_SIMPLEMMX
  444. @item 4
  445. FF_IDCT_LIBMPEG2MMX
  446. @item 5
  447. FF_IDCT_PS2
  448. @item 6
  449. FF_IDCT_MLIB
  450. @item 7
  451. FF_IDCT_ARM
  452. @item 8
  453. FF_IDCT_ALTIVEC
  454. @item 9
  455. FF_IDCT_SH4
  456. @item 10
  457. FF_IDCT_SIMPLEARM
  458. @end table
  459. @item -er @var{n}
  460. Set error resilience to @var{n}.
  461. @table @samp
  462. @item 1
  463. FF_ER_CAREFUL (default)
  464. @item 2
  465. FF_ER_COMPLIANT
  466. @item 3
  467. FF_ER_AGGRESSIVE
  468. @item 4
  469. FF_ER_VERY_AGGRESSIVE
  470. @end table
  471. @item -ec @var{bit_mask}
  472. Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
  473. the following values:
  474. @table @samp
  475. @item 1
  476. FF_EC_GUESS_MVS (default = enabled)
  477. @item 2
  478. FF_EC_DEBLOCK (default = enabled)
  479. @end table
  480. @item -bf @var{frames}
  481. Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
  482. @item -mbd @var{mode}
  483. macroblock decision
  484. @table @samp
  485. @item 0
  486. FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg).
  487. @item 1
  488. FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
  489. @item 2
  490. FF_MB_DECISION_RD: rate distortion
  491. @end table
  492. @item -4mv
  493. Use four motion vector by macroblock (MPEG-4 only).
  494. @item -part
  495. Use data partitioning (MPEG-4 only).
  496. @item -bug @var{param}
  497. Work around encoder bugs that are not auto-detected.
  498. @item -strict @var{strictness}
  499. How strictly to follow the standards.
  500. @item -aic
  501. Enable Advanced intra coding (h263+).
  502. @item -umv
  503. Enable Unlimited Motion Vector (h263+)
  504. @item -deinterlace
  505. Deinterlace pictures.
  506. @item -ilme
  507. Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
  508. Use this option if your input file is interlaced and you want
  509. to keep the interlaced format for minimum losses.
  510. The alternative is to deinterlace the input stream with
  511. @option{-deinterlace}, but deinterlacing introduces losses.
  512. @item -psnr
  513. Calculate PSNR of compressed frames.
  514. @item -vstats
  515. Dump video coding statistics to @file{vstats_HHMMSS.log}.
  516. @item -vstats_file @var{file}
  517. Dump video coding statistics to @var{file}.
  518. @item -vhook @var{module}
  519. Insert video processing @var{module}. @var{module} contains the module
  520. name and its parameters separated by spaces.
  521. @item -top @var{n}
  522. top=1/bottom=0/auto=-1 field first
  523. @item -dc @var{precision}
  524. Intra_dc_precision.
  525. @item -vtag @var{fourcc/tag}
  526. Force video tag/fourcc.
  527. @item -qphist
  528. Show QP histogram.
  529. @item -vbsf @var{bitstream_filter}
  530. Bitstream filters available are "dump_extra", "remove_extra", "noise", "h264_mp4toannexb", "imxdump", "mjpegadump".
  531. @example
  532. ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264
  533. @end example
  534. @end table
  535. @section Audio Options
  536. @table @option
  537. @item -aframes @var{number}
  538. Set the number of audio frames to record.
  539. @item -ar @var{freq}
  540. Set the audio sampling frequency (default = 44100 Hz).
  541. @item -ab @var{bitrate}
  542. Set the audio bitrate in bit/s (default = 64k).
  543. @item -ac @var{channels}
  544. Set the number of audio channels (default = 1).
  545. @item -an
  546. Disable audio recording.
  547. @item -acodec @var{codec}
  548. Force audio codec to @var{codec}. Use the @code{copy} special value to
  549. specify that the raw codec data must be copied as is.
  550. @item -newaudio
  551. Add a new audio track to the output file. If you want to specify parameters,
  552. do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..).
  553. Mapping will be done automatically, if the number of output streams is equal to
  554. the number of input streams, else it will pick the first one that matches. You
  555. can override the mapping using @code{-map} as usual.
  556. Example:
  557. @example
  558. ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio
  559. @end example
  560. @item -alang @var{code}
  561. Set the ISO 639 language code (3 letters) of the current audio stream.
  562. @end table
  563. @section Advanced Audio options:
  564. @table @option
  565. @item -atag @var{fourcc/tag}
  566. Force audio tag/fourcc.
  567. @item -absf @var{bitstream_filter}
  568. Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
  569. @end table
  570. @section Subtitle options:
  571. @table @option
  572. @item -scodec @var{codec}
  573. Force subtitle codec ('copy' to copy stream).
  574. @item -newsubtitle
  575. Add a new subtitle stream to the current output stream.
  576. @item -slang @var{code}
  577. Set the ISO 639 language code (3 letters) of the current subtitle stream.
  578. @item -sbsf @var{bitstream_filter}
  579. Bitstream filters available are "mov2textsub", "text2movsub".
  580. @example
  581. ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
  582. @end example
  583. @end table
  584. @section Audio/Video grab options
  585. @table @option
  586. @item -vc @var{channel}
  587. Set video grab channel (DV1394 only).
  588. @item -tvstd @var{standard}
  589. Set television standard (NTSC, PAL (SECAM)).
  590. @item -isync
  591. Synchronize read on input.
  592. @end table
  593. @section Advanced options
  594. @table @option
  595. @item -map @var{input_stream_id}[:@var{sync_stream_id}]
  596. Set stream mapping from input streams to output streams.
  597. Just enumerate the input streams in the order you want them in the output.
  598. @var{sync_stream_id} if specified sets the input stream to sync
  599. against.
  600. @item -map_meta_data @var{outfile}:@var{infile}
  601. Set meta data information of @var{outfile} from @var{infile}.
  602. @item -debug
  603. Print specific debug info.
  604. @item -benchmark
  605. Add timings for benchmarking.
  606. @item -dump
  607. Dump each input packet.
  608. @item -hex
  609. When dumping packets, also dump the payload.
  610. @item -bitexact
  611. Only use bit exact algorithms (for codec testing).
  612. @item -ps @var{size}
  613. Set packet size in bits.
  614. @item -re
  615. Read input at native frame rate. Mainly used to simulate a grab device.
  616. @item -loop_input
  617. Loop over the input stream. Currently it works only for image
  618. streams. This option is used for automatic FFserver testing.
  619. @item -loop_output @var{number_of_times}
  620. Repeatedly loop output for formats that support looping such as animated GIF
  621. (0 will loop the output infinitely).
  622. @item -threads @var{count}
  623. Thread count.
  624. @item -vsync @var{parameter}
  625. Video sync method. Video will be stretched/squeezed to match the timestamps,
  626. it is done by duplicating and dropping frames. With -map you can select from
  627. which stream the timestamps should be taken. You can leave either video or
  628. audio unchanged and sync the remaining stream(s) to the unchanged one.
  629. @item -async @var{samples_per_second}
  630. Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
  631. the parameter is the maximum samples per second by which the audio is changed.
  632. -async 1 is a special case where only the start of the audio stream is corrected
  633. without any later correction.
  634. @item -copyts
  635. Copy timestamps from input to output.
  636. @item -shortest
  637. Finish encoding when the shortest input stream ends.
  638. @item -dts_delta_threshold
  639. Timestamp discontinuity delta threshold.
  640. @item -muxdelay @var{seconds}
  641. Set the maximum demux-decode delay.
  642. @item -muxpreload @var{seconds}
  643. Set the initial demux-decode delay.
  644. @end table
  645. @node FFmpeg formula evaluator
  646. @section FFmpeg formula evaluator
  647. When evaluating a rate control string, FFmpeg uses an internal formula
  648. evaluator.
  649. The following binary operators are available: @code{+}, @code{-},
  650. @code{*}, @code{/}, @code{^}.
  651. The following unary operators are available: @code{+}, @code{-},
  652. @code{(...)}.
  653. The following functions are available:
  654. @table @var
  655. @item sinh(x)
  656. @item cosh(x)
  657. @item tanh(x)
  658. @item sin(x)
  659. @item cos(x)
  660. @item tan(x)
  661. @item exp(x)
  662. @item log(x)
  663. @item squish(x)
  664. @item gauss(x)
  665. @item abs(x)
  666. @item max(x, y)
  667. @item min(x, y)
  668. @item gt(x, y)
  669. @item lt(x, y)
  670. @item eq(x, y)
  671. @item bits2qp(bits)
  672. @item qp2bits(qp)
  673. @end table
  674. The following constants are available:
  675. @table @var
  676. @item PI
  677. @item E
  678. @item iTex
  679. @item pTex
  680. @item tex
  681. @item mv
  682. @item fCode
  683. @item iCount
  684. @item mcVar
  685. @item var
  686. @item isI
  687. @item isP
  688. @item isB
  689. @item avgQP
  690. @item qComp
  691. @item avgIITex
  692. @item avgPITex
  693. @item avgPPTex
  694. @item avgBPTex
  695. @item avgTex
  696. @end table
  697. @c man end
  698. @ignore
  699. @setfilename ffmpeg
  700. @settitle FFmpeg video converter
  701. @c man begin SEEALSO
  702. ffserver(1), ffplay(1) and the HTML documentation of @file{ffmpeg}.
  703. @c man end
  704. @c man begin AUTHOR
  705. Fabrice Bellard
  706. @c man end
  707. @end ignore
  708. @section Protocols
  709. The file name can be @file{-} to read from standard input or to write
  710. to standard output.
  711. FFmpeg also handles many protocols specified with an URL syntax.
  712. Use 'ffmpeg -formats' to see a list of the supported protocols.
  713. The protocol @code{http:} is currently used only to communicate with
  714. FFserver (see the FFserver documentation). When FFmpeg will be a
  715. video player it will also be used for streaming :-)
  716. @chapter Tips
  717. @itemize
  718. @item For streaming at very low bitrate application, use a low frame rate
  719. and a small GOP size. This is especially true for RealVideo where
  720. the Linux player does not seem to be very fast, so it can miss
  721. frames. An example is:
  722. @example
  723. ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
  724. @end example
  725. @item The parameter 'q' which is displayed while encoding is the current
  726. quantizer. The value 1 indicates that a very good quality could
  727. be achieved. The value 31 indicates the worst quality. If q=31 appears
  728. too often, it means that the encoder cannot compress enough to meet
  729. your bitrate. You must either increase the bitrate, decrease the
  730. frame rate or decrease the frame size.
  731. @item If your computer is not fast enough, you can speed up the
  732. compression at the expense of the compression ratio. You can use
  733. '-me zero' to speed up motion estimation, and '-intra' to disable
  734. motion estimation completely (you have only I-frames, which means it
  735. is about as good as JPEG compression).
  736. @item To have very low audio bitrates, reduce the sampling frequency
  737. (down to 22050 kHz for MPEG audio, 22050 or 11025 for AC3).
  738. @item To have a constant quality (but a variable bitrate), use the option
  739. '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
  740. quality).
  741. @item When converting video files, you can use the '-sameq' option which
  742. uses the same quality factor in the encoder as in the decoder.
  743. It allows almost lossless encoding.
  744. @end itemize
  745. @bye