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.

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