Hello,
Knowing that it is an old topic and was discussed a long time ago. But, I did a few hours of searching but with no luck finding the right discussion.
I am trying not to use djitellopy but to capture the video stream by using the cv2.videocapture command. However, there is latency for the video even though I set the buffer to 1. The funny thing I found is that for the first ~50 frames, this command was done within 0.002 seconds, bu it became 0.035 second or more. Could you please give me some hints?
Part of the codes
socket.sendto ('command'.encode (' utf-8 '), tello_address)
socket.sendto ('streamon'.encode (' utf-8 '), tello_address)
print ("Start streaming")
capture = cv2.VideoCapture ('udp://0.0.0.0:11111', cv2.CAP_FFMPEG)
capture.set(cv2.CAP_PROP_BUFFERSIZE, 1)
if not capture.isOpened():
capture.open('udp://0.0.0.0:11111')
while True:
start = time.time()
ret, frame =capture.read()
done = time.time() - start
print(done)
if ret:
cv2.imshow('frame', frame)
if cv2.waitKey (1) & 0xFF == ord ('q'):
break
Thank you very much!
Regards,
YOLO
Knowing that it is an old topic and was discussed a long time ago. But, I did a few hours of searching but with no luck finding the right discussion.
I am trying not to use djitellopy but to capture the video stream by using the cv2.videocapture command. However, there is latency for the video even though I set the buffer to 1. The funny thing I found is that for the first ~50 frames, this command was done within 0.002 seconds, bu it became 0.035 second or more. Could you please give me some hints?
Part of the codes
socket.sendto ('command'.encode (' utf-8 '), tello_address)
socket.sendto ('streamon'.encode (' utf-8 '), tello_address)
print ("Start streaming")
capture = cv2.VideoCapture ('udp://0.0.0.0:11111', cv2.CAP_FFMPEG)
capture.set(cv2.CAP_PROP_BUFFERSIZE, 1)
if not capture.isOpened():
capture.open('udp://0.0.0.0:11111')
while True:
start = time.time()
ret, frame =capture.read()
done = time.time() - start
print(done)
if ret:
cv2.imshow('frame', frame)
if cv2.waitKey (1) & 0xFF == ord ('q'):
break
Thank you very much!
Regards,
YOLO