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.

837 lines
23KB

  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 [[options][@option{-i} @var{input_file}]]... @{[options] @var{output_file}@}...
  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 -title string
  126. set the title
  127. @item -author string
  128. set the author
  129. @item -copyright string
  130. set the copyright
  131. @item -comment string
  132. set the comment
  133. @item -hq
  134. activate high quality settings
  135. @end table
  136. @section Video Options
  137. @table @option
  138. @item -b bitrate
  139. set the video bitrate in kbit/s (default = 200 kb/s)
  140. @item -r fps
  141. set frame rate (default = 25)
  142. @item -s size
  143. set frame size. The format is @samp{WxH}. (default 160x128)
  144. The following abbreviations are regognized:
  145. @table @sampe
  146. @item sqcif
  147. 128x96
  148. @item qcif
  149. 176x144
  150. @item cif
  151. 352x288
  152. @item 4cif
  153. 704x576
  154. @end table
  155. @item -aspect aspect
  156. set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
  157. @item -croptop size
  158. set top crop band size (in pixels)
  159. @item -cropbottom size
  160. set bottom crop band size (in pixels)
  161. @item -cropleft size
  162. set left crop band size (in pixels)
  163. @item -cropright size
  164. set right crop band size (in pixels)
  165. @item -vn
  166. disable video recording
  167. @item -bt tolerance
  168. set video bitrate tolerance (in kbit/s)
  169. @item -maxrate bitrate
  170. set max video bitrate tolerance (in kbit/s)
  171. @item -minrate bitrate
  172. set min video bitrate tolerance (in kbit/s)
  173. @item -bufsize size
  174. set ratecontrol buffere size (in kbit)
  175. @item -vcodec codec
  176. force video codec
  177. @item -sameq
  178. use same video quality as source (implies VBR)
  179. @item -pass n
  180. select the pass number (1 or 2). It is useful to do two pass encoding. The statistics of the video are recorded in the first pass and the video at the exact requested bit rate is generated in the second pass.
  181. @item -passlogfile file
  182. select two pass log file name
  183. @end table
  184. @section Advanced Video Options
  185. @table @option
  186. @item -g gop_size
  187. set the group of picture size
  188. @item -intra
  189. use only intra frames
  190. @item -qscale q
  191. use fixed video quantiser scale (VBR)
  192. @item -qmin q
  193. min video quantiser scale (VBR)
  194. @item -qmax q
  195. max video quantiser scale (VBR)
  196. @item -qdiff q
  197. max difference between the quantiser scale (VBR)
  198. @item -qblur blur
  199. video quantiser scale blur (VBR)
  200. @item -qcomp compression
  201. video quantiser scale compression (VBR)
  202. @item -rc_init_cplx complexity
  203. initial complexity for 1-pass encoding
  204. @item -b_qfactor factor
  205. qp factor between p and b frames
  206. @item -i_qfactor factor
  207. qp factor between p and i frames
  208. @item -b_qoffset offset
  209. qp offset between p and b frames
  210. @item -i_qoffset offset
  211. qp offset between p and i frames
  212. @item -rc_eq equation
  213. set rate control equation (@pxref{FFmpeg formula evaluator})
  214. @item -rc_override override_string
  215. rate control override for specific internals
  216. @item -me method
  217. set motion estimation method. Available methods are (from lower to best quality):
  218. @table @samp
  219. @item zero
  220. Try just (0, 0) vector.
  221. @item phods
  222. @item log
  223. @item x1
  224. @item epzs
  225. (default method)
  226. @item full
  227. exhaustive search (slow and marginally better than epzs)
  228. @end table
  229. @item -dct_algo algo
  230. set dct algo
  231. @table @samp
  232. @item 0
  233. FF_DCT_AUTO (default)
  234. @item 1
  235. FF_DCT_FASTINT
  236. @item 2
  237. FF_DCT_INT
  238. @item 3
  239. FF_DCT_MMX
  240. @item 4
  241. FF_DCT_MLIB
  242. @item 5
  243. FF_DCT_ALTIVEC
  244. @end table
  245. @item -idct_algo algo
  246. set idct algo
  247. @table @samp
  248. @item 0
  249. FF_IDCT_AUTO (default)
  250. @item 1
  251. FF_IDCT_INT
  252. @item 2
  253. FF_IDCT_SIMPLE
  254. @item 3
  255. FF_IDCT_SIMPLEMMX
  256. @item 4
  257. FF_IDCT_LIBMPEG2MMX
  258. @item 5
  259. FF_IDCT_PS2
  260. @item 6
  261. FF_IDCT_MLIB
  262. @item 7
  263. FF_IDCT_ARM
  264. @item 8
  265. FF_IDCT_ALTIVEC
  266. @item 9
  267. FF_IDCT_SH4
  268. @item 10
  269. FF_IDCT_SIMPLEARM
  270. @end table
  271. @item -er n
  272. set error resilience to 'n'
  273. @table @samp
  274. @item 1
  275. FF_ER_CAREFULL
  276. @item 2
  277. FF_ER_COMPLIANT (default)
  278. @item 3
  279. FF_ER_AGGRESSIVE
  280. @item 4
  281. FF_ER_VERY_AGGRESSIVE
  282. @end table
  283. @item -ec n
  284. set error concealment to n
  285. @table @samp
  286. @item 1
  287. FF_EC_GUESS_MVS
  288. @item 2
  289. FF_EC_DEBLOCK
  290. @end table
  291. @item -bf frames
  292. use 'frames' B frames (only MPEG-4)
  293. @item -mbd mode
  294. macroblock decision
  295. @table @samp
  296. @item 0
  297. FF_MB_DECISION_SIMPLE: use mb_cmp (cannot change it yet in ffmpeg)
  298. @item 1
  299. FF_MB_DECISION_BITS: chooses the one which needs the fewest bits
  300. @item 2
  301. FF_MB_DECISION_RD: rate distoration
  302. @end table
  303. @item -4mv
  304. use four motion vector by macroblock (only MPEG-4)
  305. @item -part
  306. use data partitioning (only MPEG-4)
  307. @item -bug param
  308. workaround not auto detected encoder bugs
  309. @item -strict strictness
  310. how strictly to follow the standarts
  311. @item -deinterlace
  312. deinterlace pictures
  313. @item -psnr
  314. calculate PSNR of compressed frames
  315. @item -vstats
  316. dump video coding statistics to file
  317. @item -vhook module
  318. insert video processing @var{module}. @var{module} contains the module
  319. name and its parameters separated by spaces.
  320. @item -aic
  321. enable Advanced intra coding (h263+)
  322. @item -umv
  323. enable Unlimited Motion Vector (h263+)
  324. @end table
  325. @section Audio Options
  326. @table @option
  327. @item -ab bitrate
  328. set audio bitrate (in kbit/s)
  329. @item -ar freq
  330. set the audio sampling freq (default = 44100 Hz)
  331. @item -ab bitrate
  332. set the audio bitrate in kbit/s (default = 64)
  333. @item -ac channels
  334. set the number of audio channels (default = 1)
  335. @item -an
  336. disable audio recording
  337. @item -acodec codec
  338. force audio codec
  339. @end table
  340. @section Audio/Video grab options
  341. @table @option
  342. @item -vd device
  343. set video grab device (e.g. @file{/dev/video0})
  344. @item -vc channel
  345. set video grab channel (DV1394 only)
  346. @item -tvstd standard
  347. set television standard (NTSC, PAL (SECAM))
  348. @item -dv1394
  349. set DV1394 grab
  350. @item -ad device
  351. set audio device (e.g. @file{/dev/dsp})
  352. @end table
  353. @section Advanced options
  354. @table @option
  355. @item -map file:stream
  356. set input stream mapping
  357. @item -debug
  358. print specific debug info
  359. @item -benchmark
  360. add timings for benchmarking
  361. @item -hex
  362. dump each input packet
  363. @item -bitexact
  364. only use bit exact algorithms (for codec testing)
  365. @item -ps size
  366. set packet size in bits
  367. @end table
  368. @node FFmpeg formula evaluator
  369. @section FFmpeg formula evaluator
  370. When evaluating a rate control string, FFmpeg uses an internal formula
  371. evaluator.
  372. The following binary operators are available: @code{+}, @code{-},
  373. @code{*}, @code{/}, @code{^}.
  374. The following unary operators are available: @code{+}, @code{-},
  375. @code{(...)}.
  376. The following functions are available:
  377. @table @var
  378. @item sinh(x)
  379. @item cosh(x)
  380. @item tanh(x)
  381. @item sin(x)
  382. @item cos(x)
  383. @item tan(x)
  384. @item exp(x)
  385. @item log(x)
  386. @item squish(x)
  387. @item gauss(x)
  388. @item abs(x)
  389. @item max(x, y)
  390. @item min(x, y)
  391. @item gt(x, y)
  392. @item lt(x, y)
  393. @item eq(x, y)
  394. @item bits2qp(bits)
  395. @item qp2bits(qp)
  396. @end table
  397. The following constants are available:
  398. @table @var
  399. @item PI
  400. @item E
  401. @item iTex
  402. @item pTex
  403. @item tex
  404. @item mv
  405. @item fCode
  406. @item iCount
  407. @item mcVar
  408. @item var
  409. @item isI
  410. @item isP
  411. @item isB
  412. @item avgQP
  413. @item qComp
  414. @item avgIITex
  415. @item avgPITex
  416. @item avgPPTex
  417. @item avgBPTex
  418. @item avgTex
  419. @end table
  420. @c man end
  421. @ignore
  422. @setfilename ffmpeg
  423. @settitle FFmpeg video converter
  424. @c man begin SEEALSO
  425. ffserver(1), ffplay(1) and the html documentation of @file{ffmpeg}.
  426. @c man end
  427. @c man begin AUTHOR
  428. Fabrice Bellard
  429. @c man end
  430. @end ignore
  431. @section Protocols
  432. The filename can be @file{-} to read from the standard input or to write
  433. to the standard output.
  434. ffmpeg handles also many protocols specified with the URL syntax.
  435. Use 'ffmpeg -formats' to have a list of the supported protocols.
  436. The protocol @code{http:} is currently used only to communicate with
  437. ffserver (see the ffserver documentation). When ffmpeg will be a
  438. video player it will also be used for streaming :-)
  439. @chapter Tips
  440. @itemize
  441. @item For streaming at very low bit rate application, use a low frame rate
  442. and a small gop size. This is especially true for real video where
  443. the Linux player does not seem to be very fast, so it can miss
  444. frames. An example is:
  445. @example
  446. ffmpeg -g 3 -r 3 -t 10 -b 50 -s qcif -f rv10 /tmp/b.rm
  447. @end example
  448. @item The parameter 'q' which is displayed while encoding is the current
  449. quantizer. The value of 1 indicates that a very good quality could
  450. be achieved. The value of 31 indicates the worst quality. If q=31
  451. too often, it means that the encoder cannot compress enough to meet
  452. your bit rate. You must either increase the bit rate, decrease the
  453. frame rate or decrease the frame size.
  454. @item If your computer is not fast enough, you can speed up the
  455. compression at the expense of the compression ratio. You can use
  456. '-me zero' to speed up motion estimation, and '-intra' to disable
  457. completely motion estimation (you have only I frames, which means it
  458. is about as good as JPEG compression).
  459. @item To have very low bitrates in audio, reduce the sampling frequency
  460. (down to 22050 kHz for mpeg audio, 22050 or 11025 for ac3).
  461. @item To have a constant quality (but a variable bitrate), use the option
  462. '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
  463. quality).
  464. @item When converting video files, you can use the '-sameq' option which
  465. uses in the encoder the same quality factor than in the decoder. It
  466. allows to be almost lossless in encoding.
  467. @end itemize
  468. @chapter Supported File Formats and Codecs
  469. You can use the @code{-formats} option to have an exhaustive list.
  470. @section File Formats
  471. FFmpeg supports the following file formats through the @code{libavformat}
  472. library:
  473. @multitable @columnfractions .4 .1 .1
  474. @item Supported File Format @tab Encoding @tab Decoding @tab Comments
  475. @item MPEG audio @tab X @tab X
  476. @item MPEG1 systems @tab X @tab X
  477. @tab muxed audio and video
  478. @item MPEG2 PS @tab X @tab X
  479. @tab also known as @code{VOB} file
  480. @item MPEG2 TS @tab @tab X
  481. @tab also known as DVB Transport Stream
  482. @item ASF@tab X @tab X
  483. @item AVI@tab X @tab X
  484. @item WAV@tab X @tab X
  485. @item Macromedia Flash@tab X @tab X
  486. @tab Only embedded audio is decoded
  487. @item FLV @tab X @tab X
  488. @tab Macromedia Flash video files
  489. @item Real Audio and Video @tab X @tab X
  490. @item Raw AC3 @tab X @tab X
  491. @item Raw MJPEG @tab X @tab X
  492. @item Raw MPEG video @tab X @tab X
  493. @item Raw PCM8/16 bits, mulaw/Alaw@tab X @tab X
  494. @item SUN AU format @tab X @tab X
  495. @item Quicktime @tab @tab X
  496. @item MPEG4 @tab @tab X
  497. @tab MPEG4 is a variant of Quicktime
  498. @item Raw MPEG4 video @tab X @tab X
  499. @item DV @tab @tab X
  500. @item 4xm @tab @tab X
  501. @tab 4X Technologies format, used in some games
  502. @end multitable
  503. @code{X} means that the encoding (resp. decoding) is supported.
  504. @section Image Formats
  505. FFmpeg can read and write images for each frame of a video sequence. The
  506. following image formats are supported:
  507. @multitable @columnfractions .4 .1 .1
  508. @item Supported Image Format @tab Encoding @tab Decoding @tab Comments
  509. @item PGM, PPM @tab X @tab X
  510. @item PAM @tab X @tab X @tab PAM is a PNM extension with alpha support
  511. @item PGMYUV @tab X @tab X @tab PGM with U and V components in YUV 4:2:0
  512. @item JPEG @tab X @tab X @tab Progressive JPEG is not supported
  513. @item .Y.U.V @tab X @tab X @tab One raw file per component
  514. @item Animated GIF @tab X @tab X @tab Only uncompressed GIFs are generated
  515. @item PNG @tab X @tab X @tab 2 bit and 4 bit/pixel not supported yet
  516. @end multitable
  517. @code{X} means that the encoding (resp. decoding) is supported.
  518. @section Video Codecs
  519. @multitable @columnfractions .4 .1 .1 .7
  520. @item Supported Codec @tab Encoding @tab Decoding @tab Comments
  521. @item MPEG1 video @tab X @tab X
  522. @item MPEG2 video @tab @tab X
  523. @item MPEG4 @tab X @tab X @tab Also known as DIVX4/5
  524. @item MSMPEG4 V1 @tab X @tab X
  525. @item MSMPEG4 V2 @tab X @tab X
  526. @item MSMPEG4 V3 @tab X @tab X @tab Also known as DIVX3
  527. @item WMV7 @tab X @tab X
  528. @item WMV8 @tab X @tab X @tab Not completely working
  529. @item H263(+) @tab X @tab X @tab Also known as Real Video 1.0
  530. @item MJPEG @tab X @tab X
  531. @item DV @tab @tab X
  532. @item Huff YUV @tab X @tab X
  533. @item Asus v1 @tab X @tab X @tab fourcc: ASV1
  534. @item Creative YUV @tab @tab X @tab fourcc: CYUV
  535. @item H.264 @tab @tab X
  536. @item Sorenson Video 1 @tab @tab X @tab fourcc: SVQ1
  537. @item Sorenson Video 3 @tab @tab X @tab fourcc: SVQ3
  538. @item On2 VP3 @tab @tab X @tab still experimental
  539. @item Intel Indeo 3 @tab @tab X @tab only works on i386 right now
  540. @item FLV @tab X @tab X @tab Flash H263 variant
  541. @end multitable
  542. @code{X} means that the encoding (resp. decoding) is supported.
  543. Check at @url{http://www.mplayerhq.hu/~michael/codec-features.html} to
  544. get a precise comparison of FFmpeg MPEG4 codec compared to the other
  545. solutions.
  546. @section Audio Codecs
  547. @multitable @columnfractions .4 .1 .1 .1 .7
  548. @item Supported Codec @tab Encoding @tab Decoding @tab Comments
  549. @item MPEG audio layer 2 @tab IX @tab IX
  550. @item MPEG audio layer 1/3 @tab IX @tab IX
  551. @tab MP3 encoding is supported through the external library LAME
  552. @item AC3 @tab IX @tab X
  553. @tab liba52 is used internally for decoding
  554. @item Vorbis @tab X @tab X
  555. @tab supported through the external library libvorbis
  556. @item WMA V1/V2 @tab @tab X
  557. @item Microsoft ADPCM @tab X @tab X
  558. @item IMA ADPCM @tab X @tab X
  559. @item RA144 @tab @tab X
  560. @tab Real 14400 bit/s codec
  561. @item RA288 @tab @tab X
  562. @tab Real 28800 bit/s codec
  563. @item AMR-NB @tab X @tab X
  564. @tab supported through an external library
  565. @item DV audio @tab @tab X
  566. @end multitable
  567. @code{X} means that the encoding (resp. decoding) is supported.
  568. @code{I} means that an integer only version is available too (ensures highest
  569. performances on systems without hardware floating point support).
  570. @chapter Platform Specific information
  571. @section Linux
  572. ffmpeg should be compiled with at least GCC 2.95.3. GCC 3.2 is the
  573. preferred compiler now for ffmpeg. All future optimizations will depend on
  574. features only found in GCC 3.2.
  575. @section BSD
  576. @section Windows
  577. @subsection Native Windows compilation
  578. @itemize
  579. @item Install the current versions of MSYS and MinGW from
  580. @url{http://www.mingw.org/}. You can find detailed installation
  581. instructions in the download section and the FAQ.
  582. @item Extract the current version of ffmpeg (the latest release version or the current CVS snapshot whichever is recommended).
  583. @item Start the MSYS shell (file @file{msys.bat}).
  584. @item Change to the FFMPEG directory and create the libavcodec.a and libavformat.a libraries, following the instructions of how to compile ffmpeg (file @file{INSTALL}).
  585. @end itemize
  586. @subsection How to create a single Windows DLL from libavcodec and libavformat
  587. Read @url{http://ffmpeg.org/win32.html}.
  588. @subsection Cross compilation for Windows with Linux
  589. You must use the MinGW cross compilation tools available at
  590. @url{http://www.mingw.org/}.
  591. Then configure ffmpeg with the following options:
  592. @example
  593. ./configure --enable-mingw32 --cross-prefix=i386-mingw32msvc-
  594. @end example
  595. (you can change the cross-prefix according to the prefix choosen for the
  596. MinGW tools).
  597. Then you can easily test ffmpeg with wine
  598. (@url{http://www.winehq.com/}).
  599. @section MacOS X
  600. @section BeOS
  601. The configure script should guess the configuration itself.
  602. Networking support is currently not finished.
  603. errno issues fixed by Andrew Bachmann.
  604. Old stuff:
  605. François Revol - revol at free dot fr - April 2002
  606. The configure script should guess the configuration itself,
  607. however I still didn't tested building on net_server version of BeOS.
  608. ffserver is broken (needs poll() implementation).
  609. There is still issues with errno codes, which are negative in BeOs, and
  610. that ffmpeg negates when returning. This ends up turning errors into
  611. valid results, then crashes.
  612. (To be fixed)
  613. @chapter Developers Guide
  614. @section API
  615. @itemize
  616. @item libavcodec is the library containing the codecs (both encoding and
  617. decoding). See @file{libavcodec/apiexample.c} to see how to use it.
  618. @item libavformat is the library containing the file formats handling (mux and
  619. demux code for several formats). See @file{ffplay.c} to use it in a
  620. player. See @file{output_example.c} to use it to generate audio or video
  621. streams.
  622. @end itemize
  623. @section Integrating libavcodec or libavformat in your program
  624. You can integrate all the source code of the libraries to link them
  625. statically to avoid any version problem. All you need is to provide a
  626. 'config.mak' and a 'config.h' in the parent directory. See the defines
  627. generated by ./configure to understand what is needed.
  628. You can use libavcodec or libavformat in your commercial program, but
  629. @emph{any patch you make must be published}. The best way to proceed is
  630. to send your patches to the ffmpeg mailing list.
  631. @section Coding Rules
  632. ffmpeg is programmed in ANSI C language. GCC extensions are
  633. tolerated. Indent size is 4. The TAB character should not be used.
  634. The presentation is the one specified by 'indent -i4 -kr'.
  635. Main priority in ffmpeg is simplicity and small code size (=less
  636. bugs).
  637. Comments: for functions visible from other modules, use the JavaDoc
  638. format (see examples in @file{libav/utils.c}) so that a documentation
  639. can be generated automatically.
  640. @section Submitting patches
  641. When you submit your patch, try to send a unified diff (diff '-u'
  642. option). I cannot read other diffs :-)
  643. Run the regression tests before submitting a patch so that you can
  644. verify that there are no big problems.
  645. Patches should be posted as base64 encoded attachments (or any other
  646. encoding which ensures that the patch wont be trashed during
  647. transmission) to the ffmpeg-devel mailinglist, see
  648. @url{http://lists.sourceforge.net/lists/listinfo/ffmpeg-devel}
  649. @section Regression tests
  650. Before submitting a patch (or committing with CVS), you should at least
  651. test that you did not break anything.
  652. The regression test build a synthetic video stream and a synthetic
  653. audio stream. Then these are encoded then decoded with all codecs or
  654. formats. The CRC (or MD5) of each generated file is recorded in a
  655. result file. Then a 'diff' is launched with the reference results and
  656. the result file.
  657. The regression test then goes on to test the ffserver code with a
  658. limited set of streams. It is important that this step runs correctly
  659. as well.
  660. Run 'make test' to test all the codecs.
  661. Run 'make libavtest' to test all the codecs.
  662. [Of course, some patches may change the regression tests results. In
  663. this case, the regression tests reference results shall be modified
  664. accordingly].
  665. @bye