Changes between Version 22 and Version 23 of Using libav*
- Timestamp:
- Nov 10, 2017, 8:08:54 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Using libav*
v22 v23 1 First some disambiguiation . there is a project called "libav" which is basically a fork of FFmpeg. There is also a library system that underlies FFmpeg itself, also called libav. This page is about the library libav, which is a part of FFmpeg.1 First some disambiguiation: there is a fork of FFmpeg called [https://www.libav.org/ Libav]. There is also a library system that underlies FFmpeg itself, called `libav`. This page is about the library `libav`, which is a part of FFmpeg. 2 2 3 3 FFmpeg itself is composed of several libraries that can be used individually, and outside of FFmpeg, for instance in integrating parts of FFmpeg into your own program. These are: 4 * libavutil contains various routines used to simplify programming, including random number generators, data structures, mathematics routines, core multimedia utilities, and much more.5 * libavcodec provides a decoding and encoding API, and all the supported codecs.6 * libavformat provides a demuxing and muxing API, and all the supported muxers and de-muxers.7 * libavdevice provides an interface for grabbing from input devices (e.g. webcames or line-in audio) and rendering to output devices, and all the supported input and output devices8 * libswscale provides a scaling and (raw pixel) format conversions API, with high speed/assembly optimized versions of several scaling routines.9 * libavfilter provides an audio and video filtering API, and all the supported filters.10 * libpostproc provides video postprocessing routines11 * libswresample provides an audio resampling, rematrixing and sample format conversion API, and many high-quality optimized routines.12 4 13 These can be useful for instance if you don't have access to a command line to run ffmpeg.exe (for example, Android apps), or if you want to use just a small "part" of FFmpeg inside your own program, or if you want access to raw video frames in your program, etc. Also note that if you just need access to raw video frames, you could also write an audio or video [FilteringGuide filter] and compile it along with FFmpeg and distribute that. Another way to access raw video frames is to have ffmpeg output to "stdout", like {{{ffmpeg -i ... -}}}. Also note that if you just need to convert/transcode videos within your own application, you could make a system call out to the FFmpeg executable to do the heavy lifting for you. You can parse the output for stdout for status information, or use the "-progress" option to make the output even more parseable. 5 * `libavutil` contains various routines used to simplify programming, including random number generators, data structures, mathematics routines, core multimedia utilities, and much more. 6 * `libavcodec` provides a decoding and encoding API, and all the supported codecs. 7 * `libavformat` provides a demuxing and muxing API, and all the supported muxers and de-muxers. 8 * `libavdevice` provides an interface for grabbing from input devices (e.g. webcames or line-in audio) and rendering to output devices, and all the supported input and output devices 9 * `libswscale` provides a scaling and (raw pixel) format conversions API, with high speed/assembly optimized versions of several scaling routines. 10 * `libavfilter` provides an audio and video filtering API, and all the supported filters. 11 * `libpostproc` provides video postprocessing routines 12 * `libswresample` provides an audio resampling, rematrixing and sample format conversion API, and many high-quality optimized routines. 14 13 15 = Getting started = 14 These can be useful for instance if you don't have access to a command line to run ` ffmpeg` as an executable, or if you want to use just a small "part" of FFmpeg inside your own program, or if you want access to raw video frames in your program, etc. Also note that if you just need access to raw video frames, you could also write an audio or video [FilteringGuide filter] and compile it along with FFmpeg and distribute that. Another way to access raw video frames is to have ffmpeg output to "stdout", like {{{ffmpeg -i ... -}}}. Also note that if you just need to convert/transcode videos within your own application, you could make a system call out to the FFmpeg executable to do the heavy lifting for you. You can parse the output for stdout for status information, or use the `-progress` option to make the output even more parseable. 15 16 = Getting Started = 16 17 17 18 Here is the [https://www.ffmpeg.org/documentation.html official documentation] for using these libraries (the "Libraries Documentation" section). 18 19 19 Also check [https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples doc/examples] ,the doxygen documentation is fairly complete and should work as reference (example: the [http://ffmpeg.org/doxygen/trunk/files.html example codes as doxygen]).20 Also check [https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples doc/examples]; the doxygen documentation is fairly complete and should work as reference (example: the [http://ffmpeg.org/doxygen/trunk/files.html example codes as doxygen]). 20 21 21 In general, you must have the appropriate library compiled/available on your machine (for instance, if using packages, something like libswscale-dev must be installed, or configure, build, and install FFmpeg yourself using the --enable-shared configure option), then you include the appropriate header file in your C code, then link against that library's linker file, like "gcc input.c -lswscale" or the like during the linker phase.22 In general, you must: 22 23 23 = Tutorials = 24 * have the appropriate library compiled/available on your machine (for instance, if using packages, something like `libswscale-dev` must be installed, or `configure`, build, and install FFmpeg yourself using the `--enable-shared` configure option) 25 * include the appropriate header file in your C code 26 * link against that library's linker file, like `gcc input.c -lswscale` or the like during the linker phase 24 27 25 The web has a few tutorials, some of which are out of date. The doc/examples files usually use the latest ABI, however, should be more trustworthy. 28 = Community-contributed Tutorials = 26 29 27 [http://dranger.com/ffmpeg/ An FFmpeg and SDL Tutorial by Stephen Dranger], explains how to write a video player based on FFmpeg (see also [https://github.com/phamquy/FFmpeg-tutorial-samples here]). 30 There are a few tutorials on the web, however, some of them are outdated. The doc/examples files provided by FFmpeg usually use the latest ABI (i.e., they are the best reference on which `libav` calls to make) and are therefore more trustworthy. 31 32 * [http://dranger.com/ffmpeg/ An FFmpeg and SDL Tutorial by Stephen Dranger]: explains how to write a video player based on FFmpeg 33 * [https://github.com/leandromoreira/ffmpeg-libav-tutorial#ffmpeg-command-line-tool-101 Learn FFmpeg libav the Hard Way by Leandro Moreira]: a work in progress tutorial on using `libav`. 34 * [https://wiki.multimedia.cx/index.php?title=Category:FFmpeg_Tutorials MultimediaWiki list of FFmpeg tutorials] 28 35 29 36 = Hints = … … 45 52 1. come up with the ffmpeg app command line which does what you want 46 53 47 2. use the gdb debugger to execute the ffmpeg_g app, put a breakpoint on avcodec_encode_audio2() (or whichever method you need), and see what values the ffmpeg app uses for AVPacket and for the (audio or otherwise) related fields in AVCodecContext.54 2. use the `gdb` debugger to execute the `ffmpeg_g` app, put a breakpoint on `avcodec_encode_audio2()` (or whichever method you need), and see what values the ffmpeg app uses for AVPacket and for the (audio or otherwise) related fields in `AVCodecContext`. 48 55 49 56 == libswresample == … … 59 66 Check its [http://ffmpeg.org/doxygen/trunk/group__lavd.html doxygen documentation]. 60 67 61 here is an example: http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=274 68 Here is [http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=274 an example] on Opening dshow with `avformat_open_input`. 62 69 63 70 == libavfilter == 64 71 65 See http://wiki.multimedia.cx/index.php?title=Libavfilter and also the examples, and already existing filters. we have more doxy, some examples and a libavfilter-design document in doc. Also see the ffmpeg documentation for the various filters. 66 72 See [http://wiki.multimedia.cx/index.php?title=Libavfilter the MultimediaWiki entry on libavfilter] and also the examples, and already existing filters. We have more doxy, some examples and a libavfilter-design document in the documentation. 67 73 68 74 = Contact = 69 75 70 76 If you have problems, one place to get help is to ask the [https://lists.ffmpeg.org/mailman/listinfo/libav-user/ libav-user] mailing list, its description: "This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter." IRC might work also. 71 72 == see also ==73 74 http://wiki.multimedia.cx/index.php?title=Category:FFmpeg_Tutorials
