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.

1189 lines
38KB

  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 the parameters, when
  13. possible. You have usually to give only the target bitrate you want.
  14. FFmpeg can also convert from any sample rate to any other, and resize
  15. video on the fly with a high quality polyphase filter.
  16. @chapter Quick Start
  17. @c man begin EXAMPLES
  18. @section Video and Audio grabbing
  19. FFmpeg can use a video4linux compatible video source and any Open Sound
  20. System audio source:
  21. @example
  22. ffmpeg /tmp/out.mpg
  23. @end example
  24. Note that you must activate the right video source and channel before
  25. launching ffmpeg. You can use any TV viewer such as xawtv
  26. (@url{http://bytesex.org/xawtv/}) by Gerd Knorr which I find very
  27. good. You must also set correctly the audio recording levels with a
  28. standard mixer.
  29. @section Video and Audio file format conversion
  30. * ffmpeg can use any supported file format and protocol as input:
  31. Examples:
  32. * You can input from YUV files:
  33. @example
  34. ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
  35. @end example
  36. It will use the files:
  37. @example
  38. /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
  39. /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
  40. @end example
  41. The Y files use twice the resolution of the U and V files. They are
  42. raw files, without header. They can be generated by all decent video
  43. decoders. You must specify the size of the image with the @option{-s} option
  44. if ffmpeg cannot guess it.
  45. * You can input from a RAW YUV420P file:
  46. @example
  47. ffmpeg -i /tmp/test.yuv /tmp/out.avi
  48. @end example
  49. The RAW YUV420P is a file containing RAW YUV planar, for each frame first
  50. come the Y plane followed by U and V planes, which are half vertical and
  51. horizontal resolution.
  52. * You can output to a RAW YUV420P file:
  53. @example
  54. ffmpeg -i mydivx.avi -o hugefile.yuv
  55. @end example
  56. * You can set several input files and output files:
  57. @example
  58. ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
  59. @end example
  60. Convert the audio file a.wav and the raw yuv video file a.yuv
  61. to mpeg file a.mpg
  62. * You can also do audio and video conversions at the same time:
  63. @example
  64. ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
  65. @end example
  66. Convert the sample rate of a.wav to 22050 Hz and encode it to MPEG audio.
  67. * You can encode to several formats at the same time and define a
  68. mapping from input stream to output streams:
  69. @example
  70. ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0
  71. @end example
  72. Convert a.wav to a.mp2 at 64 kbits and b.mp2 at 128 kbits. '-map
  73. file:index' specify which input stream is used for each output
  74. stream, in the order of the definition of output streams.
  75. * You can transcode decrypted VOBs
  76. @example
  77. ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800 -g 300 -bf 2 -acodec mp3 -ab 128 snatch.avi
  78. @end example
  79. This is a typical DVD ripper example, input from a VOB file, output
  80. to an AVI file with MPEG-4 video and MP3 audio, note that in this
  81. command we use B frames so the MPEG-4 stream is DivX5 compatible, GOP
  82. size is 300 that means an INTRA frame every 10 seconds for 29.97 fps
  83. input video. Also the audio stream is MP3 encoded so you need LAME
  84. support which is enabled using @code{--enable-mp3lame} when
  85. configuring. The mapping is particularly useful for DVD transcoding
  86. to get the desired audio language.
  87. NOTE: to see the supported input formats, use @code{ffmpeg -formats}.
  88. @c man end
  89. @chapter Invocation
  90. @section Syntax
  91. The generic syntax is:
  92. @example
  93. @c man begin SYNOPSIS
  94. ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
  95. @c man end
  96. @end example
  97. @c man begin DESCRIPTION
  98. If no input file is given, audio/video grabbing is done.
  99. As a general rule, options are applied to the next specified
  100. file. For example, if you give the @option{-b 64} option, it sets the video
  101. bitrate of the next file. Format option may be needed for raw input
  102. files.
  103. By default, ffmpeg tries to convert as losslessly as possible: it
  104. uses the same audio and video parameter for the outputs as the one
  105. specified for the inputs.
  106. @c man end
  107. @c man begin OPTIONS
  108. @section Main options
  109. @table @option
  110. @item -L
  111. show license
  112. @item -h
  113. show help
  114. @item -formats
  115. show available formats, codecs, protocols, ...
  116. @item -f fmt
  117. force format
  118. @item -i filename
  119. input file name
  120. @item -y
  121. overwrite output files
  122. @item -t duration
  123. set the recording time in seconds. @code{hh:mm:ss[.xxx]} syntax is also
  124. supported.
  125. @item -ss position
  126. seek to given time position. @code{hh:mm:ss[.xxx]} syntax is also
  127. supported.
  128. @item -title string
  129. set the title
  130. @item -author string
  131. set the author
  132. @item -copyright string
  133. set the copyright
  134. @item -comment string
  135. set the comment
  136. @item -target type
  137. specify target file type ("vcd", "svcd", "dvd", "dv", "pal-vcd", "ntsc-svcd", ... ). All the format
  138. options (bitrate, codecs, buffer sizes) are automatically set by this
  139. option. You can just type:
  140. @example
  141. ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
  142. @end example
  143. Nevertheless you can specify additional options as long as you know they do not compromise the
  144. standard, as in:
  145. @example
  146. ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
  147. @end example
  148. @item -hq
  149. activate high quality settings
  150. @item -itsoffset offset
  151. set the input time offset in seconds. @code{[-]hh:mm:ss[.xxx]} syntax
  152. is also supported. This option affects all the input files that
  153. follow it. The offset is added to the input files' timestamps;
  154. specifying a positive offset means that the corresponding streams are
  155. delayed by 'offset' seconds.
  156. @end table
  157. @section Video Options
  158. @table @option
  159. @item -b bitrate
  160. set the video bitrate in kbit/s (default = 200 kb/s)
  161. @item -r fps
  162. set frame rate (default = 25)
  163. @item -s size
  164. set frame size. The format is @samp{WxH} (default 160x128). The
  165. following abbreviations are recognized:
  166. @table @samp
  167. @item sqcif
  168. 128x96
  169. @item qcif
  170. 176x144
  171. @item cif
  172. 352x288
  173. @item 4cif
  174. 704x576
  175. @end table
  176. @item -aspect aspect
  177. set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
  178. @item -croptop size
  179. set top crop band size (in pixels)
  180. @item -cropbottom size
  181. set bottom crop band size (in pixels)
  182. @item -cropleft size
  183. set left crop band size (in pixels)
  184. @item -cropright size
  185. set right crop band size (in pixels)
  186. @item -padtop size
  187. set top pad band size (in pixels)
  188. @item -padbottom size
  189. set bottom pad band size (in pixels)
  190. @item -padleft size
  191. set left pad band size (in pixels)
  192. @item -padright size
  193. set right pad band size (in pixels)
  194. @item -padcolor (hex color)
  195. set color of padded bands. The value for pad color is expressed
  196. as a six digit hexidecimal number where the first two digits represent red,
  197. middle two digits green and last two digits blue. Defaults to 000000 (black)
  198. @item -vn
  199. disable video recording
  200. @item -bt tolerance
  201. set video bitrate tolerance (in kbit/s)
  202. @item -maxrate bitrate
  203. set max video bitrate tolerance (in kbit/s)
  204. @item -minrate bitrate
  205. set min video bitrate tolerance (in kbit/s)
  206. @item -bufsize size
  207. set ratecontrol buffere size (in kbit)
  208. @item -vcodec codec
  209. force video codec to @var{codec}. Use the @code{copy} special value to
  210. tell that the raw codec data must be copied as is.
  211. @item -sameq
  212. use same video quality as source (implies VBR)
  213. @item -pass n
  214. select the pass number (1 or 2). It is useful to do two pass
  215. encoding. The statistics of the video are recorded in the first pass and
  216. the video at the exact requested bit rate is generated in the second
  217. pass.
  218. @item -passlogfile file
  219. select two pass log file name to @var{file}.
  220. @end table
  221. @section Advanced Video Options
  222. @table @option
  223. @item -g gop_size
  224. set the group of picture size
  225. @item -intra
  226. use only intra frames
  227. @item -qscale q
  228. use fixed video quantiser scale (VBR)
  229. @item -qmin q
  230. min video quantiser scale (VBR)
  231. @item -qmax q
  232. max video quantiser scale (VBR)
  233. @item -qdiff q
  234. max difference between the quantiser scale (VBR)
  235. @item -qblur blur
  236. video quantiser scale blur (VBR)
  237. @item -qcomp compression
  238. video quantiser scale compression (VBR)
  239. @item -rc_init_cplx complexity
  240. initial complexity for 1-pass encoding
  241. @item -b_qfactor factor
  242. qp factor between p and b frames
  243. @item -i_qfactor factor
  244. qp factor between p and i frames
  245. @item -b_qoffset offset
  246. qp offset between p and b frames
  247. @item -i_qoffset offset
  248. qp offset between p and i frames
  249. @item -rc_eq equation
  250. set rate control equation (@pxref{FFmpeg formula
  251. evaluator}). Default is @code{tex^qComp}.
  252. @item -rc_override override
  253. rate control override for specific intervals
  254. @item -me method
  255. set motion estimation method to @var{method}. Available methods are
  256. (from lower to best quality):
  257. @table @samp
  258. @item zero
  259. Try just the (0, 0) vector.
  260. @item phods
  261. @item log
  262. @item x1
  263. @item epzs
  264. (default method)
  265. @item full
  266. exhaustive search (slow and marginally better than epzs)
  267. @end table
  268. @item -dct_algo algo
  269. set dct algorithm to @var{algo}. Available values are:
  270. @table @samp
  271. @item 0
  272. FF_DCT_AUTO (default)
  273. @item 1
  274. FF_DCT_FASTINT
  275. @item 2
  276. FF_DCT_INT
  277. @item 3
  278. FF_DCT_MMX
  279. @item 4
  280. FF_DCT_MLIB
  281. @item 5
  282. FF_DCT_ALTIVEC
  283. @end table
  284. @item -idct_algo algo
  285. set idct algorithm to @var{algo}. Available values are:
  286. @table @samp
  287. @item 0
  288. FF_IDCT_AUTO (default)
  289. @item 1
  290. FF_IDCT_INT
  291. @item 2
  292. FF_IDCT_SIMPLE
  293. @item 3
  294. FF_IDCT_SIMPLEMMX
  295. @item 4
  296. FF_IDCT_LIBMPEG2MMX
  297. @item 5
  298. FF_IDCT_PS2
  299. @item 6
  300. FF_IDCT_MLIB
  301. @item 7
  302. FF_IDCT_ARM
  303. @item 8
  304. FF_IDCT_ALTIVEC
  305. @item 9
  306. FF_IDCT_SH4
  307. @item 10
  308. FF_IDCT_SIMPLEARM
  309. @end table
  310. @item -er n
  311. set error resilience to @var{n}.
  312. @table @samp
  313. @item 1
  314. FF_ER_CAREFULL (default)
  315. @item 2
  316. FF_ER_COMPLIANT
  317. @item 3
  318. FF_ER_AGGRESSIVE
  319. @item 4
  320. FF_ER_VERY_AGGRESSIVE
  321. @end table
  322. @item -ec bit_mask
  323. set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
  324. the following values:
  325. @table @samp
  326. @item 1
  327. FF_EC_GUESS_MVS (default=enabled)
  328. @item 2
  329. FF_EC_DEBLOCK (default=enabled)
  330. @end table
  331. @item -bf frames
  332. use 'frames' B frames (supported for MPEG-1, MPEG-2 and MPEG-4)
  333. @item -mbd mode
  334. macroblock decision
  335. @table @samp
  336. @item 0
  337. FF_MB_DECISION_SIMPLE: use mb_cmp (cannot change it yet in ffmpeg)
  338. @item 1
  339. FF_MB_DECISION_BITS: chooses the one which needs the fewest bits
  340. @item 2
  341. FF_MB_DECISION_RD: rate distoration
  342. @end table
  343. @item -4mv
  344. use four motion vector by macroblock (only MPEG-4)
  345. @item -part
  346. use data partitioning (only MPEG-4)
  347. @item -bug param
  348. workaround not auto detected encoder bugs
  349. @item -strict strictness
  350. how strictly to follow the standarts
  351. @item -aic
  352. enable Advanced intra coding (h263+)
  353. @item -umv
  354. enable Unlimited Motion Vector (h263+)
  355. @item -deinterlace
  356. deinterlace pictures
  357. @item -interlace
  358. force interlacing support in encoder (only MPEG-2 and MPEG-4). Use this option
  359. if your input file is interlaced and if you want to keep the interlaced
  360. format for minimum losses. The alternative is to deinterlace the input
  361. stream with @option{-deinterlace}, but deinterlacing introduces more
  362. losses.
  363. @item -psnr
  364. calculate PSNR of compressed frames
  365. @item -vstats
  366. dump video coding statistics to @file{vstats_HHMMSS.log}.
  367. @item -vhook module
  368. insert video processing @var{module}. @var{module} contains the module
  369. name and its parameters separated by spaces.
  370. @end table
  371. @section Audio Options
  372. @table @option
  373. @item -ar freq
  374. set the audio sampling freq (default = 44100 Hz)
  375. @item -ab bitrate
  376. set the audio bitrate in kbit/s (default = 64)
  377. @item -ac channels
  378. set the number of audio channels (default = 1)
  379. @item -an
  380. disable audio recording
  381. @item -acodec codec
  382. force audio codec to @var{codec}. Use the @code{copy} special value to
  383. tell that the raw codec data must be copied as is.
  384. @end table
  385. @section Audio/Video grab options
  386. @table @option
  387. @item -vd device
  388. set video grab device (e.g. @file{/dev/video0})
  389. @item -vc channel
  390. set video grab channel (DV1394 only)
  391. @item -tvstd standard
  392. set television standard (NTSC, PAL (SECAM))
  393. @item -dv1394
  394. set DV1394 grab
  395. @item -ad device
  396. set audio device (e.g. @file{/dev/dsp})
  397. @end table
  398. @section Advanced options
  399. @table @option
  400. @item -map file:stream
  401. set input stream mapping
  402. @item -debug
  403. print specific debug info
  404. @item -benchmark
  405. add timings for benchmarking
  406. @item -hex
  407. dump each input packet
  408. @item -bitexact
  409. only use bit exact algorithms (for codec testing)
  410. @item -ps size
  411. set packet size in bits
  412. @item -re
  413. read input at native frame rate. Mainly used to simulate a grab device.
  414. @item -loop
  415. loop over the input stream. Currently it works only for image
  416. streams. This option is used for ffserver automatic testing.
  417. @end table
  418. @node FFmpeg formula evaluator
  419. @section FFmpeg formula evaluator
  420. When evaluating a rate control string, FFmpeg uses an internal formula
  421. evaluator.
  422. The following binary operators are available: @code{+}, @code{-},
  423. @code{*}, @code{/}, @code{^}.
  424. The following unary operators are available: @code{+}, @code{-},
  425. @code{(...)}.
  426. The following functions are available:
  427. @table @var
  428. @item sinh(x)
  429. @item cosh(x)
  430. @item tanh(x)
  431. @item sin(x)
  432. @item cos(x)
  433. @item tan(x)
  434. @item exp(x)
  435. @item log(x)
  436. @item squish(x)
  437. @item gauss(x)
  438. @item abs(x)
  439. @item max(x, y)
  440. @item min(x, y)
  441. @item gt(x, y)
  442. @item lt(x, y)
  443. @item eq(x, y)
  444. @item bits2qp(bits)
  445. @item qp2bits(qp)
  446. @end table
  447. The following constants are available:
  448. @table @var
  449. @item PI
  450. @item E
  451. @item iTex
  452. @item pTex
  453. @item tex
  454. @item mv
  455. @item fCode
  456. @item iCount
  457. @item mcVar
  458. @item var
  459. @item isI
  460. @item isP
  461. @item isB
  462. @item avgQP
  463. @item qComp
  464. @item avgIITex
  465. @item avgPITex
  466. @item avgPPTex
  467. @item avgBPTex
  468. @item avgTex
  469. @end table
  470. @c man end
  471. @ignore
  472. @setfilename ffmpeg
  473. @settitle FFmpeg video converter
  474. @c man begin SEEALSO
  475. ffserver(1), ffplay(1) and the html documentation of @file{ffmpeg}.
  476. @c man end
  477. @c man begin AUTHOR
  478. Fabrice Bellard
  479. @c man end
  480. @end ignore
  481. @section Protocols
  482. The filename can be @file{-} to read from the standard input or to write
  483. to the standard output.
  484. ffmpeg handles also many protocols specified with the URL syntax.
  485. Use 'ffmpeg -formats' to have a list of the supported protocols.
  486. The protocol @code{http:} is currently used only to communicate with
  487. ffserver (see the ffserver documentation). When ffmpeg will be a
  488. video player it will also be used for streaming :-)
  489. @chapter Tips
  490. @itemize
  491. @item For streaming at very low bit rate application, use a low frame rate
  492. and a small gop size. This is especially true for real video where
  493. the Linux player does not seem to be very fast, so it can miss
  494. frames. An example is:
  495. @example
  496. ffmpeg -g 3 -r 3 -t 10 -b 50 -s qcif -f rv10 /tmp/b.rm
  497. @end example
  498. @item The parameter 'q' which is displayed while encoding is the current
  499. quantizer. The value of 1 indicates that a very good quality could
  500. be achieved. The value of 31 indicates the worst quality. If q=31
  501. too often, it means that the encoder cannot compress enough to meet
  502. your bit rate. You must either increase the bit rate, decrease the
  503. frame rate or decrease the frame size.
  504. @item If your computer is not fast enough, you can speed up the
  505. compression at the expense of the compression ratio. You can use
  506. '-me zero' to speed up motion estimation, and '-intra' to disable
  507. completely motion estimation (you have only I frames, which means it
  508. is about as good as JPEG compression).
  509. @item To have very low bitrates in audio, reduce the sampling frequency
  510. (down to 22050 kHz for mpeg audio, 22050 or 11025 for ac3).
  511. @item To have a constant quality (but a variable bitrate), use the option
  512. '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
  513. quality).
  514. @item When converting video files, you can use the '-sameq' option which
  515. uses in the encoder the same quality factor than in the decoder. It
  516. allows to be almost lossless in encoding.
  517. @end itemize
  518. @chapter Supported File Formats and Codecs
  519. You can use the @code{-formats} option to have an exhaustive list.
  520. @section File Formats
  521. FFmpeg supports the following file formats through the @code{libavformat}
  522. library:
  523. @multitable @columnfractions .4 .1 .1
  524. @item Supported File Format @tab Encoding @tab Decoding @tab Comments
  525. @item MPEG audio @tab X @tab X
  526. @item MPEG1 systems @tab X @tab X
  527. @tab muxed audio and video
  528. @item MPEG2 PS @tab X @tab X
  529. @tab also known as @code{VOB} file
  530. @item MPEG2 TS @tab @tab X
  531. @tab also known as DVB Transport Stream
  532. @item ASF@tab X @tab X
  533. @item AVI@tab X @tab X
  534. @item WAV@tab X @tab X
  535. @item Macromedia Flash@tab X @tab X
  536. @tab Only embedded audio is decoded
  537. @item FLV @tab X @tab X
  538. @tab Macromedia Flash video files
  539. @item Real Audio and Video @tab X @tab X
  540. @item Raw AC3 @tab X @tab X
  541. @item Raw MJPEG @tab X @tab X
  542. @item Raw MPEG video @tab X @tab X
  543. @item Raw PCM8/16 bits, mulaw/Alaw@tab X @tab X
  544. @item Raw CRI ADX audio @tab X @tab X
  545. @item Raw Shorten audio @tab @tab X
  546. @item SUN AU format @tab X @tab X
  547. @item NUT @tab X @tab X @tab NUT Open Container Format
  548. @item Quicktime @tab X @tab X
  549. @item MPEG4 @tab X @tab X
  550. @tab MPEG4 is a variant of Quicktime
  551. @item Raw MPEG4 video @tab X @tab X
  552. @item DV @tab X @tab X
  553. @item 4xm @tab @tab X
  554. @tab 4X Technologies format, used in some games
  555. @item Playstation STR @tab @tab X
  556. @item Id RoQ @tab @tab X
  557. @tab used in Quake III, Jedi Knight 2, other computer games
  558. @item Interplay MVE @tab @tab X
  559. @tab format used in various Interplay computer games
  560. @item WC3 Movie @tab @tab X
  561. @tab multimedia format used in Origin's Wing Commander III computer game
  562. @item Sega FILM/CPK @tab @tab X
  563. @tab used in many Sega Saturn console games
  564. @item Westwood Studios VQA/AUD @tab @tab X
  565. @tab Multimedia formats used in Westwood Studios games
  566. @item Id Cinematic (.cin) @tab @tab X
  567. @tab Used in Quake II
  568. @item FLIC format @tab @tab X
  569. @tab .fli/.flc files
  570. @item Sierra VMD @tab @tab X
  571. @tab used in Sierra CD-ROM games
  572. @item Sierra Online @tab @tab X
  573. @tab .sol files used in Sierra Online games
  574. @item Matroska @tab @tab X
  575. @item Electronic Arts Multimedia @tab @tab X
  576. @tab used in various EA games; files have extensions like WVE and UV2
  577. @item Nullsoft Video (NSV) format @tab @tab X
  578. @end multitable
  579. @code{X} means that the encoding (resp. decoding) is supported.
  580. @section Image Formats
  581. FFmpeg can read and write images for each frame of a video sequence. The
  582. following image formats are supported:
  583. @multitable @columnfractions .4 .1 .1
  584. @item Supported Image Format @tab Encoding @tab Decoding @tab Comments
  585. @item PGM, PPM @tab X @tab X
  586. @item PAM @tab X @tab X @tab PAM is a PNM extension with alpha support
  587. @item PGMYUV @tab X @tab X @tab PGM with U and V components in YUV 4:2:0
  588. @item JPEG @tab X @tab X @tab Progressive JPEG is not supported
  589. @item .Y.U.V @tab X @tab X @tab One raw file per component
  590. @item Animated GIF @tab X @tab X @tab Only uncompressed GIFs are generated
  591. @item PNG @tab X @tab X @tab 2 bit and 4 bit/pixel not supported yet
  592. @item SGI @tab X @tab X @tab SGI RGB image format
  593. @end multitable
  594. @code{X} means that the encoding (resp. decoding) is supported.
  595. @section Video Codecs
  596. @multitable @columnfractions .4 .1 .1 .7
  597. @item Supported Codec @tab Encoding @tab Decoding @tab Comments
  598. @item MPEG1 video @tab X @tab X
  599. @item MPEG2 video @tab X @tab X
  600. @item MPEG4 @tab X @tab X @tab Also known as DIVX4/5
  601. @item MSMPEG4 V1 @tab X @tab X
  602. @item MSMPEG4 V2 @tab X @tab X
  603. @item MSMPEG4 V3 @tab X @tab X @tab Also known as DIVX3
  604. @item WMV7 @tab X @tab X
  605. @item WMV8 @tab X @tab X @tab Not completely working
  606. @item H.261 @tab X @tab X
  607. @item H.263(+) @tab X @tab X @tab Also known as Real Video 1.0
  608. @item H.264 @tab @tab X
  609. @item MJPEG @tab X @tab X
  610. @item Lossless MJPEG @tab X @tab X
  611. @item Apple MJPEG-B @tab @tab X
  612. @item Sunplus MJPEG @tab @tab X @tab fourcc: SP5X
  613. @item DV @tab X @tab X
  614. @item Huff YUV @tab X @tab X
  615. @item FFmpeg Video 1 @tab X @tab X @tab Experimental lossless codec (fourcc: FFV1)
  616. @item FFmpeg Snow @tab X @tab X @tab Experimental wavelet codec (fourcc: SNOW)
  617. @item Asus v1 @tab X @tab X @tab fourcc: ASV1
  618. @item Asus v2 @tab X @tab X @tab fourcc: ASV2
  619. @item Creative YUV @tab @tab X @tab fourcc: CYUV
  620. @item Sorenson Video 1 @tab X @tab X @tab fourcc: SVQ1
  621. @item Sorenson Video 3 @tab @tab X @tab fourcc: SVQ3
  622. @item On2 VP3 @tab @tab X @tab still experimental
  623. @item Theora @tab @tab X @tab still experimental
  624. @item Intel Indeo 3 @tab @tab X @tab only works on i386 right now
  625. @item FLV @tab X @tab X @tab Sorenson H.263 used in Flash
  626. @item ATI VCR1 @tab @tab X @tab fourcc: VCR1
  627. @item ATI VCR2 @tab @tab X @tab fourcc: VCR2
  628. @item Cirrus Logic AccuPak @tab @tab X @tab fourcc: CLJR
  629. @item 4X Video @tab @tab X @tab used in certain computer games
  630. @item Sony Playstation MDEC @tab @tab X
  631. @item Id RoQ @tab @tab X @tab used in Quake III, Jedi Knight 2, other computer games
  632. @item Xan/WC3 @tab @tab X @tab used in Wing Commander III .MVE files
  633. @item Interplay Video @tab @tab X @tab used in Interplay .MVE files
  634. @item Apple Animation @tab @tab X @tab fourcc: 'rle '
  635. @item Apple Graphics @tab @tab X @tab fourcc: 'smc '
  636. @item Apple Video @tab @tab X @tab fourcc: rpza
  637. @item Apple QuickDraw @tab @tab X @tab fourcc: qdrw
  638. @item Cinepak @tab @tab X
  639. @item Microsoft RLE @tab @tab X
  640. @item Microsoft Video-1 @tab @tab X
  641. @item Westwood VQA @tab @tab X
  642. @item Id Cinematic Video @tab @tab X @tab used in Quake II
  643. @item Planar RGB @tab @tab X @tab fourcc: 8BPS
  644. @item FLIC video @tab @tab X
  645. @item Duck TrueMotion v1 @tab @tab X @tab fourcc: DUCK
  646. @item VMD Video @tab @tab X @tab used in Sierra VMD files
  647. @item MSZH @tab @tab X @tab Part of LCL
  648. @item ZLIB @tab X @tab X @tab Part of LCL, encoder experimental
  649. @item TechSmith Camtasia @tab @tab X @tab fourcc: TSCC
  650. @item IBM Ultimotion @tab @tab X @tab fourcc: ULTI
  651. @item Miro VideoXL @tab @tab X @tab fourcc: VIXL
  652. @item QPEG @tab @tab X @tab fourccs: QPEG, Q1.0, Q1.1
  653. @end multitable
  654. @code{X} means that the encoding (resp. decoding) is supported.
  655. Check at @url{http://www.mplayerhq.hu/~michael/codec-features.html} to
  656. get a precise comparison of FFmpeg MPEG4 codec compared to the other
  657. solutions.
  658. @section Audio Codecs
  659. @multitable @columnfractions .4 .1 .1 .1 .7
  660. @item Supported Codec @tab Encoding @tab Decoding @tab Comments
  661. @item MPEG audio layer 2 @tab IX @tab IX
  662. @item MPEG audio layer 1/3 @tab IX @tab IX
  663. @tab MP3 encoding is supported through the external library LAME
  664. @item AC3 @tab IX @tab IX
  665. @tab liba52 is used internally for decoding
  666. @item Vorbis @tab X @tab X
  667. @tab supported through the external library libvorbis
  668. @item WMA V1/V2 @tab @tab X
  669. @item AAC @tab X @tab X
  670. @tab supported through the external library libfaac/libfaad
  671. @item Microsoft ADPCM @tab X @tab X
  672. @item MS IMA ADPCM @tab X @tab X
  673. @item QT IMA ADPCM @tab @tab X
  674. @item 4X IMA ADPCM @tab @tab X
  675. @item G.726 ADPCM @tab X @tab X
  676. @item Duck DK3 IMA ADPCM @tab @tab X
  677. @tab used in some Sega Saturn console games
  678. @item Duck DK4 IMA ADPCM @tab @tab X
  679. @tab used in some Sega Saturn console games
  680. @item Westwood Studios IMA ADPCM @tab @tab X
  681. @tab used in Westwood Studios games like Command and Conquer
  682. @item SMJPEG IMA ADPCM @tab @tab X
  683. @tab used in certain Loki game ports
  684. @item CD-ROM XA ADPCM @tab @tab X
  685. @item CRI ADX ADPCM @tab X @tab X
  686. @tab used in Sega Dreamcast games
  687. @item Electronic Arts ADPCM @tab @tab X
  688. @tab used in various EA titles
  689. @item Creative ADPCM @tab @tab X
  690. @item RA144 @tab @tab X
  691. @tab Real 14400 bit/s codec
  692. @item RA288 @tab @tab X
  693. @tab Real 28800 bit/s codec
  694. @item RADnet @tab X @tab IX
  695. @tab Real lowbitrate AC3 codec, liba52 is used for decoding
  696. @item AMR-NB @tab X @tab X
  697. @tab supported through an external library
  698. @item AMR-WB @tab X @tab X
  699. @tab supported through an external library
  700. @item DV audio @tab @tab X
  701. @item Id RoQ DPCM @tab @tab X
  702. @tab used in Quake III, Jedi Knight 2, other computer games
  703. @item Interplay MVE DPCM @tab @tab X
  704. @tab used in various Interplay computer games
  705. @item Xan DPCM @tab @tab X
  706. @tab used in Origin's Wing Commander IV AVI files
  707. @item Sierra Online DPCM @tab @tab X
  708. @tab used in Sierra Online game audio files
  709. @item Apple MACE 3 @tab @tab X
  710. @item Apple MACE 6 @tab @tab X
  711. @item FLAC lossless audio @tab @tab X
  712. @item Shorten lossless audio @tab @tab X
  713. @item FFmpeg Sonic @tab X @tab X
  714. @tab Experimental lossy/lossless codec
  715. @end multitable
  716. @code{X} means that the encoding (resp. decoding) is supported.
  717. @code{I} means that an integer only version is available too (ensures highest
  718. performances on systems without hardware floating point support).
  719. @chapter Platform Specific information
  720. @section Linux
  721. ffmpeg should be compiled with at least GCC 2.95.3. GCC 3.2 is the
  722. preferred compiler now for ffmpeg. All future optimizations will depend on
  723. features only found in GCC 3.2.
  724. @section BSD
  725. @section Windows
  726. @subsection Native Windows compilation
  727. @itemize
  728. @item Install the current versions of MSYS and MinGW from
  729. @url{http://www.mingw.org/}. You can find detailed installation
  730. instructions in the download section and the FAQ.
  731. @item If you want to test the FFmpeg Simple Media Player, also download
  732. the MinGW development library of SDL 1.2.x
  733. (@file{SDL-devel-1.2.x-mingw32.tar.gz}) from
  734. @url{http://www.libsdl.org}. Unpack it in a temporary place, and
  735. unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
  736. directory. Edit the @file{sdl-config} script so that it gives the
  737. correct SDL directory when invoked.
  738. @item Extract the current version of FFmpeg (the latest release version or the current CVS snapshot whichever is recommended).
  739. @item Start the MSYS shell (file @file{msys.bat}).
  740. @item Change to the FFMPEG directory and follow
  741. the instructions of how to compile ffmpeg (file
  742. @file{INSTALL}). Usually, launching @file{./configure} and @file{make}
  743. suffices. If you have problems using SDL, verify that
  744. @file{sdl-config} can be launched from the MSYS command line.
  745. @item You can install FFmpeg in @file{Program Files/FFmpeg} by typing @file{make install}. Don't forget to copy @file{SDL.dll} at the place you launch
  746. @file{ffplay}.
  747. @end itemize
  748. Notes:
  749. @itemize
  750. @item The target @file{make wininstaller} can be used to create a
  751. Nullsoft based Windows installer for FFmpeg and FFplay. @file{SDL.dll}
  752. must be copied in the ffmpeg directory in order to build the
  753. installer.
  754. @item By using @code{./configure --enable-shared} when configuring ffmpeg,
  755. you can build @file{avcodec.dll} and @file{avformat.dll}. With
  756. @code{make install} you install the FFmpeg DLLs and the associated
  757. headers in @file{Program Files/FFmpeg}.
  758. @item Visual C++ compatibility: if you used @code{./configure --enable-shared}
  759. when configuring FFmpeg, then FFmpeg tries to use the Microsoft Visual
  760. C++ @code{lib} tool to build @code{avcodec.lib} and
  761. @code{avformat.lib}. With these libraries, you can link your Visual C++
  762. code directly with the FFmpeg DLLs.
  763. @end itemize
  764. @subsection Cross compilation for Windows with Linux
  765. You must use the MinGW cross compilation tools available at
  766. @url{http://www.mingw.org/}.
  767. Then configure ffmpeg with the following options:
  768. @example
  769. ./configure --enable-mingw32 --cross-prefix=i386-mingw32msvc-
  770. @end example
  771. (you can change the cross-prefix according to the prefix choosen for the
  772. MinGW tools).
  773. Then you can easily test ffmpeg with wine
  774. (@url{http://www.winehq.com/}).
  775. @section MacOS X
  776. @section BeOS
  777. The configure script should guess the configuration itself.
  778. Networking support is currently not finished.
  779. errno issues fixed by Andrew Bachmann.
  780. Old stuff:
  781. François Revol - revol at free dot fr - April 2002
  782. The configure script should guess the configuration itself,
  783. however I still didn't tested building on net_server version of BeOS.
  784. ffserver is broken (needs poll() implementation).
  785. There is still issues with errno codes, which are negative in BeOs, and
  786. that ffmpeg negates when returning. This ends up turning errors into
  787. valid results, then crashes.
  788. (To be fixed)
  789. @chapter Developers Guide
  790. @section API
  791. @itemize
  792. @item libavcodec is the library containing the codecs (both encoding and
  793. decoding). See @file{libavcodec/apiexample.c} to see how to use it.
  794. @item libavformat is the library containing the file formats handling (mux and
  795. demux code for several formats). See @file{ffplay.c} to use it in a
  796. player. See @file{output_example.c} to use it to generate audio or video
  797. streams.
  798. @end itemize
  799. @section Integrating libavcodec or libavformat in your program
  800. You can integrate all the source code of the libraries to link them
  801. statically to avoid any version problem. All you need is to provide a
  802. 'config.mak' and a 'config.h' in the parent directory. See the defines
  803. generated by ./configure to understand what is needed.
  804. You can use libavcodec or libavformat in your commercial program, but
  805. @emph{any patch you make must be published}. The best way to proceed is
  806. to send your patches to the ffmpeg mailing list.
  807. @node Coding Rules
  808. @section Coding Rules
  809. ffmpeg is programmed in the ISO C90 language with a few additional
  810. features from ISO C99, namely:
  811. @itemize @bullet
  812. @item
  813. the @samp{inline} keyword;
  814. @item
  815. @samp{//} comments;
  816. @item
  817. designated struct initializers (@samp{struct s x = @{ .i = 17 @};})
  818. @item
  819. compound literals (@samp{x = (struct s) @{ 17, 23 @};})
  820. @end itemize
  821. These features are supported by all compilers we care about, so we won't
  822. accept patches to remove their use unless they absolutely don't impair
  823. clarity and performance.
  824. All code must compile with gcc 2.95 and gcc 3.3. Currently, ffmpeg also
  825. compiles with several other compilers, such as the Compaq ccc compiler
  826. or Sun Studio 9, and we would like to keep it that way unless it would
  827. be exceedingly involved. To ensure compatibility, please don't use any
  828. additional C99 features or gcc extensions. Watch out especially for:
  829. @itemize @bullet
  830. @item
  831. mixing statements and declarations;
  832. @item
  833. @samp{long long} (use @samp{int64_t} instead);
  834. @item
  835. @samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
  836. @item
  837. gcc statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
  838. @end itemize
  839. Indent size is 4. The TAB character should not be used.
  840. The presentation is the one specified by 'indent -i4 -kr'.
  841. Main priority in ffmpeg is simplicity and small code size (=less
  842. bugs).
  843. Comments: use the JavaDoc/Doxygen
  844. format (see examples below) so that a documentation
  845. can be generated automatically. All non trivial functions should have a comment
  846. above it explaining what the function does, even if its just one sentance.
  847. All Structures and their member variables should be documented too.
  848. @example
  849. /**
  850.  * @@file mpeg.c
  851.  * mpeg codec.
  852.  * @@author ...
  853.  */
  854. /**
  855.  * Summary sentance.
  856.  * more text ...
  857.  * ...
  858.  */
  859. typedef struct Foobar@{
  860.     int var1; /**< var1 description */
  861.     int var2; ///< var2 description
  862.     /** var3 description */
  863.     int var3;
  864. @} Foobar;
  865. /**
  866.  * Summary sentance.
  867.  * more text ...
  868.  * ...
  869.  * @@param my_parameter description of my_parameter
  870.  * @@return return value description
  871.  */
  872. int myfunc(int my_parameter)
  873. ...
  874. @end example
  875. fprintf and printf are forbidden in libavformat and libavcodec,
  876. please use av_log() instead.
  877. @node CVS Policy
  878. @section CVS Policy
  879. @enumerate
  880. @item
  881. You must not commit code which breaks FFmpeg! (Meaning unfinished but
  882. enabled code which breaks compilation or compiles but does not work. Or
  883. breaks the regression tests)
  884. You can commit unfinished stuff (for testing etc), but it must be disabled
  885. (#ifdef etc) by default so it does not interfere with other developers'
  886. work.
  887. @item
  888. You don't have to over-test things. If it works for you, and you think it
  889. should work for others, too, then commit. If your code has problems
  890. (portability, exploits compiler bugs, unusual environment etc) they will be
  891. reported and eventually fixed.
  892. @item
  893. Do not commit unrelated changes together, split them into self-contained
  894. pieces.
  895. @item
  896. Do not change behavior of the program (renaming options etc) without
  897. first discussing it on the ffmpeg-dev mailing list. Do not remove
  898. functionality from the code. Just improve!
  899. Note: Redundant code can be removed
  900. @item
  901. Do not commit changes to the build system (Makefiles, configure script)
  902. which change behaviour, defaults etc, without asking first. The same
  903. applies to compiler warning fixes, trivial looking fixes and to code
  904. maintained by other developers. We usually have a reason for doing things
  905. the way we do. Send your changes as patches to the ffmpeg-dev mailing
  906. list, and if the code maintainers say OK, you may commit. This does not
  907. apply to files you wrote and/or maintain.
  908. @item
  909. We refuse source indentation and other cosmetic changes if they are mixed
  910. with functional changes, such commits will be rejected and removed. Every
  911. developer has his own indentation style, you should not change it. Of course
  912. if you (re)write something, you can use your own style, even though we would
  913. prefer if the indention throughout ffmpeg would be consistant (Many projects
  914. force a given indentation style - we don't.) If you really need to make
  915. indentation changes (try to avoid this), separate them strictly from real
  916. changes.
  917. NOTE: If you had to put if()@{ .. @} over a large (> 5 lines) chunk of code,
  918. then either do NOT change the indentation of the inner part within (don't
  919. move it to the right)! or do so in a seperate commit
  920. @item
  921. Always fill out the commit log message. Describe in a few lines what you
  922. changed and why. You can refer to mailing list postings if you fix a
  923. particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
  924. @item
  925. If you apply a patch by someone else, include the name and email address in
  926. the CVS log message. Since the ffmpeg-cvslog mailing list is publicly
  927. archived you should add some spam protection to the email address. Send an
  928. answer to ffmpeg-dev (or wherever you got the patch from) saying that
  929. you applied the patch.
  930. @item
  931. Do NOT commit to code actively maintained by others without permission. Send
  932. a patch to ffmpeg-dev instead.
  933. @item
  934. Subscribe to the ffmpeg-cvslog mailing list. The diffs of all CVS commits
  935. are sent there and reviewed by all the other developers. Bugs and possible
  936. improvements or general questions regarding commits are discussed there. We
  937. expect you to react if problems with your code are uncovered.
  938. @item
  939. Update the documentation if you change behavior or add features. If you are
  940. unsure how best to do this, send a patch to ffmpeg-dev, the documentation
  941. maintainer(s) will review and commit your stuff.
  942. @item
  943. Revert a commit ONLY in case of a big blunder like committing something not
  944. intended to be committed or committing a wrong file, the wrong version of a
  945. patch, cvs policy violation or broken code and you are going to recommit the
  946. right thing immediately.
  947. Never revert changes made a long time ago or buggy code. Fix it in the
  948. normal way instead.
  949. @item
  950. Never write to not allocated memory, never write over the end of arrays,
  951. always check values read from some untrusted source before using them as index
  952. into an array or otherwise risky things.
  953. @end enumerate
  954. We think our rules are not too hard. If you have comments, contact us.
  955. Note, these rules are mostly borrowed from the MPlayer project.
  956. @subsection Renaming/moving files or content of files
  957. You CANNOT do that. Post a request for such a change to the mailinglist
  958. Do NOT remove & readd a file - it will kill the changelog!!!!
  959. @section Submitting patches
  960. First, (@pxref{Coding Rules}) above if you didn't yet.
  961. When you submit your patch, try to send a unified diff (diff '-up'
  962. option). I cannot read other diffs :-)
  963. Run the regression tests before submitting a patch so that you can
  964. verify that there are no big problems.
  965. Patches should be posted as base64 encoded attachments (or any other
  966. encoding which ensures that the patch wont be trashed during
  967. transmission) to the ffmpeg-devel mailinglist, see
  968. @url{http://lists.sourceforge.net/lists/listinfo/ffmpeg-devel}
  969. It also helps quite a bit if you tell us what the patch does (for example
  970. 'replaces lrint by lrintf') , and why (for example '*bsd isnt c99 compliant
  971. and has no lrint()')
  972. We reply to all patches submitted and either apply or reject with some
  973. explanation why, but sometimes we are quite busy so it can take a week or 2
  974. @section Regression tests
  975. Before submitting a patch (or committing with CVS), you should at least
  976. test that you did not break anything.
  977. The regression test build a synthetic video stream and a synthetic
  978. audio stream. Then these are encoded then decoded with all codecs or
  979. formats. The CRC (or MD5) of each generated file is recorded in a
  980. result file. Then a 'diff' is launched with the reference results and
  981. the result file.
  982. The regression test then goes on to test the ffserver code with a
  983. limited set of streams. It is important that this step runs correctly
  984. as well.
  985. Run 'make test' to test all the codecs and formats.
  986. Run 'make fulltest' to test all the codecs, formats and ffserver.
  987. [Of course, some patches may change the regression tests results. In
  988. this case, the regression tests reference results shall be modified
  989. accordingly].
  990. @bye