ffmpeg-doc.texi 27 KB

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