Updated: I have a rpi compute module which successfully gstreams video, using the cmd line. Jetson machine receives it using cmd line too (but not a python script!)
On the RPi:
raspivid -fps 15 -b 400000 -t 0 -n -w 640 -h 480 -o - | tee | gst-launch-1.0
-v fdsrc ! h264parse ! rtph264pay config-interval=1 ! udpsink
host=192.168.1.111 port=5000
On the Jetson TX2 cmd line I run:
gst-launch-1.0 udpsrc port=5000 ! 'application/x-rtp, encoding-name=H264,
payload=96' ! rtph264depay ! h264parse ! avdec_h264 ! xvimagesink sync=false
From this I can see the gstreamer video coming up on the Jetson desktop (ubuntu) so it works!
I created a python script to open a cv2.cap and print statements to let me know how things are going, my real goal is to do something with the frames (cv2 processing).
import cv2
import numpy as np
print "start"
cap = cv2.VideoCapture("udpsrc port=5000 ! 'application/x-rtp, encoding-
name=H264, payload=96' ! rtph264depay ! h264parse ! avdec_h264 ! ! appsink",
cv2.CAP_GSTREAMER)
print "check1"
while(cap.isOpened()):
print "check2"
frame = cap.read()
cap.release()
cv2.destroyAllWindows()
What I get out is now:
(python:3608): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion
'gst_uri_is_valid (uri)' failed
OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file
/home/nvidia/opencv/modules/videoio/src/cap_gstreamer.cpp, line 881
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised
OpenCV exception:
/home/nvidia/opencv/modules/videoio/src/cap_gstreamer.cpp:881: error: (-2)
GStreamer: unable to start pipeline
in function cvCaptureFromCAM_GStreamer
I did a test with a local file and it works (prints "loop" constantly):
cap = cv2.VideoCapture("filesrc location=/home/nvidia/comp/grill-mjpeg.mov !
appsink", cv2.CAP_GSTREAMER)
The only differences here is the UDP vs local file, and the type of encoding? But the encoding options worked in the cmd line. Any ideas to get this script working?
Any help would be greatly appreciated!