Hello Tello Pilot!
Join our DJI Tello community & remove this banner.
Sign up

[SOLVED} Can't get video over UDP (on Linux Mint 21.3)?

sh3p

Member
Joined
Feb 8, 2024
Messages
5
Reaction score
0
I am trying to get video from my Tello EDU drone. It works in the app on my phone however I cannot seem to get it working on my laptop.

The UDP packets seem to be arriving since I can see UDP packets arriving on port 11111 in wireshark/netcat.

1707370218167.png

But when I try using the following python script from the DJITelloPy library it throws an error here.
Python:
import time
from threading import Thread

import cv2
from djitellopy import Tello

tello = Tello()

tello.connect()

keepRecording = True
tello.streamon()
frame_read = tello.get_frame_read()


def videoRecorder():
    # create a VideoWrite object, recoring to ./video.avi
    # 创建一个VideoWrite对象,存储画面至./video.avi
    height, width, _ = frame_read.frame.shape
    video = cv2.VideoWriter(
        "video.avi", cv2.VideoWriter_fourcc(*"XVID"), 30, (width, height)
    )

    while keepRecording:
        video.write(frame_read.frame)
        time.sleep(1 / 30)

    video.release()


# we need to run the recorder in a seperate thread, otherwise blocking options
#  would prevent frames from getting added to the video
# 我们需要在另一个线程中记录画面视频文件,否则其他的阻塞操作会阻止画面记录
recorder = Thread(target=videoRecorder)
recorder.start()

tello.takeoff()
tello.move_up(100)
tello.rotate_counter_clockwise(360)
tello.land()

keepRecording = False
recorder.join()

When I looked into why it was throwing the error (due to the av.open() line above) I found that the av library is a wrapper for ffmpeg. So I tried to check if I could get video directly with ffmpeg with
Bash:
ffmpeg -i udp://0.0.0.0:11111 out.mp4
. I then connected to the drone and did started the video with streamon() then waited three seconds then streamoff() but there was no output file. When I stopped ffmpeg with Ctrl-C I get "Error opening input: Immediate exit requested Error opening input file udp://0.0.0.0:11111" which seems to line up with the error from the python script above which was av.ExitError. So I think it may be an issue with ffmpeg. I am running Linux Mint 21.3 (which is based on Ubuntu 22.04) on a Lenovo Thinkpad T14s gen 3.

I have tried

- Upgrading the firmware on the drone with the Tello app so it can now use SDK 3.0
- Switching the UDP port to 12345
- Updating ffmpeg to version 6.1-1build2~22.04
- using VLC player to view the stream (does not work since I think it is using ffmpeg under the hood)
- downgrading the djitellopy to <2.5 when it used opencv instead of the av library (I get a different error related to ffmpeg from the opencv code)
- using ffmpeg to read a local mp4 file and output a copy of it (works)

I think it is likely it's some issue with ffmpeg on my laptop or how it is interpreting the udp packets but I can't figure it out for the life of me. Anyone else had this issue or any ideas on how to fix or do further testing?

UPDATE: Also tried sending video from a file over udp on localhost and then from another laptop on a different network both using ffmpeg and both of which did work but also tried with the same devices on the tello network and it did not work. I could not even see the packets in netcat here...

UPDATE 2: Was finally able to try on a different device and it worked. I also tried booting Linux Mint 21.3 (the OS I was using) from a USB on the not working laptop and installing only the necessary software to test with ffmpeg. It worked so I guess that means that probably it is an issue with some software I installed. My guess is it is related to pipewire/wireplumber which I had installed but I don't have any testing to confirm this.
 
Last edited:
I am trying to get video from my Tello EDU drone. It works in the app on my phone however I cannot seem to get it working on my laptop.

The UDP packets seem to be arriving since I can see UDP packets arriving on port 11111 in wireshark/netcat.

View attachment 7195

But when I try using the following python script from the DJITelloPy library it throws an error here.
Python:
import time
from threading import Thread

import cv2
from djitellopy import Tello

tello = Tello()

tello.connect()

keepRecording = True
tello.streamon()
frame_read = tello.get_frame_read()


def videoRecorder():
    # create a VideoWrite object, recoring to ./video.avi
    # 创建一个VideoWrite对象,存储画面至./video.avi
    height, width, _ = frame_read.frame.shape
    video = cv2.VideoWriter(
        "video.avi", cv2.VideoWriter_fourcc(*"XVID"), 30, (width, height)
    )

    while keepRecording:
        video.write(frame_read.frame)
        time.sleep(1 / 30)

    video.release()


# we need to run the recorder in a seperate thread, otherwise blocking options
#  would prevent frames from getting added to the video
# 我们需要在另一个线程中记录画面视频文件,否则其他的阻塞操作会阻止画面记录
recorder = Thread(target=videoRecorder)
recorder.start()

tello.takeoff()
tello.move_up(100)
tello.rotate_counter_clockwise(360)
tello.land()

keepRecording = False
recorder.join()

When I looked into why it was throwing the error (due to the av.open() line above) I found that the av library is a wrapper for ffmpeg. So I tried to check if I could get video directly with ffmpeg with
Bash:
ffmpeg -i udp://0.0.0.0:11111 out.mp4
. I then connected to the drone and did started the video with streamon() then waited three seconds then streamoff() but there was no output file. When I stopped ffmpeg with Ctrl-C I get "Error opening input: Immediate exit requested Error opening input file udp://0.0.0.0:11111" which seems to line up with the error from the python script above which was av.ExitError. So I think it may be an issue with ffmpeg. I am running Linux Mint 21.3 (which is based on Ubuntu 22.04) on a Lenovo Thinkpad T14s gen 3.

I have tried

- Upgrading the firmware on the drone with the Tello app so it can now use SDK 3.0
- Switching the UDP port to 12345
- Updating ffmpeg to version 6.1-1build2~22.04
- using VLC player to view the stream (does not work since I think it is using ffmpeg under the hood)
- downgrading the djitellopy to <2.5 when it used opencv instead of the av library (I get a different error related to ffmpeg from the opencv code)
- using ffmpeg to read a local mp4 file and output a copy of it (works)

I think it is likely it's some issue with ffmpeg on my laptop or how it is interpreting the udp packets but I can't figure it out for the life of me. Anyone else had this issue or any ideas on how to fix or do further testing?

UPDATE: Also tried sending video from a file over udp on localhost and then from another laptop on a different network both using ffmpeg and both of which did work but also tried with the same devices on the tello network and it did not work. I could not even see the packets in netcat here...

UPDATE 2: Was finally able to try on a different device and it worked. I also tried booting Linux Mint 21.3 (the OS I was using) from a USB on the not working laptop and installing only the necessary software to test with ffmpeg. It worked so I guess that means that probably it is an issue with some software I installed. My guess is it is related to pipewire/wireplumber which I had installed but I don't have any testing to confirm this.
i have same problem, how do you solve problem ?
 

Members online

No members online now.

Forum statistics

Threads
5,699
Messages
39,965
Members
17,059
Latest member
erde