OpenCV in Ubuntu 11.10 – Solution to Error swscaler No accelerated colorspace conversion found

Using OpenCV in UbuntuRecently I have faced the (tedious) task of migrating a big OpenCV project from Windows to Linux (Ubuntu 10.04). Ideally one just needs to follow any of the many brief tutorials you can find on the Internet to do so:

However, when everything was installed and I tried one of the samples OpenCV provides (bgfg_segm), I received an annoying warning for each processed frame saying something like:

[swscaler @ 0x1666620]No accelerated colorspace conversion found.

These warnings made me think that there were some problem in the use of functions such as cv::cvtColor, or cv::resize, and indeed I checked that the performance of the sample was pretty bad.

Googling this error I found that the supposed solution was lying on the instalation of the newwst libraries x264 and ffmpeg. For this purpose I followed the tutorials:

But I realized that with Ubuntu 10.04, there is an inherent incompatibility between ffmpeg and OpenCV 2.3 (I mean, between OpenCV 2.3 and the ffmpeg-related libraries you get using the synaptic manager or apt-get), which makes that after you download, compile and install x264 and ffmpeg, OpenCV cannot compile, since it gives some errors because it does not find functions such as av_open_input_file,. These functions were looked for in the files:


But unfortunately they do not exist there, but similar functions called avformat_open_input.

I went back to the default instalation of ffmpeg libraries, and found that the version of the libswscale was 0.7.0, while a friend of mine, that had Ubuntu 10.0 had version 0.12.0, which offered no warnings.

I decided to upgrade to Ubuntu 10.10 and tried downloading again the libavformat-dev and all the associated libraries. After installing, the version of libswscale was 0.11.0, and the warning was still there.

I had to upgrade until Ubuntu 11.10 to get a 2.0.0 version of the libswscale library, which finally resulted in an excellent performance of all the OpenCV samples, without warnings and without the (annoying as well) need to manually compile and install the “latest” x264 and ffmpeg libraries.

So my suggestion is: upgrade to Ubuntu 11.10, use the repository versions of all the requested libraries (sudo apt-get install libavcodec-dev and the others, the fastest way is to use CMake and by applying ./configure, OpenCV tells you what libraries are missing), and forget about downloading the latest source code of ffmpeg and x264 because it seems that OpenCV and ffmpeg are not well synchronized and you can spend a lot of your time to figure out that the latest versions are not necesarily compatible.

Hope it helps!

This entry was posted in OpenCV and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s