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.

1071 lines
32KB

  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" or "dvd"). 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. @item -hq
  144. activate high quality settings
  145. @item -itsoffset offset
  146. set the input time offset in seconds. @code{[-]hh:mm:ss[.xxx]} syntax
  147. is also supported. This option affects all the input files that
  148. follow it. The offset is added to the input files' timestamps;
  149. specifying a positive offset means that the corresponding streams are
  150. delayed by 'offset' seconds.
  151. @end table
  152. @section Video Options
  153. @table @option
  154. @item -b bitrate
  155. set the video bitrate in kbit/s (default = 200 kb/s)
  156. @item -r fps
  157. set frame rate (default = 25)
  158. @item -s size
  159. set frame size. The format is @samp{WxH} (default 160x128). The
  160. following abbreviations are recognized:
  161. @table @samp
  162. @item sqcif
  163. 128x96
  164. @item qcif
  165. 176x144
  166. @item cif
  167. 352x288
  168. @item 4cif
  169. 704x576
  170. @end table
  171. @item -aspect aspect
  172. set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
  173. @item -croptop size
  174. set top crop band size (in pixels)
  175. @item -cropbottom size
  176. set bottom crop band size (in pixels)
  177. @item -cropleft size
  178. set left crop band size (in pixels)
  179. @item -cropright size
  180. set right crop band size (in pixels)
  181. @item -padtop size
  182. set top pad band size (in pixels)
  183. @item -padbottom size
  184. set bottom pad band size (in pixels)
  185. @item -padleft size
  186. set left pad band size (in pixels)
  187. @item -padright size
  188. set right pad band size (in pixels)
  189. @item -padcolor (hex color)
  190. set color of padded bands. The value for pad color is expressed
  191. as a six digit hexidecimal number where the first two digits represent red,
  192. middle two digits green and last two digits blue. Defaults to 000000 (black)
  193. @item -vn
  194. disable video recording
  195. @item -bt tolerance
  196. set video bitrate tolerance (in kbit/s)
  197. @item -maxrate bitrate
  198. set max video bitrate tolerance (in kbit/s)
  199. @item -minrate bitrate
  200. set min video bitrate tolerance (in kbit/s)
  201. @item -bufsize size
  202. set ratecontrol buffere size (in kbit)
  203. @item -vcodec codec
  204. force video codec to @var{codec}. Use the @code{copy} special value to
  205. tell that the raw codec data must be copied as is.
  206. @item -sameq
  207. use same video quality as source (implies VBR)
  208. @item -pass n
  209. select the pass number (1 or 2). It is useful to do two pass
  210. encoding. The statistics of the video are recorded in the first pass and
  211. the video at the exact requested bit rate is generated in the second
  212. pass.
  213. @item -passlogfile file
  214. select two pass log file name to @var{file}.
  215. @end table
  216. @section Advanced Video Options
  217. @table @option
  218. @item -g gop_size
  219. set the group of picture size
  220. @item -intra
  221. use only intra frames
  222. @item -qscale q
  223. use fixed video quantiser scale (VBR)
  224. @item -qmin q
  225. min video quantiser scale (VBR)
  226. @item -qmax q
  227. max video quantiser scale (VBR)
  228. @item -qdiff q
  229. max difference between the quantiser scale (VBR)
  230. @item -qblur blur
  231. video quantiser scale blur (VBR)
  232. @item -qcomp compression
  233. video quantiser scale compression (VBR)
  234. @item -rc_init_cplx complexity
  235. initial complexity for 1-pass encoding
  236. @item -b_qfactor factor
  237. qp factor between p and b frames
  238. @item -i_qfactor factor
  239. qp factor between p and i frames
  240. @item -b_qoffset offset
  241. qp offset between p and b frames
  242. @item -i_qoffset offset
  243. qp offset between p and i frames
  244. @item -rc_eq equation
  245. set rate control equation (@pxref{FFmpeg formula
  246. evaluator}). Default is @code{tex^qComp}.
  247. @item -rc_override override
  248. rate control override for specific intervals
  249. @item -me method
  250. set motion estimation method to @var{method}. Available methods are
  251. (from lower to best quality):
  252. @table @samp
  253. @item zero
  254. Try just the (0, 0) vector.
  255. @item phods
  256. @item log
  257. @item x1
  258. @item epzs
  259. (default method)
  260. @item full
  261. exhaustive search (slow and marginally better than epzs)
  262. @end table
  263. @item -dct_algo algo
  264. set dct algorithm to @var{algo}. Available values are:
  265. @table @samp
  266. @item 0
  267. FF_DCT_AUTO (default)
  268. @item 1
  269. FF_DCT_FASTINT
  270. @item 2
  271. FF_DCT_INT
  272. @item 3
  273. FF_DCT_MMX
  274. @item 4
  275. FF_DCT_MLIB
  276. @item 5
  277. FF_DCT_ALTIVEC
  278. @end table
  279. @item -idct_algo algo
  280. set idct algorithm to @var{algo}. Available values are:
  281. @table @samp
  282. @item 0
  283. FF_IDCT_AUTO (default)
  284. @item 1
  285. FF_IDCT_INT
  286. @item 2
  287. FF_IDCT_SIMPLE
  288. @item 3
  289. FF_IDCT_SIMPLEMMX
  290. @item 4
  291. FF_IDCT_LIBMPEG2MMX
  292. @item 5
  293. FF_IDCT_PS2
  294. @item 6
  295. FF_IDCT_MLIB
  296. @item 7
  297. FF_IDCT_ARM
  298. @item 8
  299. FF_IDCT_ALTIVEC
  300. @item 9
  301. FF_IDCT_SH4
  302. @item 10
  303. FF_IDCT_SIMPLEARM
  304. @end table
  305. @item -er n
  306. set error resilience to @var{n}.
  307. @table @samp
  308. @item 1
  309. FF_ER_CAREFULL (default)
  310. @item 2
  311. FF_ER_COMPLIANT
  312. @item 3
  313. FF_ER_AGGRESSIVE
  314. @item 4
  315. FF_ER_VERY_AGGRESSIVE
  316. @end table
  317. @item -ec bit_mask
  318. set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
  319. the following values:
  320. @table @samp
  321. @item 1
  322. FF_EC_GUESS_MVS (default=enabled)
  323. @item 2
  324. FF_EC_DEBLOCK (default=enabled)
  325. @end table
  326. @item -bf frames
  327. use 'frames' B frames (supported for MPEG-1, MPEG-2 and MPEG-4)
  328. @item -mbd mode
  329. macroblock decision
  330. @table @samp
  331. @item 0
  332. FF_MB_DECISION_SIMPLE: use mb_cmp (cannot change it yet in ffmpeg)
  333. @item 1
  334. FF_MB_DECISION_BITS: chooses the one which needs the fewest bits
  335. @item 2
  336. FF_MB_DECISION_RD: rate distoration
  337. @end table
  338. @item -4mv
  339. use four motion vector by macroblock (only MPEG-4)
  340. @item -part
  341. use data partitioning (only MPEG-4)
  342. @item -bug param
  343. workaround not auto detected encoder bugs
  344. @item -strict strictness
  345. how strictly to follow the standarts
  346. @item -aic
  347. enable Advanced intra coding (h263+)
  348. @item -umv
  349. enable Unlimited Motion Vector (h263+)
  350. @item -deinterlace
  351. deinterlace pictures
  352. @item -interlace
  353. force interlacing support in encoder (only MPEG-2 and MPEG-4). Use this option
  354. if your input file is interlaced and if you want to keep the interlaced
  355. format for minimum losses. The alternative is to deinterlace the input
  356. stream with @option{-deinterlace}, but deinterlacing introduces more
  357. losses.
  358. @item -psnr
  359. calculate PSNR of compressed frames
  360. @item -vstats
  361. dump video coding statistics to @file{vstats_HHMMSS.log}.
  362. @item -vhook module
  363. insert video processing @var{module}. @var{module} contains the module
  364. name and its parameters separated by spaces.
  365. @end table
  366. @section Audio Options
  367. @table @option
  368. @item -ar freq
  369. set the audio sampling freq (default = 44100 Hz)
  370. @item -ab bitrate
  371. set the audio bitrate in kbit/s (default = 64)
  372. @item -ac channels
  373. set the number of audio channels (default = 1)
  374. @item -an
  375. disable audio recording
  376. @item -acodec codec
  377. force audio codec to @var{codec}. Use the @code{copy} special value to
  378. tell that the raw codec data must be copied as is.
  379. @end table
  380. @section Audio/Video grab options
  381. @table @option
  382. @item -vd device
  383. set video grab device (e.g. @file{/dev/video0})
  384. @item -vc channel
  385. set video grab channel (DV1394 only)
  386. @item -tvstd standard
  387. set television standard (NTSC, PAL (SECAM))
  388. @item -dv1394
  389. set DV1394 grab
  390. @item -ad device
  391. set audio device (e.g. @file{/dev/dsp})
  392. @end table
  393. @section Advanced options
  394. @table @option
  395. @item -map file:stream
  396. set input stream mapping
  397. @item -debug
  398. print specific debug info
  399. @item -benchmark
  400. add timings for benchmarking
  401. @item -hex
  402. dump each input packet
  403. @item -bitexact
  404. only use bit exact algorithms (for codec testing)
  405. @item -ps size
  406. set packet size in bits
  407. @item -re
  408. read input at native frame rate. Mainly used to simulate a grab device.
  409. @item -loop
  410. loop over the input stream. Currently it works only for image
  411. streams. This option is used for ffserver automatic testing.
  412. @end table
  413. @node FFmpeg formula evaluator
  414. @section FFmpeg formula evaluator
  415. When evaluating a rate control string, FFmpeg uses an internal formula
  416. evaluator.
  417. The following binary operators are available: @code{+}, @code{-},
  418. @code{*}, @code{/}, @code{^}.
  419. The following unary operators are available: @code{+}, @code{-},
  420. @code{(...)}.
  421. The following functions are available:
  422. @table @var
  423. @item sinh(x)
  424. @item cosh(x)
  425. @item tanh(x)
  426. @item sin(x)
  427. @item cos(x)
  428. @item tan(x)
  429. @item exp(x)
  430. @item log(x)
  431. @item squish(x)
  432. @item gauss(x)
  433. @item abs(x)
  434. @item max(x, y)
  435. @item min(x, y)
  436. @item gt(x, y)
  437. @item lt(x, y)
  438. @item eq(x, y)
  439. @item bits2qp(bits)
  440. @item qp2bits(qp)
  441. @end table
  442. The following constants are available:
  443. @table @var
  444. @item PI
  445. @item E
  446. @item iTex
  447. @item pTex
  448. @item tex
  449. @item mv
  450. @item fCode
  451. @item iCount
  452. @item mcVar
  453. @item var
  454. @item isI
  455. @item isP
  456. @item isB
  457. @item avgQP
  458. @item qComp
  459. @item avgIITex
  460. @item avgPITex
  461. @item avgPPTex
  462. @item avgBPTex
  463. @item avgTex
  464. @end table
  465. @c man end
  466. @ignore
  467. @setfilename ffmpeg
  468. @settitle FFmpeg video converter
  469. @c man begin SEEALSO
  470. ffserver(1), ffplay(1) and the html documentation of @file{ffmpeg}.
  471. @c man end
  472. @c man begin AUTHOR
  473. Fabrice Bellard
  474. @c man end
  475. @end ignore
  476. @section Protocols
  477. The filename can be @file{-} to read from the standard input or to write
  478. to the standard output.
  479. ffmpeg handles also many protocols specified with the URL syntax.
  480. Use 'ffmpeg -formats' to have a list of the supported protocols.
  481. The protocol @code{http:} is currently used only to communicate with
  482. ffserver (see the ffserver documentation). When ffmpeg will be a
  483. video player it will also be used for streaming :-)
  484. @chapter Tips
  485. @itemize
  486. @item For streaming at very low bit rate application, use a low frame rate
  487. and a small gop size. This is especially true for real video where
  488. the Linux player does not seem to be very fast, so it can miss
  489. frames. An example is:
  490. @example
  491. ffmpeg -g 3 -r 3 -t 10 -b 50 -s qcif -f rv10 /tmp/b.rm
  492. @end example
  493. @item The parameter 'q' which is displayed while encoding is the current
  494. quantizer. The value of 1 indicates that a very good quality could
  495. be achieved. The value of 31 indicates the worst quality. If q=31
  496. too often, it means that the encoder cannot compress enough to meet
  497. your bit rate. You must either increase the bit rate, decrease the
  498. frame rate or decrease the frame size.
  499. @item If your computer is not fast enough, you can speed up the
  500. compression at the expense of the compression ratio. You can use
  501. '-me zero' to speed up motion estimation, and '-intra' to disable
  502. completely motion estimation (you have only I frames, which means it
  503. is about as good as JPEG compression).
  504. @item To have very low bitrates in audio, reduce the sampling frequency
  505. (down to 22050 kHz for mpeg audio, 22050 or 11025 for ac3).
  506. @item To have a constant quality (but a variable bitrate), use the option
  507. '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
  508. quality).
  509. @item When converting video files, you can use the '-sameq' option which
  510. uses in the encoder the same quality factor than in the decoder. It
  511. allows to be almost lossless in encoding.
  512. @end itemize
  513. @chapter Supported File Formats and Codecs
  514. You can use the @code{-formats} option to have an exhaustive list.
  515. @section File Formats
  516. FFmpeg supports the following file formats through the @code{libavformat}
  517. library:
  518. @multitable @columnfractions .4 .1 .1
  519. @item Supported File Format @tab Encoding @tab Decoding @tab Comments
  520. @item MPEG audio @tab X @tab X
  521. @item MPEG1 systems @tab X @tab X
  522. @tab muxed audio and video
  523. @item MPEG2 PS @tab X @tab X
  524. @tab also known as @code{VOB} file
  525. @item MPEG2 TS @tab @tab X
  526. @tab also known as DVB Transport Stream
  527. @item ASF@tab X @tab X
  528. @item AVI@tab X @tab X
  529. @item WAV@tab X @tab X
  530. @item Macromedia Flash@tab X @tab X
  531. @tab Only embedded audio is decoded
  532. @item FLV @tab X @tab X
  533. @tab Macromedia Flash video files
  534. @item Real Audio and Video @tab X @tab X
  535. @item Raw AC3 @tab X @tab X
  536. @item Raw MJPEG @tab X @tab X
  537. @item Raw MPEG video @tab X @tab X
  538. @item Raw PCM8/16 bits, mulaw/Alaw@tab X @tab X
  539. @item Raw CRI ADX audio @tab X @tab X
  540. @item SUN AU format @tab X @tab X
  541. @item NUT @tab X @tab X @tab NUT Open Container Format
  542. @item Quicktime @tab X @tab X
  543. @item MPEG4 @tab X @tab X
  544. @tab MPEG4 is a variant of Quicktime
  545. @item Raw MPEG4 video @tab X @tab X
  546. @item DV @tab X @tab X
  547. @item 4xm @tab @tab X
  548. @tab 4X Technologies format, used in some games
  549. @item Playstation STR @tab @tab X
  550. @item Id RoQ @tab @tab X
  551. @tab used in Quake III, Jedi Knight 2, other computer games
  552. @item Interplay MVE @tab @tab X
  553. @tab format used in various Interplay computer games
  554. @item WC3 Movie @tab @tab X
  555. @tab multimedia format used in Origin's Wing Commander III computer game
  556. @item Sega FILM/CPK @tab @tab X
  557. @tab used in many Sega Saturn console games
  558. @item Westwood Studios VQA/AUD @tab @tab X
  559. @tab Multimedia formats used in Westwood Studios games
  560. @item Id Cinematic (.cin) @tab @tab X
  561. @tab Used in Quake II
  562. @item FLIC format @tab @tab X
  563. @tab .fli/.flc files
  564. @item Sierra VMD @tab @tab X
  565. @tab used in Sierra CD-ROM games
  566. @item Matroska @tab @tab X
  567. @end multitable
  568. @code{X} means that the encoding (resp. decoding) is supported.
  569. @section Image Formats
  570. FFmpeg can read and write images for each frame of a video sequence. The
  571. following image formats are supported:
  572. @multitable @columnfractions .4 .1 .1
  573. @item Supported Image Format @tab Encoding @tab Decoding @tab Comments
  574. @item PGM, PPM @tab X @tab X
  575. @item PAM @tab X @tab X @tab PAM is a PNM extension with alpha support
  576. @item PGMYUV @tab X @tab X @tab PGM with U and V components in YUV 4:2:0
  577. @item JPEG @tab X @tab X @tab Progressive JPEG is not supported
  578. @item .Y.U.V @tab X @tab X @tab One raw file per component
  579. @item Animated GIF @tab X @tab X @tab Only uncompressed GIFs are generated
  580. @item PNG @tab X @tab X @tab 2 bit and 4 bit/pixel not supported yet
  581. @item SGI @tab X @tab X @tab SGI RGB image format
  582. @end multitable
  583. @code{X} means that the encoding (resp. decoding) is supported.
  584. @section Video Codecs
  585. @multitable @columnfractions .4 .1 .1 .7
  586. @item Supported Codec @tab Encoding @tab Decoding @tab Comments
  587. @item MPEG1 video @tab X @tab X
  588. @item MPEG2 video @tab X @tab X
  589. @item MPEG4 @tab X @tab X @tab Also known as DIVX4/5
  590. @item MSMPEG4 V1 @tab X @tab X
  591. @item MSMPEG4 V2 @tab X @tab X
  592. @item MSMPEG4 V3 @tab X @tab X @tab Also known as DIVX3
  593. @item WMV7 @tab X @tab X
  594. @item WMV8 @tab X @tab X @tab Not completely working
  595. @item H263(+) @tab X @tab X @tab Also known as Real Video 1.0
  596. @item MJPEG @tab X @tab X
  597. @item Lossless MJPEG @tab X @tab X
  598. @item Apple MJPEG-B @tab @tab X
  599. @item Sunplus MJPEG @tab @tab X @tab fourcc: SP5X
  600. @item DV @tab X @tab X
  601. @item Huff YUV @tab X @tab X
  602. @item FFmpeg Video 1 @tab X @tab X @tab Lossless codec (fourcc: FFV1)
  603. @item Asus v1 @tab X @tab X @tab fourcc: ASV1
  604. @item Asus v2 @tab X @tab X @tab fourcc: ASV2
  605. @item Creative YUV @tab @tab X @tab fourcc: CYUV
  606. @item H.264 @tab @tab X
  607. @item Sorenson Video 1 @tab X @tab X @tab fourcc: SVQ1
  608. @item Sorenson Video 3 @tab @tab X @tab fourcc: SVQ3
  609. @item On2 VP3 @tab @tab X @tab still experimental
  610. @item Theora @tab @tab X @tab still experimental
  611. @item Intel Indeo 3 @tab @tab X @tab only works on i386 right now
  612. @item FLV @tab X @tab X @tab Flash H263 variant
  613. @item ATI VCR1 @tab @tab X @tab fourcc: VCR1
  614. @item ATI VCR2 @tab @tab X @tab fourcc: VCR2
  615. @item Cirrus Logic AccuPak @tab @tab X @tab fourcc: CLJR
  616. @item 4X Video @tab @tab X @tab used in certain computer games
  617. @item Sony Playstation MDEC @tab @tab X
  618. @item Id RoQ @tab @tab X @tab used in Quake III, Jedi Knight 2, other computer games
  619. @item Xan/WC3 @tab @tab X @tab used in Wing Commander III .MVE files
  620. @item Interplay Video @tab @tab X @tab used in Interplay .MVE files
  621. @item Apple Animation @tab @tab X @tab fourcc: 'rle '
  622. @item Apple Graphics @tab @tab X @tab fourcc: 'smc '
  623. @item Apple Video @tab @tab X @tab fourcc: rpza
  624. @item Cinepak @tab @tab X
  625. @item Microsoft RLE @tab @tab X
  626. @item Microsoft Video-1 @tab @tab X
  627. @item Westwood VQA @tab @tab X
  628. @item Id Cinematic Video @tab @tab X @tab used in Quake II
  629. @item Planar RGB @tab @tab X @tab fourcc: 8BPS
  630. @item FLIC video @tab @tab X
  631. @item Duck TrueMotion v1 @tab @tab X @tab fourcc: DUCK
  632. @item VMD Video @tab @tab X @tab used in Sierra VMD files
  633. @item MSZH @tab @tab X @tab Part of LCL
  634. @item ZLIB @tab X @tab X @tab Part of LCL, encoder experimental
  635. @item TechSmith Camtasia @tab @tab X @tab fourcc: TSCC
  636. @end multitable
  637. @code{X} means that the encoding (resp. decoding) is supported.
  638. Check at @url{http://www.mplayerhq.hu/~michael/codec-features.html} to
  639. get a precise comparison of FFmpeg MPEG4 codec compared to the other
  640. solutions.
  641. @section Audio Codecs
  642. @multitable @columnfractions .4 .1 .1 .1 .7
  643. @item Supported Codec @tab Encoding @tab Decoding @tab Comments
  644. @item MPEG audio layer 2 @tab IX @tab IX
  645. @item MPEG audio layer 1/3 @tab IX @tab IX
  646. @tab MP3 encoding is supported through the external library LAME
  647. @item AC3 @tab IX @tab IX
  648. @tab liba52 is used internally for decoding
  649. @item Vorbis @tab X @tab X
  650. @tab supported through the external library libvorbis
  651. @item WMA V1/V2 @tab @tab X
  652. @item AAC @tab X @tab X
  653. @tab supported through the external library libfaac/libfaad
  654. @item Microsoft ADPCM @tab X @tab X
  655. @item MS IMA ADPCM @tab X @tab X
  656. @item QT IMA ADPCM @tab @tab X
  657. @item 4X IMA ADPCM @tab @tab X
  658. @item G.726 ADPCM @tab X @tab X
  659. @item Duck DK3 IMA ADPCM @tab @tab X
  660. @tab used in some Sega Saturn console games
  661. @item Duck DK4 IMA ADPCM @tab @tab X
  662. @tab used in some Sega Saturn console games
  663. @item Westwood Studios IMA ADPCM @tab @tab X
  664. @tab used in Westwood Studios games like Command and Conquer
  665. @item SMJPEG IMA ADPCM @tab @tab X
  666. @tab used in certain Loki game ports
  667. @item CD-ROM XA ADPCM @tab @tab X
  668. @item CRI ADX ADPCM @tab X @tab X
  669. @tab used in Sega Dreamcast games
  670. @item Electronic Arts ADPCM @tab @tab X
  671. @tab used in various EA titles
  672. @item RA144 @tab @tab X
  673. @tab Real 14400 bit/s codec
  674. @item RA288 @tab @tab X
  675. @tab Real 28800 bit/s codec
  676. @item RADnet @tab X @tab IX
  677. @tab Real lowbitrate AC3 codec, liba52 is used for decoding
  678. @item AMR-NB @tab X @tab X
  679. @tab supported through an external library
  680. @item AMR-WB @tab X @tab X
  681. @tab supported through an external library
  682. @item DV audio @tab @tab X
  683. @item Id RoQ DPCM @tab @tab X
  684. @tab used in Quake III, Jedi Knight 2, other computer games
  685. @item Interplay MVE DPCM @tab @tab X
  686. @tab used in various Interplay computer games
  687. @item Xan DPCM @tab @tab X
  688. @tab used in Origin's Wing Commander IV AVI files
  689. @item Apple MACE 3 @tab @tab X
  690. @item Apple MACE 6 @tab @tab X
  691. @item FLAC @tab @tab X
  692. @end multitable
  693. @code{X} means that the encoding (resp. decoding) is supported.
  694. @code{I} means that an integer only version is available too (ensures highest
  695. performances on systems without hardware floating point support).
  696. @chapter Platform Specific information
  697. @section Linux
  698. ffmpeg should be compiled with at least GCC 2.95.3. GCC 3.2 is the
  699. preferred compiler now for ffmpeg. All future optimizations will depend on
  700. features only found in GCC 3.2.
  701. @section BSD
  702. @section Windows
  703. @subsection Native Windows compilation
  704. @itemize
  705. @item Install the current versions of MSYS and MinGW from
  706. @url{http://www.mingw.org/}. You can find detailed installation
  707. instructions in the download section and the FAQ.
  708. @item If you want to test the FFmpeg Simple Media Player, also download
  709. the MinGW development library of SDL 1.2.x
  710. (@file{SDL-devel-1.2.x-mingw32.tar.gz}) from
  711. @url{http://www.libsdl.org}. Unpack it in a temporary place, and
  712. unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
  713. directory. Edit the @file{sdl-config} script so that it gives the
  714. correct SDL directory when invoked.
  715. @item Extract the current version of FFmpeg (the latest release version or the current CVS snapshot whichever is recommended).
  716. @item Start the MSYS shell (file @file{msys.bat}).
  717. @item Change to the FFMPEG directory and follow
  718. the instructions of how to compile ffmpeg (file
  719. @file{INSTALL}). Usually, launching @file{./configure} and @file{make}
  720. suffices. If you have problems using SDL, verify that
  721. @file{sdl-config} can be launched from the MSYS command line.
  722. @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
  723. @file{ffplay}.
  724. @end itemize
  725. Notes:
  726. @itemize
  727. @item The target @file{make wininstaller} can be used to create a
  728. Nullsoft based Windows installer for FFmpeg and FFplay. @file{SDL.dll}
  729. must be copied in the ffmpeg directory in order to build the
  730. installer.
  731. @item By using @code{./configure --enable-shared} when configuring ffmpeg,
  732. you can build @file{avcodec.dll} and @file{avformat.dll}. With
  733. @code{make install} you install the FFmpeg DLLs and the associated
  734. headers in @file{Program Files/FFmpeg}.
  735. @item Visual C++ compatibility: if you used @code{./configure --enable-shared}
  736. when configuring FFmpeg, then FFmpeg tries to use the Microsoft Visual
  737. C++ @code{lib} tool to build @code{avcodec.lib} and
  738. @code{avformat.lib}. With these libraries, you can link your Visual C++
  739. code directly with the FFmpeg DLLs.
  740. @end itemize
  741. @subsection Cross compilation for Windows with Linux
  742. You must use the MinGW cross compilation tools available at
  743. @url{http://www.mingw.org/}.
  744. Then configure ffmpeg with the following options:
  745. @example
  746. ./configure --enable-mingw32 --cross-prefix=i386-mingw32msvc-
  747. @end example
  748. (you can change the cross-prefix according to the prefix choosen for the
  749. MinGW tools).
  750. Then you can easily test ffmpeg with wine
  751. (@url{http://www.winehq.com/}).
  752. @section MacOS X
  753. @section BeOS
  754. The configure script should guess the configuration itself.
  755. Networking support is currently not finished.
  756. errno issues fixed by Andrew Bachmann.
  757. Old stuff:
  758. François Revol - revol at free dot fr - April 2002
  759. The configure script should guess the configuration itself,
  760. however I still didn't tested building on net_server version of BeOS.
  761. ffserver is broken (needs poll() implementation).
  762. There is still issues with errno codes, which are negative in BeOs, and
  763. that ffmpeg negates when returning. This ends up turning errors into
  764. valid results, then crashes.
  765. (To be fixed)
  766. @chapter Developers Guide
  767. @section API
  768. @itemize
  769. @item libavcodec is the library containing the codecs (both encoding and
  770. decoding). See @file{libavcodec/apiexample.c} to see how to use it.
  771. @item libavformat is the library containing the file formats handling (mux and
  772. demux code for several formats). See @file{ffplay.c} to use it in a
  773. player. See @file{output_example.c} to use it to generate audio or video
  774. streams.
  775. @end itemize
  776. @section Integrating libavcodec or libavformat in your program
  777. You can integrate all the source code of the libraries to link them
  778. statically to avoid any version problem. All you need is to provide a
  779. 'config.mak' and a 'config.h' in the parent directory. See the defines
  780. generated by ./configure to understand what is needed.
  781. You can use libavcodec or libavformat in your commercial program, but
  782. @emph{any patch you make must be published}. The best way to proceed is
  783. to send your patches to the ffmpeg mailing list.
  784. @node Coding Rules
  785. @section Coding Rules
  786. ffmpeg is programmed in the ISO C90 language with a few additional
  787. features from ISO C99, namely:
  788. @itemize @bullet
  789. @item
  790. the @samp{inline} keyword;
  791. @item
  792. @samp{//} comments;
  793. @item
  794. designated struct initializers (@samp{struct s x = @{ .i = 17 @};})
  795. @item
  796. compound literals (@samp{x = (struct s) { 17, 23 @};})
  797. @end itemize
  798. These features are supported by all compilers we care about, so we won't
  799. accept patches to remove their use unless they absolutely don't impair
  800. clarity and performance.
  801. All code must compile with gcc 2.95 and gcc 3.3. Currently, ffmpeg also
  802. compiles with several other compilers, such as the Compaq ccc compiler
  803. or Sun Studio 9, and we would like to keep it that way unless it would
  804. be exceedingly involved. To ensure compatibility, please don't use any
  805. additional C99 features or gcc extensions. Watch out especially for:
  806. @itemize @bullet
  807. @item
  808. mixing statements and declarations;
  809. @item
  810. @samp{long long} (use @samp{int64_t} instead);
  811. @item
  812. @samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
  813. @item
  814. gcc statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
  815. @end itemize
  816. Indent size is 4. The TAB character should not be used.
  817. The presentation is the one specified by 'indent -i4 -kr'.
  818. Main priority in ffmpeg is simplicity and small code size (=less
  819. bugs).
  820. Comments: use the JavaDoc/Doxygen
  821. format (see examples below) so that a documentation
  822. can be generated automatically. All non trivial functions should have a comment
  823. above it explaining what the function does, even if its just one sentance.
  824. All Structures and their member variables should be documented too.
  825. @example
  826. /**
  827.  * @file mpeg.c
  828.  * mpeg codec.
  829.  * @author ...
  830.  */
  831. /**
  832.  * Summary sentance.
  833.  * more text ...
  834.  * ...
  835.  */
  836. typedef struct Foobar{
  837.     int var1; /**< var1 description */
  838.     int var2; ///< var2 description
  839.     /** var3 description */
  840.     int var3;
  841. } Foobar;
  842. /**
  843.  * Summary sentance.
  844.  * more text ...
  845.  * ...
  846.  * @param my_parameter description of my_parameter
  847.  * @return return value description
  848.  */
  849. int myfunc(int my_parameter)
  850. ...
  851. @end example
  852. fprintf and printf are forbidden in libavformat and libavcodec,
  853. please use av_log() instead.
  854. @section Submitting patches
  855. First, (@pxref{Coding Rules}) above if you didn't yet.
  856. When you submit your patch, try to send a unified diff (diff '-up'
  857. option). I cannot read other diffs :-)
  858. Run the regression tests before submitting a patch so that you can
  859. verify that there are no big problems.
  860. Patches should be posted as base64 encoded attachments (or any other
  861. encoding which ensures that the patch wont be trashed during
  862. transmission) to the ffmpeg-devel mailinglist, see
  863. @url{http://lists.sourceforge.net/lists/listinfo/ffmpeg-devel}
  864. It also helps quite a bit if you tell us what the patch does (for example
  865. 'replaces lrint by lrintf') , and why (for example '*bsd isnt c99 compliant
  866. and has no lrint()')
  867. @section Regression tests
  868. Before submitting a patch (or committing with CVS), you should at least
  869. test that you did not break anything.
  870. The regression test build a synthetic video stream and a synthetic
  871. audio stream. Then these are encoded then decoded with all codecs or
  872. formats. The CRC (or MD5) of each generated file is recorded in a
  873. result file. Then a 'diff' is launched with the reference results and
  874. the result file.
  875. The regression test then goes on to test the ffserver code with a
  876. limited set of streams. It is important that this step runs correctly
  877. as well.
  878. Run 'make test' to test all the codecs and formats.
  879. Run 'make fulltest' to test all the codecs, formats and ffserver.
  880. [Of course, some patches may change the regression tests results. In
  881. this case, the regression tests reference results shall be modified
  882. accordingly].
  883. @bye