v4l2loopback alternative ?

Hi I have been working on a project streaming raw video over udp using gstreamer-1.0. The plan is to stream the data to a v4l2 capture device ie /dev/video0,1,2… It is then to be accessed in opencv to analyse the feed. I’m new to the TX2 and I’m having issues creating a v4l2loopback device - module not found, is there another way this can be done on the TX2 ?

I should also note I have tried putting my gstreamer pipeline directly into cv2.VideoCapture though this seems to not be working either ( tried with the simplest pipeline I can and still not working )

Any suggestions would be greatly appreciated !

The functionality of v4l2loopback may not be good on r27.1. Please wait for next release and refer to
[url]https://devtalk.nvidia.com/default/topic/994012/jetson-tx1/passing-gst-launch-from-nvcamerasrc-to-v4l2sink/post/5090591/#5090591[/url]

After some playing about with opencv and upgrading it to 3.1 I now have pipelines working though its having some issues with the pipeline I am using.

pipe = "udpsrc multicast-iface=eth0 address=239.192.6.158 port=5004 caps='application/x-rtp, media=(string)video, clockrate=(int)90000, encoding-name=(string)RAW, sampling=(string)YCbCr-4:2:2, depth=(string)8, width=(string)1024, height=(string)768, framerate=(fraction)25/1, colorimetry=(string)BT601-5, payload=(int)96, ssrc=(uint)0000000000' ! rtpvrawdepay ! queue ! videoconvert ! video/x-raw,format=YUY2 ! appsink"

cap = cv2.VideoCapture(pipe)
GStreamer Plugin: Embedded video playback halted; module rtpvrawdepay0 reported: No RTP format was negotiated.
OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /home/ubuntu/opencv/modules/videoio/src/cap_gstreamer.cpp, line 818
Traceback (most recent call last):
  File "Desktop/kenny.py", line 8, in <module>
    cap = cv2.VideoCapture(pipe)
cv2.error: /home/ubuntu/opencv/modules/videoio/src/cap_gstreamer.cpp:818: error: (-2) GStreamer: unable to start pipeline
 in function cvCaptureFromCAM_GStreamer

is the error I’m getting. If i run the pipe in terminal or as a shell script it runs fine.

Hi,

Could you add ‘–gst-debug=3’ at the beginning of GStreamer command to print out more log?

Using

pipe = "--gst-debug=3 udpsrc multicast-iface=eth0 address=239.192.6.158 port=5004 ! 'application/x-rtp, media=(string)video, clockrate=(int)90000, encoding-name=(string)RAW, sampling=(string)YCbCr-4:2:2, depth=(string)8, width=(string)1024, height=(string)768, framerate=(fraction)25/1, colorimetry=(string)BT601-5, payload=(int)96, ssrc=(uint)0000000000' ! rtpvrawdepay ! queue ! videoconvert ! video/x-raw, format=(string)BGR ! appsink"

the only output I’m getting is

(python:24735): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed

I think the issue is to do with the caps on the incoming raw stream as I have been able to make it work by running

gst-launch-1.0 --gst-debug=4 udpsrc multicast-iface=eth0 address=239.192.7.158 port=5004 ! 'application/x-rtp, media=(string)video, clockrate=(int)90000, encoding-name=(string)RAW, sampling=(string)YCbCr-4:2:2, depth=(string)8, width=(string)1024, height=(string)769, framerate=(fraction)25/1, colorimetry=(string)BT601-5, payload=(int)96, ssrc=(uint)0000000000' ! rtpvrawdepay ! queue ! videoconvert ! video/x-raw,format=YUY2 ! jpegenc ! rtpjpegpay ! udpsink host=192.168.204.106 port=5001

in the command line and having

pipe = "udpsrc port=5001 ! application/x-rtp,encoding-name=JPEG,payload=26 ! queue ! rtpjpegdepay ! jpegdec ! videoconvert ! video/x-raw, format=(string)BGR ! appsink"

cap = cv2.VideoCapture(pipe)

as my cv input

nevermind I’ve got it working with

pipe = "udpsrc multicast-iface=eth0 address=239.192.1.32 port=5004 ! application/x-rtp, media=(string)video, clockrate=(int)90000, encoding-name=(string)RAW, sampling=(string)YCbCr-4:2:2, depth=(string)8, width=(string)640, height=(string)480, framerate=(fraction)25/1, colorimetry=(string)BT601-5, payload=(int)26, ssrc=(uint)0000000000 ! queue ! rtpvrawdepay ! videoconvert ! video/x-raw, format=(string)BGR ! appsink"

the issue was to do with the caps in my gstreamer pipeline.