title: FFMPEG with SoX: configure: error: cannot find ffmpeg
body: <p>So I am trying to install in my Ubuntu Desktop 12.04 SoX with FFMPEG support for m4a files.</p>
  
  <p>I have followed <a href="http://trac.ffmpeg.org/wiki/UbuntuCompilationGuide" rel="nofollow">this</a> instructions to install FFMPEG, installing only certain encoders. Finally, this is my set up:</p>
  
  <pre><code>ffmpeg version git-2014-01-17-3ca7085 Copyright (c) 2000-2014 the FFmpeg developers
    built on Jan 17 2014 12:36:01 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
    configuration: --prefix=~/ffmpeg_build --extra-cflags=-I~/ffmpeg_build/include --extra-ldflags=-L~/ffmpeg_build/lib --bindir=~/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-nonfree
    libavutil      52. 62.100 / 52. 62.100
    libavcodec     55. 48.101 / 55. 48.101
    libavformat    55. 23.103 / 55. 23.103
    libavdevice    55.  5.102 / 55.  5.102
    libavfilter     4.  1.100 /  4.  1.100
    libswscale      2.  5.101 /  2.  5.101
    libswresample   0. 17.104 /  0. 17.104
    libpostproc    52.  3.100 / 52.  3.100
  Hyper fast Audio and Video encoder
  </code></pre>
  
  <p>Then, I wget SoX 14.4.1 version and try to configure with FFMPEG support like this:</p>
  
  <pre><code>./configure --with-ffmpeg
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>checking for FFMPEG... no
  checking libavformat/avformat.h usability... no
  checking libavformat/avformat.h presence... no
  checking for libavformat/avformat.h... no
  checking ffmpeg/avformat.h usability... no
  checking ffmpeg/avformat.h presence... no
  checking for ffmpeg/avformat.h... no
  configure: error: in `~/sox-14.4.1':
  configure: error: cannot find ffmpeg
  See `config.log' for more details
  </code></pre>
  
  <p>So I try to set PKG_CONFIG_PATH environment variable:</p>
  
  <pre><code>PKG_CONFIG_PATH=~/ffmpeg_build/lib/pkgconfig
  ./configure --with-ffmpeg
  </code></pre>
  
  <p>Getting:</p>
  
  <pre><code>checking for FFMPEG... yes
  checking libavformat/avformat.h usability... yes
  checking libavformat/avformat.h presence... yes
  checking for libavformat/avformat.h... yes
  checking for av_open_input_file in -lavformat... no
  configure: error: in `~/sox-14.4.1':
  configure: error: cannot find ffmpeg
  See `config.log' for more details
  </code></pre>
  
  <p>Checking 'config.log' I see the following error:</p>
  
  <pre><code>| #define HAVE_LIBAVFORMAT_AVFORMAT_H 1
  | /* end confdefs.h.  */
  |
  | /* Override any GCC internal prototype to avoid an error.
  |    Use char because int might match the return type of a GCC
  |    builtin and then its argument prototype would still apply.  */
  | #ifdef __cplusplus
  | extern "C"
  | #endif
  | char av_open_input_file ();
  | int
  | main ()
  | {
  | return av_open_input_file ();
  |   ;
  |   return 0;
  | }
  configure:15862: result: no
  configure:15935: error: in `~/sox-14.4.1':
  configure:15937: error: cannot find ffmpeg
  </code></pre>
  
  <p>What am I missing here?
  Thx!</p>