我正在尝试使用 DJI Tello 无人机进行实时视频流,最初我能够在 Windows 机器上运行相同的代码,但是当我在 Ubuntu 22 上尝试时,我无法获得任何用于实时流媒体的 opencv 弹出窗口。
这是代码的输出:
base) nirbhay@nirbhay:~/Desktop/Tello_code$ python LiveStream.py
[INFO] tello.py - 129 - Tello instance was initialized. Host: '192.168.10.1'. Port: '8889'.
[INFO] tello.py - 438 - Send command: 'command'
[INFO] tello.py - 462 - Response command: 'ok'
Drone Battery Percentage:
100
Live Stream Address:
udp://@0.0.0.0:11111
[INFO] tello.py - 438 - Send command: 'streamon'
[INFO] tello.py - 462 - Response streamon: 'ok'
non-existing PPS 0 referenced
non-existing PPS 0 referenced
decode_slice_header error
no frame!
non-existing PPS 0 referenced
non-existing PPS 0 referenced
decode_slice_header error
no frame!
non-existing PPS 0 referenced
non-existing PPS 0 referenced
decode_slice_header error
no frame!
non-existing PPS 0 referenced
non-existing PPS 0 referenced
decode_slice_header error
no frame!
non-existing PPS 0 referenced
non-existing PPS 0 referenced
decode_slice_header error
no frame!
non-existing PPS 0 referenced
non-existing PPS 0 referenced
decode_slice_header error
no frame!
error while decoding MB 22 30, bytestream 127
error while decoding MB 58 37, bytestream -6
这是代码:
from djitellopy import tello
import cv2
import time
#import libh264decoder
drone = tello.Tello()
drone.connect()
print("Drone Battery Percentage:")
print(drone.get_battery())
print("Live Stream Address:")
print(drone.get_udp_video_address())
drone.streamon()
while True:
img=drone.get_frame_read().frame
#print("image:",img)
img=cv2.resize(img,(660,420))
cv2.imshow("Image",img)
#time.sleep(3)
cv2.waitKey(1)
#time.sleep(1)
python包列表和版本:
djitellopy 2.5.0
opencv-python 4.9.0.80
操作系统
Ubuntu 22.04.3 LTS
有同样的问题吗?你找到解决办法了吗?