Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
377 views
in Technique[技术] by (71.8m points)

How to connect via udp in opencv python?

I'm having trouble connecting via udp gstreamer python. When I enter the command gst-launch-1.0 -v udpsrc port=3000 buffer-size=13000000 ! h264parse ! avdec_h264 ! d3dvideosink sync=false. Everything works, but when I try to connect via python "Could not open video"

import sys
import cv2

cap = cv2.VideoCapture("udpsrc port=3000 ! application/x-rtp,payload=96,encoding-name=H264 ! rtpjitterbuffer mode=1 ! rtph264depay ! h264parse ! decodebin ! videoconvert ! appsink", cv2.CAP_GSTREAMER);

if not cap.isOpened():
    print("Could not open video")
    sys.exit()

# Read first frame.
ok, frame = cap.read()
if not ok:
    print('Cannot read video file')
    sys.exit()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...