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.

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