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

Jean Delvare khali
Wed Sep 3 15:25:23 CEST 2008


Hi folks,

I am using ffmpeg to capture video streams from V4L2 devices (and it
works really well, so first of all I'd like to thank you a lot for the
excellent software!)

For testing purposes, I need to get ffmpeg to put the devices in RGB32
or BGR32 pixel format. Currently ffmpeg won't let me do that, because
it doesn't know how to map these pixel formats from the -pix_fmt value
to its V4L2 counterpart. The following patch makes it work:

---
 libavdevice/v4l2.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- ffmpeg.orig/libavdevice/v4l2.c	2008-09-02 21:35:20.000000000 +0200
+++ ffmpeg/libavdevice/v4l2.c	2008-09-03 08:48:46.000000000 +0200
@@ -106,12 +106,14 @@ static struct fmt_map fmt_conversion_tab
         .ff_fmt = PIX_FMT_RGB24,
         .v4l2_fmt = V4L2_PIX_FMT_RGB24,
     },
-    /*
     {
-        .ff_fmt = PIX_FMT_RGB32,
+        .ff_fmt = PIX_FMT_BGR32,
         .v4l2_fmt = V4L2_PIX_FMT_BGR32,
     },
-    */
+    {
+        .ff_fmt = PIX_FMT_RGB32,
+        .v4l2_fmt = V4L2_PIX_FMT_RGB32,
+    },
     {
         .ff_fmt = PIX_FMT_GRAY8,
         .v4l2_fmt = V4L2_PIX_FMT_GREY,

But I'm a bit skeptical because apparently the code was almost there
already but commented out. Was there a reason for that? Is there a
problem with these pixel formats which I missed? Or can we simply apply
the patch above and be done with it?

Thanks,
-- 
Jean Delvare




More information about the ffmpeg-devel mailing list