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.

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