Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YUV buffer has 2048 additional bytes on Mini 2 #151

Open
kripper opened this issue Apr 10, 2023 · 8 comments
Open

YUV buffer has 2048 additional bytes on Mini 2 #151

kripper opened this issue Apr 10, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@kripper
Copy link
Collaborator

kripper commented Apr 10, 2023

Describe the bug

RawVideoStreamer plugin sends 2048 additional bytes.

To fix, you should check the source code that grabs and sends the video frame and find out what format it is using, in order to decode it correctly on the receiving end (vision landing).

I have a "DJI Mini SE" and it works fine (without this issue).

@kripper kripper added the bug Something isn't working label Apr 10, 2023
@OMAHDrone
Copy link

OMAHDrone commented Apr 10, 2023

Thank you very much kripper
The problem is still there:
yuv_mat = yuv_mat.reshape((h + h // 2, w))
ValueError: cannot reshape array of size 1384448 into shape (1080,1280)

when I set the fps to 30 in the app, the received video almost never get updated. There is something wrong with video streaming of dji mini2.

@kripper
Copy link
Collaborator Author

kripper commented Apr 10, 2023

Maybe the rendering of the images using X11 is slow. The same happens here with the example.
I don't render the images on the screen using X11 on visual landing. It's just an example.
You could disable the code to render the images and only measure the time it takes to receive the images. Should be 15 fps, or 30 fps if you set it to 30 fps.

Regarding the format, I'm sorry but I cannot debug/fix it without having a Mini 2 for testing.
Should probably be very easy to fix though.

If it lags for more than some [ms], it could mean that it is waiting for more data to receive (network layer).

@OMAHDrone
Copy link

Thank you very much kripper
I have tested the app and code with dji air 2 and dji phantom 4. The high latency is still there (around 30 seconds at 30 fps). I noticed that dji phantom 4 needs the 2048 hack but dji air 2 doest not.
Thank you very much for your help
My pleasure

@kripper
Copy link
Collaborator Author

kripper commented Apr 11, 2023

If you don't consume the frames at time (becasue of #151 (comment)) whey will stack up and latency will increase until the phone crashes or disconnects.

@kripper
Copy link
Collaborator Author

kripper commented Apr 11, 2023

I did some tests with my VisionLanding lab and got less than 1 [s] total latency (action + perception).

@kripper
Copy link
Collaborator Author

kripper commented Apr 11, 2023

Please create a different issue for latency.

@Ugzuzg
Copy link
Contributor

Ugzuzg commented Jul 2, 2023

Do you still need help with this? I have a Mini 2 and can run thet test.

@kripper
Copy link
Collaborator Author

kripper commented Jul 2, 2023

More than testing, you could try fixing the mini 2 video compatibility problem by checking this repo:
https://github.com/m4xw/rosettadrone_mini2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants