[FFmpeg-user] compiling ffmpeg with swscale

Michael Bradshaw mbradshaw at sorensonmedia.com
Tue Jul 10 18:49:50 CEST 2012

On Tue, Jul 10, 2012 at 8:46 AM,  <kev2m at voila.fr> wrote:
> Hi,
> For a scholar internship, I need to use ffmpeg and the swscale library. And I think I have trouble with the installation of the swscale library. I'm using Ubuntu 11.10.
> I have download the last version of ffmpeg with the command "git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg"
> I have configure the installation with the command "./configure --enable-swscale --enable-shared --enable-gpl --enable-libx264 --prefix=/usr/local" (I know a lot of these options are useless, I just add them to be sure...)
> Then I "make", "make install" and "ldconfig".
> Everything works fine until I try to compile my project.
> In my project, we can find these lines :
>> #include
>> [...]
>> struct SwsContext* convertCtx = sws_getContext(W_fen, H_fen, PIX_FMT_RGB24, W_fen, H_fen, PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL);
>> [...]
>> sws_scale(convertCtx, &image, &srcstride, 0, H_fen, enc->input.img.plane, enc->input.img.i_stride);
> When I compile it with the command :
>> g++ -Wl,-O1 -o main main.o mesh.o -L/usr/lib/i386-linux-gnu -L/usr/X11R6/lib -lglut -lQtOpenGL -lQtGui -lQtCore -lGLU -lGL -lpthread -L/usr/local/lib/ -lswscale -lx264
> I get the error :
>> main.o: In function `dessiner()':
>> main.cpp:(.text+0xccb): undefined reference to `sws_getContext(int, int, PixelFormat, int, int, PixelFormat, int, SwsFilter*, SwsFilter*, double const*)'
>> main.cpp:(.text+0xd1c): undefined reference to `sws_scale(SwsContext*, unsigned char const* const*, int const*, int, int, unsigned char* const*, int const*)'
> And yet, the files /usr/local/include/libswscale/swscale.h and /usr/local/lib/libswscale{.a, .so, .so.2, .so.2.1.100} exist.
> I guess (I'm not sure of that) that's because the swscale library is not properly installed. And I would like some advice to install it or to be sure of what the problem is.

Have you tried with any of the other libraries (libavcodec,
libavformat, etc.)? If you make a tiny sample program that depends on
one of them, can you properly link to it too?

The fact that it's not complaining about not finding swscale.h or
-lswscale implies that it is indeed finding them. Are you sure the
libs and your program are both built for the same architecture (32/64

Also, what's your ldconfig command?


More information about the ffmpeg-user mailing list