Adding FFMPEG support

PJMEDIA can make use of the following FFMPEG development components:

  • libavutil

  • libavformat

  • libavcodec

  • libavdevice

  • libswscale

Installation

PJMEDIA by default supports FFMPEG version 2.8 or newer (see #1897). Using older version of FFMPEG is possible, see the ticket for information.

Android

  1. Follow the instructions from the web on how to build ffmpeg for android. We followed the instructions provided here and successfully built with Android NDK r10.

  2. Copy all library .so files into your Android application project directory, for example:

    cp /Users/me/src/ffmpeg-2.5/android/arm/lib/*.so /Users/me/pjproject-2.0/pjsip-apps/src/swig/java/android/libs/armeabi
    

Debian based distributions

sudo apt-get install libavutil-dev libavformat-dev libavcodec-dev libavdevice-dev libswscale-dev

Note

See the list of FFMPEG packages in https://launchpad.net/ubuntu/+source/ffmpeg

Windows

See Getting/building ffmpeg on Windows

Others

  • Configure and build:

    $ ./configure --enable-shared --disable-static
    $ make && make install
    
  • If H.264 support is needed:

    $ ./configure --enable-shared --disable-static --enable-gpl --enable-libx264
    $ make && make install
    

Building PJPROJECT with FFMPEG support

Autoconf build system

  1. FFMPEG will be detected automatically by configure, or explicitly with --with-ffmpeg=DIR option. Notice the output:

    ...
    checking ffmpeg packages...  libavdevice libavformat libavcodec libswscale libavutil
    ...
    

    Note that support can be explicitly disabled with --disable-ffmpeg option.

  2. Add video support and support of ffmpeg capture device to config_site.h:

    #define PJMEDIA_HAS_VIDEO             1
    #define PJMEDIA_VIDEO_DEV_HAS_FFMPEG  1
    

Visual Studio

  1. Make sure FFMPEG headers and libraries are installed in locations that can be found by MSVC projects

  2. Add video and FFMPEG support to config_site.h:

    #define PJMEDIA_HAS_VIDEO   1
    #define PJMEDIA_HAS_FFMPEG  1
    

    Note

    The above assumes that all FFMPEG components (libavcodecs, libavformat, etc) above are installed. If only partial components are installed, you will need to specify the availability of each components (see PJMEDIA_HAS_LIBAVFORMAT and friends in pjmedia/include/pjmedia/config.h)