【发布时间】:2021-07-11 01:05:04
【问题描述】:
我目前在使用 OpenCV 的 python 上遇到了高视频流延迟问题。我已经设置了视频流,但是当使用 pygame 手动控制无人机时,延迟(大约 800 毫秒)很难处理。我知道这不是无人机,因为当我使用 Tello 应用程序时,延迟并不明显。有人对使用 Tello 无人机进行视频流传输有任何经验吗?
【问题讨论】:
标签: python video-streaming latency drone
我目前在使用 OpenCV 的 python 上遇到了高视频流延迟问题。我已经设置了视频流,但是当使用 pygame 手动控制无人机时,延迟(大约 800 毫秒)很难处理。我知道这不是无人机,因为当我使用 Tello 应用程序时,延迟并不明显。有人对使用 Tello 无人机进行视频流传输有任何经验吗?
【问题讨论】:
标签: python video-streaming latency drone
我在 Windows 10 中使用了以下代码,可以毫无延迟地显示来自无人机的视频流。但是,请注意,这使用了 Tellopy 库。
def video_thread():
global drone
global run_video_thread
global av
print('START Video thread')
drone.start_video()
try:
container = av.open(drone.get_video_stream())
frame_count = 0
while True:
for frame in container.decode(video=0):
frame_count = frame_count + 1
image = cv2.cvtColor(numpy.array(frame.to_image()), cv2.COLOR_RGB2BGR)
cv2.imshow('Original', image)
cv2.waitKey(1)
cv2.destroyWindow('Original')
except KeyboardInterrupt as e:
print('KEYBOARD INTERRUPT Video thread ' + e)
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
print('EXCEPTION Video thread ' + e)
def main():
global drone
drone = tellopy.Tello()
drone.connect()
try:
threading.Thread(target=video_thread).start()
except e:
print(str(e))
finally:
print('Shutting down connection to drone...')
drone.quit()
exit(1)
if __name__ == '__main__':
main()
【讨论】: