Stream data with gstreamer and recieve with opencv python

hi everybody
i just want to send live feed of csi camera (imx 477 12mp) from jetson nano to an other linux system .
for preventing fps dropping because of converting image format that could readed by jetson nano and othe things that make process slower i decide to use rtp or rtsp to send data from jetson nano to other system .
i can send camera feed from jetson and recieve in other system only in terminal .
in jetson i use nvarguscamera as source and in other system i’m using udpsrc as src in command and it will work fine .

but when i wanna read data in linux system (not jetson nano) i dont know who to use gstreamer elements and which source and sink should be used.
for practice i use udpsrc as source and appsink ass sink element and this dosent work (sample code below)

gst_line2= ‘udpsrc host=10.42.0.1 port=5000 caps = “application/x-rtp, media=(string)video, clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96” ! rtph264depay ! decodebin ! videoconvert ! appsink’
video_capture = cv2.VideoCapture(gst_line2, cv2.CAP_GSTREAMER)

can you tell me which elements i should use and how i gonna use them??

Your topic was posted in the Orin Nano category. I am moving this to the Jetson Nano category for visibility.

Hi,
It sounds like OpenCV in the linux system (not jetson nano) does not enable gstreamer. You may try to run this:
Gstreamer TCPserversink 2-3 seconds latency - #5 by DaneLLL

If this works on the linux system:

$ gst-launch-1.0 udpsrc port=5000 ! 'application/x-rtp,encoding-name=H264,payload=96' ! rtph264depay ! avdec_h264 ! xvimagesink sync=0

You can then try

gst_line2= 'udpsrc port=5000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! avdec_h264 ! videoconvert ! video/x-raw,format=BGR ! appsink '

hi daneLLL
the first command will work in terminal very well
but second line (gst_line2= …) not work in python
and about gstreamer in python i think it should be enabaled because it work when i wanna take image straight from camera in python .

do you have another solution to solve this problem ??

Having gstreamer working in python may not be enough…the question is does your opencv version running from python support gstreamer.
What gives from your pyhton:

import cv2
print(cv2.getBuildInformation())

Check for GStreamer SUPPORT : should be YES.

If ok, you may tell more about how you’re using it.

You may try:

cap = cv2.VideoCapture('udpsrc port=5000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtpjitterbuffer latency=500 ! rtph264depay ! avdec_h264 ! videoconvert ! video/x-raw,format=BGR ! appsink drop=1', cv2.CAP_GSTREAMER)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.