Changes between Version 22 and Version 23 of Using libav*


Ignore:
Timestamp:
Nov 10, 2017, 10:08:54 AM (2 weeks ago)
Author:
slhck
Comment:

formatting, add new tutorial, remove outdated tutorial

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. 
     1First 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. 
    22 
    33FFmpeg 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 devices 
    8 * 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 routines 
    11 * libswresample provides an audio resampling, rematrixing and sample format conversion API, and many high-quality optimized routines. 
    124 
    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. 
    1413 
    15 = Getting started = 
     14These 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 = 
    1617 
    1718Here is the [https://www.ffmpeg.org/documentation.html official documentation] for using these libraries (the "Libraries Documentation" section). 
    1819 
    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]). 
     20Also 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]). 
    2021 
    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. 
     22In general, you must: 
    2223 
    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 
    2427 
    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 = 
    2629 
    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]). 
     30There 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] 
    2835 
    2936= Hints = 
     
    4552 1. come up with the ffmpeg app command line which does what you want 
    4653 
    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`. 
    4855 
    4956== libswresample == 
     
    5966Check its [http://ffmpeg.org/doxygen/trunk/group__lavd.html doxygen documentation]. 
    6067 
    61 here is an example: http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=274 
     68Here is [http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=274 an example] on Opening dshow with `avformat_open_input`. 
    6269 
    6370== libavfilter == 
    6471 
    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  
     72See [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. 
    6773 
    6874= Contact = 
    6975 
    7076If 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