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.

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