我目前有一个Python OpenCV程序(由朋友编写),可以从网络摄像头捕获并通过UDP流。我需要改为通过RTSP发送视频流,以便能够在Android上播放。我发现了很多关于如何在Python中捕获RTSP的问题/答案,但是却没有关于如何通过Python发送的问题。我对所有这些都不是很熟悉,但是一直在尝试阅读,我想念的是什么?
这是UDP的当前代码:
cap.set(3, self.width)
cap.set(4, self.height)
while cap.isOpened():
ret, frame = cap.read()
if ret:
self.videoSockTwo.sendto(self.code, (str(self.iplineedit.text()), 8005))
data = frame.tostring()
for i in range(0, len(data), self.buf):
self.videoSockTwo.sendto(data[i:i + self.buf], (str(self.iplineedit.text()), 8005))
else:
break```