VideoCapture in both OpenCV 2.1 and 2.2 under the platform Ubuntu 10.10 64-bit keeps showing annoying warning messages when it reads some .avi files:

[swscaler @ 0x81ac360]No accelerated colorspace conversion found from yuv420p to bgr24

Surprisingly, there are only few people have such a problem after I googled for a while, and no solution as well.

I then traced the code and found that the issue should belong to FFmpeg.

The official FFmpeg library seems to be released without libswscale support in Ubuntu…

Anyway, the warning message can be removed by recompiling the FFmpeg with specifying
--enable-swscale, and according to the instruction:

1
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab --enable-swscale

Also note that --enable-gpl must be assigned since there is a condition in the libswscale/swscale.c source code:

2153
2154
2155
2156
2157
2158
2159
#ifdef CONFIG_GPL
        /* yuv2bgr */
        if((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P) && (isBGR(dstFormat) || isRGB(dstFormat)))
        {
            c->swScale = yuv2rgb_get_func_ptr(c);
        }
#endif

The function yuv2rgb_get_func_ptr is in charge of the yuv420 to bgr24 colorspace conversion I think.

05/01/2011

  1. you should recompile opencv to get the new FFmpeg work.
  2. configure "--enable-shared" and "--enable-pic" in each library if you want to use shared libraries.
Broadcast this:
  • Facebook
  • Plurk
  • Twitter
  • Google Bookmarks
  • Print