ffmpeg-doc.texi 26 KB

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