Convert to BGR

Hi NVIDIA developers.
I modified the deepstream_test_1 sample code. I want to change it to BGR format. So I can read it via OpenCV VideoCapture

The link of my pipeline elements before I modified:

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, width=640, height=480, framerate= 30/1 ! videoconvert ! nvvideoconvert ! "video/x-raw(memory:NVMM)" ! nvmux.sink_0 nvstreammux name=nvmux batch-size = 1 width=640 height=480 batched-push-timeout = 4000000 ! nvinfer config-file-path= /home/deepstream/Desktop/TA/config_infer_primary.txt ! nvvideoconvert ! nvdsosd  ! nvegltransform ! nveglglessink sync=FALSE

javascript:EditComment(5413850)

The link of my pipeline elements after I modified:

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, width=640, height=480, framerate= 30/1 ! videoconvert ! nvvideoconvert ! video/x-raw(memory:NVMM) ! nvmux.sink_0 nvstreammux name=nvmux batch-size = 1 width=640 height=480 batched-push-timeout = 4000000 ! nvinfer config-file-path= /home/deepstream/Desktop/TA/config_infer_primary.txt ! nvvideoconvert ! nvdsosd  ! nvegltransform ! nveglglessink sync=FALSE ! videoconvert ! nvvideoconvert ! video/x-raw, format=(string)BGRx ! videoconvert ! nvvideoconvert ! video/x-raw, format=(string)BGR ! appsink sync=FALSE

The link of my pipeline elements after I modified it seems didn’t work because the frame was freeze, but the last one before I modified works well.

Do you have any idea how to change it BGR format?
Thank you before

Hi,
Please try the following pipeline:

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, width=640, height=480, framerate= 30/1 ! videoconvert ! nvvideoconvert ! video/x-raw(memory:NVMM) ! nvmux.sink_0 nvstreammux name=nvmux batch-size = 1 width=640 height=480 batched-push-timeout = 4000000 ! nvinfer config-file-path= /home/deepstream/Desktop/TA/config_infer_primary.txt ! nvvideoconvert ! nvdsosd  ! video/x-raw(memory:NVMM),format=RGBA ! nvvideoconvert ! video/x-raw,format=RGBA ! videoconvert ! video/x-raw,format=BGR ! appsink

Hello DaneLLL
Thank you for your help. I have tried the pipeline that you have given to me.
Unfortunately, it can’t run very well.
The pipeline was stuck at ‘Creating LL OSD context new’ for a very long time.

I think it was because the ‘appsink’ can’t render the output?

is there any idea for a solution?

Hi,
You may use imshow() like this sample

Thankyou DaneLLL, I also have another question.

Do you have any idea how to convert this pipeline below into deepstream-python bindings? or maybe like create a python bindings code that can execute this pipeline and have the same results?

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, width=640, height=480, framerate= 30/1 ! videoconvert ! nvvideoconvert ! video/x-raw(memory:NVMM) ! nvmux.sink_0 nvstreammux name=nvmux batch-size = 1 width=640 height=480 batched-push-timeout = 4000000 ! nvinfer config-file-path= /home/deepstream/Desktop/TA/config_infer_primary.txt ! nvvideoconvert ! nvdsosd  ! video/x-raw(memory:NVMM),format=RGBA ! nvvideoconvert ! video/x-raw,format=RGBA ! videoconvert ! video/x-raw,format=BGR ! appsink

I have tried to create the python code, and I got some error, some elements could not be linked. Do you have any idea?

The error is like below

0:00:23.588592964 29276     0x10645540 WARN                 nvinfer gstnvinfer.cpp:1830:gst_nvinfer_output_loop:<inference> error: Internal data stream error.
0:00:23.597098552 29276     0x10645540 WARN                 nvinfer gstnvinfer.cpp:1830:gst_nvinfer_output_loop:<inference> error: streaming stopped, reason not-linked (-1)
Error received from element inference: gst-stream-error-quark: Internal data stream error. (1)
Debugging information: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(1830): gst_nvinfer_output_loop (): /GstPipeline:pipeline0/GstNvInfer:inference:
streaming stopped, reason not-linked (-1)

I also prepared the python code that I created.
coba.zip (2.26 KB)
coba_2.zip (2.87 KB)

Hi,
We have a deepstream-python sample:
https://github.com/NVIDIA-AI-IOT/deepstream_python_apps

Please take a look and see if it can help your case.