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.

810 lines
19KB

  1. <HTML>
  2. <HEAD>
  3. <!-- Created by texi2html 1.56k from ffmpeg-doc.texi on 27 October 2002 -->
  4. <TITLE>FFmpeg Documentation</TITLE>
  5. </HEAD>
  6. <BODY>
  7. <H1>FFmpeg Documentation</H1>
  8. <P>
  9. <P><HR><P>
  10. <H1>Table of Contents</H1>
  11. <UL>
  12. <LI><A NAME="TOC1" HREF="ffmpeg-doc.html#SEC1">1. Introduction</A>
  13. <LI><A NAME="TOC2" HREF="ffmpeg-doc.html#SEC2">2. Quick Start</A>
  14. <UL>
  15. <LI><A NAME="TOC3" HREF="ffmpeg-doc.html#SEC3">2.1 Video and Audio grabbing</A>
  16. <LI><A NAME="TOC4" HREF="ffmpeg-doc.html#SEC4">2.2 Video and Audio file format convertion</A>
  17. </UL>
  18. <LI><A NAME="TOC5" HREF="ffmpeg-doc.html#SEC5">3. Invocation</A>
  19. <UL>
  20. <LI><A NAME="TOC6" HREF="ffmpeg-doc.html#SEC6">3.1 Syntax</A>
  21. <LI><A NAME="TOC7" HREF="ffmpeg-doc.html#SEC7">3.2 Main options</A>
  22. <LI><A NAME="TOC8" HREF="ffmpeg-doc.html#SEC8">3.3 Video Options</A>
  23. <LI><A NAME="TOC9" HREF="ffmpeg-doc.html#SEC9">3.4 Audio Options</A>
  24. <LI><A NAME="TOC10" HREF="ffmpeg-doc.html#SEC10">3.5 Advanced options</A>
  25. <LI><A NAME="TOC11" HREF="ffmpeg-doc.html#SEC11">3.6 Protocols</A>
  26. </UL>
  27. <LI><A NAME="TOC12" HREF="ffmpeg-doc.html#SEC12">4. Tips</A>
  28. <LI><A NAME="TOC13" HREF="ffmpeg-doc.html#SEC13">5. Supported File Formats and Codecs</A>
  29. <UL>
  30. <LI><A NAME="TOC14" HREF="ffmpeg-doc.html#SEC14">5.1 File Formats</A>
  31. <LI><A NAME="TOC15" HREF="ffmpeg-doc.html#SEC15">5.2 Video Codecs</A>
  32. <LI><A NAME="TOC16" HREF="ffmpeg-doc.html#SEC16">5.3 Audio Codecs</A>
  33. </UL>
  34. <LI><A NAME="TOC17" HREF="ffmpeg-doc.html#SEC17">6. Developpers Guide</A>
  35. <UL>
  36. <LI><A NAME="TOC18" HREF="ffmpeg-doc.html#SEC18">6.1 API</A>
  37. <LI><A NAME="TOC19" HREF="ffmpeg-doc.html#SEC19">6.2 Integrating libavcodec or libavformat in your program</A>
  38. <LI><A NAME="TOC20" HREF="ffmpeg-doc.html#SEC20">6.3 Coding Rules</A>
  39. <LI><A NAME="TOC21" HREF="ffmpeg-doc.html#SEC21">6.4 Submitting patches</A>
  40. <LI><A NAME="TOC22" HREF="ffmpeg-doc.html#SEC22">6.5 Regression tests</A>
  41. </UL>
  42. </UL>
  43. <P><HR><P>
  44. <P>
  45. FFmpeg Documentation
  46. <H1><A NAME="SEC1" HREF="ffmpeg-doc.html#TOC1">1. Introduction</A></H1>
  47. <P>
  48. FFmpeg is a very fast video and audio converter. It can also grab from
  49. a live audio/video source.
  50. The command line interface is designed to be intuitive, in the sense
  51. that ffmpeg tries to figure out all the parameters, when
  52. possible. You have usually to give only the target bitrate you want.
  53. <P>
  54. FFmpeg can also convert from any sample rate to any other, and resize
  55. video on the fly with a high quality polyphase filter.
  56. <H1><A NAME="SEC2" HREF="ffmpeg-doc.html#TOC2">2. Quick Start</A></H1>
  57. <H2><A NAME="SEC3" HREF="ffmpeg-doc.html#TOC3">2.1 Video and Audio grabbing</A></H2>
  58. <P>
  59. FFmpeg can use a video4linux compatible video source and any Open Sound
  60. System audio source:
  61. <PRE>
  62. ffmpeg /tmp/out.mpg
  63. </PRE>
  64. <P>
  65. Note that you must activate the right video source and channel
  66. before launching ffmpeg. You can use any TV viewer such as xawtv by
  67. Gerd Knorr which I find very good. You must also set correctly the
  68. audio recording levels with a standard mixer.
  69. <H2><A NAME="SEC4" HREF="ffmpeg-doc.html#TOC4">2.2 Video and Audio file format convertion</A></H2>
  70. <P>
  71. * ffmpeg can use any supported file format and protocol as input:
  72. <P>
  73. Examples:
  74. <P>
  75. * You can input from YUV files:
  76. <PRE>
  77. ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
  78. </PRE>
  79. <P>
  80. It will use the files:
  81. <PRE>
  82. /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
  83. /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
  84. </PRE>
  85. <P>
  86. The Y files use twice the resolution of the U and V files. They are
  87. raw files, without header. They can be generated by all decent video
  88. decoders. You must specify the size of the image with the '-s' option
  89. if ffmpeg cannot guess it.
  90. <P>
  91. * You can input from a RAW YUV420P file:
  92. <PRE>
  93. ffmpeg -i /tmp/test.yuv /tmp/out.avi
  94. </PRE>
  95. <P>
  96. The RAW YUV420P is a file containing RAW YUV planar, for each frame first
  97. come the Y plane followed by U and V planes, which are half vertical and
  98. horizontal resolution.
  99. <P>
  100. * You can output to a RAW YUV420P file:
  101. <PRE>
  102. ffmpeg -i mydivx.avi -o hugefile.yuv
  103. </PRE>
  104. <P>
  105. * You can set several input files and output files:
  106. <PRE>
  107. ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
  108. </PRE>
  109. <P>
  110. Convert the audio file a.wav and the raw yuv video file a.yuv
  111. to mpeg file a.mpg
  112. <P>
  113. * You can also do audio and video convertions at the same time:
  114. <PRE>
  115. ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
  116. </PRE>
  117. <P>
  118. Convert the sample rate of a.wav to 22050 Hz and encode it to MPEG audio.
  119. <P>
  120. * You can encode to several formats at the same time and define a
  121. mapping from input stream to output streams:
  122. <PRE>
  123. ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0
  124. </PRE>
  125. <P>
  126. Convert a.wav to a.mp2 at 64 kbits and b.mp2 at 128 kbits. '-map
  127. file:index' specify which input stream is used for each output
  128. stream, in the order of the definition of output streams.
  129. <P>
  130. * You can transcode decrypted VOBs
  131. <PRE>
  132. ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800 -g 300 -bf 2 -acodec mp3 -ab 128 snatch.avi
  133. </PRE>
  134. <P>
  135. This is a typicall DVD ripper example, input from a VOB file, output
  136. to an AVI file with MPEG-4 video and MP3 audio, note that in this
  137. command we use B frames so the MPEG-4 stream is DivX5 compatible, GOP
  138. size is 300 that means an INTRA frame every 10 seconds for 29.97 fps
  139. input video. Also the audio stream is MP3 encoded so you need LAME
  140. support which is enabled using <CODE>--enable-mp3lame</CODE> when
  141. configuring. The mapping is particullary usefull for DVD transcoding
  142. to get the desired audio language.
  143. <P>
  144. NOTE: to see the supported input formats, use <CODE>ffmpeg -formats</CODE>.
  145. <H1><A NAME="SEC5" HREF="ffmpeg-doc.html#TOC5">3. Invocation</A></H1>
  146. <H2><A NAME="SEC6" HREF="ffmpeg-doc.html#TOC6">3.1 Syntax</A></H2>
  147. <P>
  148. The generic syntax is:
  149. <PRE>
  150. ffmpeg [[options][-i input_file]]... {[options] output_file}...
  151. </PRE>
  152. <P>
  153. If no input file is given, audio/video grabbing is done.
  154. <P>
  155. As a general rule, options are applied to the next specified
  156. file. For example, if you give the '-b 64' option, it sets the video
  157. bitrate of the next file. Format option may be needed for raw input
  158. files.
  159. <P>
  160. By default, ffmpeg tries to convert as losslessly as possible: it
  161. uses the same audio and video parameter fors the outputs as the one
  162. specified for the inputs.
  163. <H2><A NAME="SEC7" HREF="ffmpeg-doc.html#TOC7">3.2 Main options</A></H2>
  164. <DL COMPACT>
  165. <DT><SAMP>`-L'</SAMP>
  166. <DD>
  167. show license
  168. <DT><SAMP>`-h'</SAMP>
  169. <DD>
  170. show help
  171. <DT><SAMP>`-formats'</SAMP>
  172. <DD>
  173. show available formats, codecs, protocols, ...
  174. <DT><SAMP>`-f fmt'</SAMP>
  175. <DD>
  176. force format
  177. <DT><SAMP>`-i filename'</SAMP>
  178. <DD>
  179. input file name
  180. <DT><SAMP>`-y'</SAMP>
  181. <DD>
  182. overwrite output files
  183. <DT><SAMP>`-t duration'</SAMP>
  184. <DD>
  185. set the recording time in seconds. <CODE>hh:mm:ss[.xxx]</CODE> syntax is also
  186. supported.
  187. <DT><SAMP>`-title string'</SAMP>
  188. <DD>
  189. set the title
  190. <DT><SAMP>`-author string'</SAMP>
  191. <DD>
  192. set the author
  193. <DT><SAMP>`-copyright string'</SAMP>
  194. <DD>
  195. set the copyright
  196. <DT><SAMP>`-comment string'</SAMP>
  197. <DD>
  198. set the comment
  199. <DT><SAMP>`-b bitrate'</SAMP>
  200. <DD>
  201. set video bitrate (in kbit/s)
  202. </DL>
  203. <H2><A NAME="SEC8" HREF="ffmpeg-doc.html#TOC8">3.3 Video Options</A></H2>
  204. <DL COMPACT>
  205. <DT><SAMP>`-s size'</SAMP>
  206. <DD>
  207. set frame size [160x128]
  208. <DT><SAMP>`-r fps'</SAMP>
  209. <DD>
  210. set frame rate [25]
  211. <DT><SAMP>`-b bitrate'</SAMP>
  212. <DD>
  213. set the video bitrate in kbit/s [200]
  214. <DT><SAMP>`-vn'</SAMP>
  215. <DD>
  216. disable video recording [no]
  217. <DT><SAMP>`-bt tolerance'</SAMP>
  218. <DD>
  219. set video bitrate tolerance (in kbit/s)
  220. <DT><SAMP>`-sameq'</SAMP>
  221. <DD>
  222. use same video quality as source (implies VBR)
  223. <DT><SAMP>`-pass n'</SAMP>
  224. <DD>
  225. 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.
  226. <DT><SAMP>`-passlogfile file'</SAMP>
  227. <DD>
  228. select two pass log file name
  229. </DL>
  230. <H2><A NAME="SEC9" HREF="ffmpeg-doc.html#TOC9">3.4 Audio Options</A></H2>
  231. <DL COMPACT>
  232. <DT><SAMP>`-ab bitrate'</SAMP>
  233. <DD>
  234. set audio bitrate (in kbit/s)
  235. <DT><SAMP>`-ar freq'</SAMP>
  236. <DD>
  237. set the audio sampling freq [44100]
  238. <DT><SAMP>`-ab bitrate'</SAMP>
  239. <DD>
  240. set the audio bitrate in kbit/s [64]
  241. <DT><SAMP>`-ac channels'</SAMP>
  242. <DD>
  243. set the number of audio channels [1]
  244. <DT><SAMP>`-an'</SAMP>
  245. <DD>
  246. disable audio recording [no]
  247. </DL>
  248. <H2><A NAME="SEC10" HREF="ffmpeg-doc.html#TOC10">3.5 Advanced options</A></H2>
  249. <DL COMPACT>
  250. <DT><SAMP>`-map file:stream'</SAMP>
  251. <DD>
  252. set input stream mapping
  253. <DT><SAMP>`-g gop_size'</SAMP>
  254. <DD>
  255. set the group of picture size
  256. <DT><SAMP>`-intra'</SAMP>
  257. <DD>
  258. use only intra frames
  259. <DT><SAMP>`-qscale q'</SAMP>
  260. <DD>
  261. use fixed video quantiser scale (VBR)
  262. <DT><SAMP>`-qmin q'</SAMP>
  263. <DD>
  264. min video quantiser scale (VBR)
  265. <DT><SAMP>`-qmax q'</SAMP>
  266. <DD>
  267. max video quantiser scale (VBR)
  268. <DT><SAMP>`-qdiff q'</SAMP>
  269. <DD>
  270. max difference between the quantiser scale (VBR)
  271. <DT><SAMP>`-qblur blur'</SAMP>
  272. <DD>
  273. video quantiser scale blur (VBR)
  274. <DT><SAMP>`-qcomp compression'</SAMP>
  275. <DD>
  276. video quantiser scale compression (VBR)
  277. <DT><SAMP>`-vd device'</SAMP>
  278. <DD>
  279. set video device
  280. <DT><SAMP>`-vcodec codec'</SAMP>
  281. <DD>
  282. force video codec
  283. <DT><SAMP>`-me method'</SAMP>
  284. <DD>
  285. set motion estimation method
  286. <DT><SAMP>`-bf frames'</SAMP>
  287. <DD>
  288. use 'frames' B frames (only MPEG-4)
  289. <DT><SAMP>`-hq'</SAMP>
  290. <DD>
  291. activate high quality settings
  292. <DT><SAMP>`-4mv'</SAMP>
  293. <DD>
  294. use four motion vector by macroblock (only MPEG-4)
  295. <DT><SAMP>`-ad device'</SAMP>
  296. <DD>
  297. set audio device
  298. <DT><SAMP>`-acodec codec'</SAMP>
  299. <DD>
  300. force audio codec
  301. <DT><SAMP>`-deinterlace'</SAMP>
  302. <DD>
  303. deinterlace pictures
  304. <DT><SAMP>`-benchmark'</SAMP>
  305. <DD>
  306. add timings for benchmarking
  307. <DT><SAMP>`-hex'</SAMP>
  308. <DD>
  309. dump each input packet
  310. <DT><SAMP>`-psnr'</SAMP>
  311. <DD>
  312. calculate PSNR of compressed frames
  313. <DT><SAMP>`-vstats'</SAMP>
  314. <DD>
  315. dump video coding statistics to file
  316. </DL>
  317. <H2><A NAME="SEC11" HREF="ffmpeg-doc.html#TOC11">3.6 Protocols</A></H2>
  318. <P>
  319. The output file can be "-" to output to a pipe. This is only possible
  320. with mpeg1 and h263 formats.
  321. <P>
  322. ffmpeg handles also many protocols specified with the URL syntax.
  323. <P>
  324. Use 'ffmpeg -formats' to have a list of the supported protocols.
  325. <P>
  326. The protocol <CODE>http:</CODE> is currently used only to communicate with
  327. ffserver (see the ffserver documentation). When ffmpeg will be a
  328. video player it will also be used for streaming :-)
  329. <H1><A NAME="SEC12" HREF="ffmpeg-doc.html#TOC12">4. Tips</A></H1>
  330. <UL>
  331. <LI>For streaming at very low bit rate application, use a low frame rate
  332. and a small gop size. This is especially true for real video where
  333. the Linux player does not seem to be very fast, so it can miss
  334. frames. An example is:
  335. <PRE>
  336. ffmpeg -g 3 -r 3 -t 10 -b 50 -s qcif -f rv10 /tmp/b.rm
  337. </PRE>
  338. <LI>The parameter 'q' which is displayed while encoding is the current
  339. quantizer. The value of 1 indicates that a very good quality could
  340. be achieved. The value of 31 indicates the worst quality. If q=31
  341. too often, it means that the encoder cannot compress enough to meet
  342. your bit rate. You must either increase the bit rate, decrease the
  343. frame rate or decrease the frame size.
  344. <LI>If your computer is not fast enough, you can speed up the
  345. compression at the expense of the compression ratio. You can use
  346. '-me zero' to speed up motion estimation, and '-intra' to disable
  347. completly motion estimation (you have only I frames, which means it
  348. is about as good as JPEG compression).
  349. <LI>To have very low bitrates in audio, reduce the sampling frequency
  350. (down to 22050 kHz for mpeg audio, 22050 or 11025 for ac3).
  351. <LI>To have a constant quality (but a variable bitrate), use the option
  352. '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
  353. quality).
  354. <LI>When converting video files, you can use the '-sameq' option which
  355. uses in the encoder the same quality factor than in the decoder. It
  356. allows to be almost lossless in encoding.
  357. </UL>
  358. <H1><A NAME="SEC13" HREF="ffmpeg-doc.html#TOC13">5. Supported File Formats and Codecs</A></H1>
  359. <P>
  360. You can use the <CODE>-formats</CODE> option to have an exhaustive list.
  361. <H2><A NAME="SEC14" HREF="ffmpeg-doc.html#TOC14">5.1 File Formats</A></H2>
  362. <P>
  363. FFmpeg supports the following file formats thru the <CODE>libavformat</CODE>
  364. library.
  365. <TABLE BORDER>
  366. <TR><TD>Supported File Format </TD><TD> Encoding </TD><TD> Decoding </TD><TD> Comments</TD>
  367. </TR>
  368. <TR><TD>MPEG audio </TD><TD> X </TD><TD> X</TD>
  369. </TR>
  370. <TR><TD>MPEG1 systems </TD><TD> X </TD><TD> X</TD>
  371. </TD><TD> muxed audio and video
  372. </TR>
  373. <TR><TD>MPEG2 PS </TD><TD> X </TD><TD> X</TD>
  374. </TD><TD> also known as <CODE>VOB</CODE> file
  375. </TR>
  376. <TR><TD>MPEG2 TS </TD><TD> </TD><TD> X</TD>
  377. </TD><TD> also known as DVB Transport Stream
  378. </TR>
  379. <TR><TD>ASF</TD><TD> X </TD><TD> X</TD>
  380. </TR>
  381. <TR><TD>AVI</TD><TD> X </TD><TD> X</TD>
  382. </TR>
  383. <TR><TD>WAV</TD><TD> X </TD><TD> X</TD>
  384. </TR>
  385. <TR><TD>Macromedia Flash</TD><TD> X </TD><TD> X</TD>
  386. </TD><TD> Only embedded audio is decoded
  387. </TR>
  388. <TR><TD>Real Audio and Video </TD><TD> X </TD><TD> X</TD>
  389. </TR>
  390. <TR><TD>PGM, YUV, PPM, JPEG images </TD><TD> X </TD><TD> X</TD>
  391. </TR>
  392. <TR><TD>Animated GIF </TD><TD> X </TD><TD></TD>
  393. </TD><TD> Only uncompressed GIFs are generated
  394. </TR>
  395. <TR><TD>Raw AC3 </TD><TD> X </TD><TD> X</TD>
  396. </TR>
  397. <TR><TD>Raw MJPEG </TD><TD> X </TD><TD> X</TD>
  398. </TR>
  399. <TR><TD>Raw MPEG video </TD><TD> X </TD><TD> X</TD>
  400. </TR>
  401. <TR><TD>Raw PCM8/16 bits, mulaw/Alaw</TD><TD> X </TD><TD> X</TD>
  402. </TR>
  403. <TR><TD>SUN AU format </TD><TD> X </TD><TD> X</TD>
  404. </TR>
  405. <TR><TD>Quicktime </TD><TD> </TD><TD> X</TD>
  406. </TR>
  407. <TR><TD>MPEG4 </TD><TD> </TD><TD> X</TD>
  408. </TD><TD> MPEG4 is a variant of Quicktime
  409. </TR>
  410. <TR><TD>Raw MPEG4 video </TD><TD> </TD><TD> X</TD>
  411. </TD><TD> Only small files are supported.
  412. </TR>
  413. <TR><TD>DV </TD><TD> </TD><TD> X</TD>
  414. </TD><TD> Only the video track is decoded.
  415. </TR></TABLE>
  416. <P>
  417. <CODE>X</CODE> means that the encoding (resp. decoding) is supported.
  418. <H2><A NAME="SEC15" HREF="ffmpeg-doc.html#TOC15">5.2 Video Codecs</A></H2>
  419. <TABLE BORDER>
  420. <TR><TD>Supported Codec </TD><TD> Encoding </TD><TD> Decoding </TD><TD> Comments</TD>
  421. </TR>
  422. <TR><TD>MPEG1 video </TD><TD> X </TD><TD> X</TD>
  423. </TR>
  424. <TR><TD>MPEG2 video </TD><TD> </TD><TD> X</TD>
  425. </TR>
  426. <TR><TD>MPEG4 </TD><TD> X </TD><TD> X </TD><TD> Also known as DIVX4/5</TD>
  427. </TR>
  428. <TR><TD>MSMPEG4 V1 </TD><TD> X </TD><TD> X</TD>
  429. </TR>
  430. <TR><TD>MSMPEG4 V2 </TD><TD> X </TD><TD> X</TD>
  431. </TR>
  432. <TR><TD>MSMPEG4 V3 </TD><TD> X </TD><TD> X </TD><TD> Also known as DIVX3</TD>
  433. </TR>
  434. <TR><TD>WMV7 </TD><TD> X </TD><TD> X</TD>
  435. </TR>
  436. <TR><TD>H263(+) </TD><TD> X </TD><TD> X </TD><TD> Also known as Real Video 1.0</TD>
  437. </TR>
  438. <TR><TD>MJPEG </TD><TD> X </TD><TD> X</TD>
  439. </TR>
  440. <TR><TD>DV </TD><TD> </TD><TD> X</TD>
  441. </TR></TABLE>
  442. <P>
  443. <CODE>X</CODE> means that the encoding (resp. decoding) is supported.
  444. <P>
  445. Check at <A HREF="http://www.mplayerhq.hu/~michael/codec-features.html">http://www.mplayerhq.hu/~michael/codec-features.html</A> to
  446. get a precise comparison of FFmpeg MPEG4 codec compared to the other
  447. solutions.
  448. <H2><A NAME="SEC16" HREF="ffmpeg-doc.html#TOC16">5.3 Audio Codecs</A></H2>
  449. <TABLE BORDER>
  450. <TR><TD>Supported Codec </TD><TD> Encoding </TD><TD> Decoding </TD><TD> Comments</TD>
  451. </TR>
  452. <TR><TD>MPEG audio layer 2 </TD><TD> IX </TD><TD> IX</TD>
  453. </TR>
  454. <TR><TD>MPEG audio layer 1/3 </TD><TD> IX </TD><TD> IX</TD>
  455. </TD><TD> MP3 encoding is supported thru the external library LAME
  456. </TR>
  457. <TR><TD>AC3 </TD><TD> IX </TD><TD> X</TD>
  458. </TD><TD> liba52 is used internally for decoding.
  459. </TR>
  460. <TR><TD>Vorbis </TD><TD> X </TD><TD></TD>
  461. </TD><TD> encoding is supported thru the external library libvorbis.
  462. </TR></TABLE>
  463. <P>
  464. <CODE>X</CODE> means that the encoding (resp. decoding) is supported.
  465. <P>
  466. <CODE>I</CODE> means that an integer only version is available too (ensures highest
  467. performances on systems without hardware floating point support).
  468. <H1><A NAME="SEC17" HREF="ffmpeg-doc.html#TOC17">6. Developpers Guide</A></H1>
  469. <H2><A NAME="SEC18" HREF="ffmpeg-doc.html#TOC18">6.1 API</A></H2>
  470. <UL>
  471. <LI>libavcodec is the library containing the codecs (both encoding and
  472. decoding). See <TT>`libavcodec/apiexample.c'</TT> to see how to use it.
  473. <LI>libavformat is the library containing the file formats handling (mux and
  474. demux code for several formats). (no example yet, the API is likely to
  475. evolve).
  476. </UL>
  477. <H2><A NAME="SEC19" HREF="ffmpeg-doc.html#TOC19">6.2 Integrating libavcodec or libavformat in your program</A></H2>
  478. <P>
  479. You can integrate all the source code of the libraries to link them
  480. statically to avoid any version problem. All you need is to provide a
  481. 'config.mak' and a 'config.h' in the parent directory. See the defines
  482. generated by ./configure to understand what is needed.
  483. <P>
  484. You can use libavcodec or libavformat in your commercial program, but
  485. <EM>any patch you make must be published</EM>. The best way to proceed is
  486. to send your patches to the ffmpeg mailing list.
  487. <H2><A NAME="SEC20" HREF="ffmpeg-doc.html#TOC20">6.3 Coding Rules</A></H2>
  488. <P>
  489. ffmpeg is programmed in ANSI C language. GCC extensions are
  490. tolerated. Indent size is 4. The TAB character should not be used.
  491. <P>
  492. The presentation is the one specified by 'indent -i4 -kr'.
  493. <P>
  494. Main priority in ffmpeg is simplicity and small code size (=less
  495. bugs).
  496. <P>
  497. Comments: for functions visible from other modules, use the JavaDoc
  498. format (see examples in <TT>`libav/utils.c'</TT>) so that a documentation
  499. can be generated automatically.
  500. <H2><A NAME="SEC21" HREF="ffmpeg-doc.html#TOC21">6.4 Submitting patches</A></H2>
  501. <P>
  502. When you submit your patch, try to send a unified diff (diff '-u'
  503. option). I cannot read other diffs :-)
  504. <P>
  505. Run the regression tests before submitting a patch so that you can
  506. verify that there is no big problems.
  507. <P>
  508. Except if your patch is really big and adds an important feature, by
  509. submitting it to me, you accept implicitely to put it under my
  510. copyright. I prefer to do this to avoid potential problems if
  511. licensing of ffmpeg changes.
  512. <P>
  513. Patches should be posted as base64 encoded attachments (or any other
  514. encoding which ensures that the patch wont be trashed during
  515. transmission) to the ffmpeg-devel mailinglist, see
  516. <A HREF="http://lists.sourceforge.net/lists/listinfo/ffmpeg-devel">http://lists.sourceforge.net/lists/listinfo/ffmpeg-devel</A>
  517. <H2><A NAME="SEC22" HREF="ffmpeg-doc.html#TOC22">6.5 Regression tests</A></H2>
  518. <P>
  519. Before submitting a patch (or commiting with CVS), you should at least
  520. test that you did not break anything.
  521. <P>
  522. The regression test build a synthetic video stream and a synthetic
  523. audio stream. Then there are encoded then decoded with all codecs or
  524. formats. The CRC (or MD5) of each generated file is recorded in a
  525. result file. Then a 'diff' is launched with the reference results and
  526. the result file.
  527. <P>
  528. Run 'make test' to test all the codecs.
  529. <P>
  530. Run 'make libavtest' to test all the codecs.
  531. <P>
  532. [Of course, some patches may change the regression tests results. In
  533. this case, the regression tests reference results shall be modified
  534. accordingly].
  535. <P><HR><P>
  536. This document was generated on 27 October 2002 using
  537. <A HREF="http://wwwinfo.cern.ch/dis/texi2html/">texi2html</A>&nbsp;1.56k.
  538. </BODY>
  539. </HTML>