Discussion:
Details about gstreamer RGBx format
maxilase
2015-03-18 15:16:48 UTC
Permalink
Hello Gstreamer !

I have run into some issue about getting a videostream into my application.
I am senting an videostream via rtphpay to the server and I am getting it
for a client via rtspsrc.
The video stream is fine except one thing : the Red and Blue colors are
inverted.

My application is based on Qt and is taking the video stream frame by frame
with a QImage formatted
<< QImage
<http://qt-project.org/doc/qt-4.8-snapshot/qimage.html#Format-enum>
::Format_RGB32 --> The image is stored using a 32-bit RGB format
(0xffRRGGBB)>>
(You would have noticed that it is actually an ARGB format with the Alpha
channel set to OxFF).

My reception pipeline is like this :
rtspsrc location=RTSPURL ! rtph26depay ! avdec_h264 ! videoconvert ! appsink
name=sink sync=false caps="video/x-raw,format=RGBx"

Which is working with inverted Red and Green. Now the fun part is that when
i change the format to BGRx. It work...
So my question is "How does Gstreamer handle the RGBx format ?" is it
inverted ? I alredy checked those sites : here
<http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-types-definitions.html>
and here <http://www.fourcc.org/rgb.php> . And I didn't found helpful
informations.

Any idea ?



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Details-about-gstreamer-RGBx-format-tp4671194.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
Sebastian Dröge
2015-03-24 10:33:52 UTC
Permalink
Post by maxilase
Hello Gstreamer !
I have run into some issue about getting a videostream into my application.
I am senting an videostream via rtphpay to the server and I am getting it
for a client via rtspsrc.
The video stream is fine except one thing : the Red and Blue colors are
inverted.
My application is based on Qt and is taking the video stream frame by frame
with a QImage formatted
<< QImage
<http://qt-project.org/doc/qt-4.8-snapshot/qimage.html#Format-enum>
::Format_RGB32 --> The image is stored using a 32-bit RGB format
(0xffRRGGBB)>>
(You would have noticed that it is actually an ARGB format with the Alpha
channel set to OxFF).
rtspsrc location=RTSPURL ! rtph26depay ! avdec_h264 ! videoconvert ! appsink
name=sink sync=false caps="video/x-raw,format=RGBx"
Which is working with inverted Red and Green. Now the fun part is that when
i change the format to BGRx. It work...
So my question is "How does Gstreamer handle the RGBx format ?" is it
inverted ?
If you read RGBx in GStreamer, that means that the first byte will be
the R component, the second the G, etc. If libraries like Qt or Cairo
say RGB they usually mean 0xffRRGGBB, which means that if you're on a
little endian architecture that the first byte will be the B component
(in GStreamer terms this would be BGRx).

In GStreamer the formats are defined by their memory order, in libraries
like Qt by terms of the most/least significant byte when storing the
pixel in an appropriately sized integer.
--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
Loading...