mavlink / qgroundcontrol

Cross-platform ground control station for drones (Android, iOS, Mac OS, Linux, Windows)
http://qgroundcontrol.io
3.33k stars 3.64k forks source link

Use correct aspectRation for gst video #12032

Closed gillamkid closed 4 weeks ago

gillamkid commented 4 weeks ago

Fixes #11896

Description

The wrong ratio was being used for GST video (if the video stream aspect ratio did not match the operator provided aspect ratio). This made so thinngs like grid lines weren't properly placed and also made track point setting inaccurate.

Sponsor

This contribution was sponsored by Firestorm 654d4f9476ff2a38f37e9ab9_firestorm-homepage-share-img-2

Before

Note how the grid lines are not accurately placed and the video does not fill the width of the screen even though it is in "Fit Width" mode. bad-ratio I generated the sample image using the following command

gst-launch-1.0 videotestsrc ! openh264enc ! rtph264pay config-interval=10 pt=96 ! udpsink host=127.0.0.1 port=5600

My QGC settings were "Fit Width" in video settings and I made video streaming enabled for h264 port 5600

After

Note how the grid lines are accurately placed and the video does fill the width of the screen as expected when in "Fit Width" mode. good-ratio

HTRamsey commented 4 weeks ago

Nice, I don't know if you're interested in helping look into it, but that entire file actually needs to be reworked, and really most of the video QML stuff. The loader actually doesn't work as expected (videoDisabled isn't even used, and should control the enabled property), and the thermal video should be in a loader. Also, ideally this would be combined with the UVC file somehow and just have the video source or video background changed

gillamkid commented 4 weeks ago

I can't commit to reworking the entire file. I did have the same idea about combining with the UVC file, so it's nice to know that is a welcomed change if I ever decide to take a stab at it.

For now I mostly just make fixes that cause pains when flying the vehicle my company is developing. The messed up GST aspect ratio was giving us grief when setting tracks.