How to changing color space?

Hi all~

I tried to changing color space on gstreamer but not works

Some of device sending unusual stream…

that is sending RGB24 but i cant change to video stream setting .
so i tried to makes changing color space liks BGR → RGB

like this.

gst-launch-1.0 v4l2src device=/dev/video0 ! “video/x-raw, format=BGRA , width=1920, height=720, framerate=30/1” ! ! videoconvert ! clockoverlay ! xvimagesink

i tried BGRA → ARGB is not changed.

gst-launch-1.0 v4l2src device=/dev/video0 ! “video/x-raw, format=BGRA , width=1920, height=720, framerate=30/1” ! queue ! videoconvert ! “video/x-raw, format=ARGB” ! clockoverlay ! xvimagesink

i want to change to color space but color is nothing changed.
how can i changing color space?

You would need to set source format correctly. If the source is RGBA but set to BGRA in gstreamer, it is treated as BGRA for all conversion.

Another possible solution is to set prob function in source pad of v4l2src plugin, and overwrite the buffer in correct order.

As said by DaneLLL, the root cause is that your camera driver reports incorrect format with respect to sent frames. It would be better to fix that if possible.

If not possible, you may try this as workaround (be aware that it may lead to significant cpu overhead). You would change the gstreamer caps by using one pipeline getting your camera frames and send these to shmsink. Then another pipeline reading these from shrmsrc as expected format:
In one terminal, run:

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, format=BGRA , width=1920, height=720, framerate=30/1 ! identity drop-allocation=1 ! shmsink socket-path=/tmp/myTest.sock

In another terminal:

gst-launch-1.0 shmsrc socket-path=/tmp/myTest.sock ! video/x-raw, format=RGBA , width=1920, height=720, framerate=30/1 ! videoconvert ! xvimagesink

Be aware that the named socket may not be cleared if the first pipeline exits while the second one is still connected, so after stopping both, be sure to delete the remaining socket before retrying:

rm -f /tmp/tmp/myTest.sock