[FFmpeg-devel] [PATCH] Enable RGB32 on video4linux2 devices

Luca Abeni lucabe72
Fri Sep 5 15:46:43 CEST 2008

Hi Jean,

Jean Delvare wrote:
>> Anyway, if you have a v4l2 card supporting V4L2_PIX_FMT_{BGR,RGB}32,
>> you test the patch, and you confirm that it works, I'll commit it.
> My original patch wasn't correct, I realized it only after testing,
> sorry about that. There are two factors which make this specific format
> difficult to deal with:
> * The RGB4 format is apparently not totally specified in the V4L2
>   standard. Some drivers think it means RGBA and others think it means
>   ARGB:
>   http://www.linuxtv.org/downloads/video4linux/API/V4L2_API/spec-single/v4l2.html#PACKED-RGB
> * The 32-bit RGB formats in ffmpeg depend on the host endianess. This
>   means that PIX_FMT_RGB32 isn't the same the same if ffmpeg runs on a
>   little-endian machine or a big-endian machine.

Maybe these are the factors that confused me when I wrote the
original code, suggesting to comment out the rgb32 format ;-)

> There seems to be an alias which resolves to the correct format based
> on the endianess: PIX_FMT_BGRA.

Yes, I think BGRA should be what is needed here.

> However I suspect it won't
> work on big-endian machines, where it resolves to PIX_FMT_BGR32_1, due
> to ffmpeg refusing to use PIX_FMT_BGR32_1 as an input pixel format:
> swScaler: rgb32x is not supported as input pixel format

Well, that's just swscaler not supporting this specific pixel format; it
does not look like v4l2.c's fault. So, I think your patch is ok.

I'll commit your patch later today, or tomorrow, as soon as I have some


More information about the ffmpeg-devel mailing list