UDP source to appsink example

I’m streaming with:

gst-launch-1.0 v4l2src device=/dev/video0 ! ‘video/x-raw,format=UYVY,width=640,height=480’ ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=NV12’ ! nvv4l2h264enc maxperf-enable=1 insert-sps-pps=1 ! h264parse ! rtph264pay ! udpsink host=192.xxx.xx.xx port=5000 sync=false

and able to receive with:

gst-launch-1.0 udpsrc port=5000 ! ‘application/x-rtp,encoding-name=H264,payload=96’ ! rtph264depay ! h264parse ! nvv4l2decoder enable-max-performance=1 ! nvoverlaysink

and capture inside a Python code,

capture = cv2.VideoCapture(“udpsrc port=5000 ! application/x-rtp, encoding-name=H264, payload=96 ! rtph264depay ! h264parse ! nvv4l2decoder enable-max-performance=1 ! autovideoconvert ! video/x-raw, format=BGR ! appsink”, cv2.CAP_GSTREAMER)

starts, says:

Opening in BLOCKING MODE

but does not shows anything.

For testing my Python code:

capture = cv2.VideoCapture(“v4l2src device=/dev/video1 ! video/x-raw, width=640, height=480,format=UYVY ! videoconvert ! video/x-raw, format=BGR ! appsink”, cv2.CAP_GSTREAMER)

works.

Could you point me a working example of UDP source to openCV appsink please

Hi,
You may replace autovideoconvert with

nvvidconv ! video/x-raw,format=BGRx ! videoconvert

and try again.

1 Like

@DaneLLL
It works
Thanks you