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.

947 lines
26KB

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