0
我目前正試圖通過UDP將視頻從RPi(運行Raspbian)流式傳輸到我的MBP Retina(Yosemite)。UDP上的視頻流
我有一個工作腳本來通過TCP流,但我明白,UDP是視頻流的更好的選擇,但我真的不知道該怎麼做。以下是我迄今爲止:
import socket, picamera, time
UDPsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
file = UDPsock.makefile('wb')
class videostream():
def __init__(self):
print "Camera Class Initialised"
def stream(self):
with picamera.PiCamera() as camera:
camera.resolution = (640, 480)
camera.start_preview()
time.sleep(2)
camera.start_recording(file, format='h264')
camera.wait_recording(60)
camera.stop_recording()
camera = videostream()
stream = camera.stream()
address = ("10.0.1.29", 8000)
UDPsock.sendto(stream, address)
它給我這個錯誤:就行了:camera.stop_recording()
。
我對Python的網絡相當陌生,所以原諒任何愚蠢的錯誤。