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.

981 lines
27KB

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