GNOME Bugzilla – Bug 602834
[ffmpegcolorspace] does un-necessary conversion from RGB to ARGB
Last modified: 2009-11-25 15:20:54 UTC
It looks like ffmpegcolorspace converts from RGB to ARGB even if downstream elements support both. This example shows it: gst-launch -v videotestsrc num-buffers=1 ! "video/x-raw-yuv" ! ffmpegcolorspace ! "video/x-raw-rgb,bpp=(int)32,depth=(int)24,endianness=(int)4321,width=(int)320,height=(int)240,framerate=(fraction)30/1;video/x-raw-rgb,bpp=(int)32,depth=(int)24,endianness=(int)4321,width=(int)320,height=(int)240,framerate=(fraction)30/1,red_mask=(int)65280,green_mask=(int)16711680,blue_mask=(int)-16777216,alpha_mask=(int)255" ! fakesink fakesink gets these caps: caps = video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, width=(int)320, height=(int)240, framerate=(fraction)30/1, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216
In the logs: 0:00:00.197728269 3328 0x9ec4518 DEBUG ffmpegcolorspace gstffmpegcodecmap.c:432:gst_ffmpeg_pixfmt_to_caps: caps for pix_fmt=4: video/x-raw-yuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], format=(fourcc)YUY2 0:00:00.198053939 3328 0x9ec4518 DEBUG ffmpegcolorspace gstffmpegcodecmap.c:432:gst_ffmpeg_pixfmt_to_caps: caps for pix_fmt=13: video/x-raw-rgb, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], bpp=(int)32, depth=(int)24, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, endianness=(int)4321 0:00:00.199234187 3328 0x9ec4518 DEBUG ffmpegcolorspace gstffmpegcolorspace.c:153:gst_ffmpegcsp_transform_caps:<ffmpegcsp0> transformed video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1 into video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1; video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)30/1; video/x-raw-gray, width=(int)320, height=(int)240, framerate=(fraction)30/1; video/x-raw-rgb, width=(int)320, height=(int)240, framerate=(fraction)30/1 0:00:00.199541419 3328 0x9ec4518 DEBUG ffmpegcolorspace gstffmpegcolorspace.c:246:gst_ffmpegcsp_set_caps: reconfigured 4 13 0:00:00.199638777 3328 0x9ec4518 DEBUG ffmpegcolorspace gstffmpegcolorspace.c:441:gst_ffmpegcsp_transform: from 4 -> to 13 0:00:00.201696930 3328 0x9ec4518 DEBUG ffmpegcolorspace gstffmpegcolorspace.c:468:gst_ffmpegcsp_transform: from 4 -> to 13 done
Sorry description and logs are wrong :P Pipeline is: GST_DEBUG=ffmpegcolorspace:4 gst-launch -v videotestsrc num-buffers=1 ! "video/x-raw-yuv" ! ffmpegcolorspace ! "video/x-raw-rgb,bpp=(int)32,depth=(int)24,endianness=(int)4321,width=(int)320,height=(int)240,framerate=(fraction)30/1,red_mask=(int)65280,green_mask=(int)16711680,blue_mask=(int)-16777216;video/x-raw-rgb,bpp=(int)32,depth=(int)32,endianness=(int)4321,width=(int)320,height=(int)240,framerate=(fraction)30/1,red_mask=(int)65280,green_mask=(int)16711680,blue_mask=(int)-16777216,alpha_mask=(int)255" ! fakesink and in the logs: fakesink0.GstPad:sink: caps = video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, width=(int)320, height=(int)240, framerate=(fraction)30/1, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255 0:00:00.159230009 29557 0x8fa3600 DEBUG ffmpegcolorspace gstffmpegcolorspace.c:441:gst_ffmpegcsp_transform: from 4 -> to 9 0:00:00.161144149 29557 0x8fa3600 DEBUG ffmpegcolorspace gstffmpegcolorspace.c:468:gst_ffmpegcsp_transform: from 4 -> to 9 done
Created attachment 148449 [details] [review] ffmpegcolorspace: Prefer transforming alpha formats to alpha formats and the other way around Fixes bug #602834 and #350748.
commit 1fe9f496911f3139c977e559eb29f60066278165 Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Wed Nov 25 16:17:13 2009 +0100 ffmpegcolorspace: Prefer transforming alpha formats to alpha formats and the Fixes bug #602834 and #350748.