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

gpsgraphic filter is not showing anything, and background image is distorted #1050

Open
shadowfax65 opened this issue Nov 14, 2024 · 8 comments

Comments

@shadowfax65
Copy link

I am using Kdenlive and am trying to get the gpsgraphic filter to work. Kdenlive version 24.08.3 with MLT Framework version 7.27.0
My example .gpx file is a download from alltrails.com of a hike I did this year. There is no output whatsover. The only thing that sort of works is adding a background image, but it is distorted and only displayed in the bottom left-hand corner of the rectangle for the filter.

@ddennedy
Copy link
Member

The developer of this filter @dany123 primarily uses Shotcut and may not be able to debug it through Kdenlive. Not all GPX are the same as the X in XML means extensible, similar to how MLT XML differs between projects that use it. Can you provide a sample of the AllTrails GPX?

@shadowfax65
Copy link
Author

shadowfax65 commented Nov 14, 2024

Thanks for your quick reply. Much appreciated.

example_gpx.zip

@dany123
Copy link
Contributor

dany123 commented Nov 14, 2024

As Dan says I am only using Shotcut so I won't be able to help with Kdenlive specific stuff.

I can load and play your .gpx in Shotcut with no problem so there's no bug with this file in regards to the backend. The map should show up with no other changes other than loading the file. Shotcut's UI does do some helpful stuff but it should work even without them.

Here's the filter's properties in the saved .mlt. The only thing I changed was the filter's rectangle to have the map with the correct aspect ratio.

<filter id="filter0" out="00:19:26.967">
      <property name="resource">C:/Users/Daniel/Desktop/browser_downloads/Afternoon hike at Bondi Beach to Coogee Beach Walk.gpx</property>
      <property name="time_offset">1713748602</property>
      <property name="smoothing_value">5</property>
      <property name="speed_multiplier">1</property>
      <property name="graph_data_source">0</property>
      <property name="graph_type">0</property>
      <property name="trim_start_p">0</property>
      <property name="trim_end_p">100</property>
      <property name="crop_mode_h">0</property>
      <property name="crop_left_p">0</property>
      <property name="crop_right_p">100</property>
      <property name="crop_mode_v">0</property>
      <property name="crop_bot_p">0</property>
      <property name="crop_top_p">100</property>
      <property name="color_style">1</property>
      <property name="color.1">#00aaff</property>
      <property name="color.2">#ffffff</property>
      <property name="color.3">#ffff00</property>
      <property name="color.4">#ff8c00</property>
      <property name="color.5">#ff0000</property>
      <property name="show_now_dot">1</property>
      <property name="now_dot_color">#00ffffff</property>
      <property name="show_now_text">0</property>
      <property name="angle">0</property>
      <property name="thickness">5</property>
      <property name="rect">160 16 504 964 1</property>
      <property name="show_grid">0</property>
      <property name="legend_unit"></property>
      <property name="draw_individual_dots">0</property>
      <property name="map_coords_hint">-33.904377, 151.268395</property>
      <property name="bg_img_path">!</property>
      <property name="bg_scale_w">1</property>
      <property name="bg_opacity">1</property>
      <property name="mlt_service">gpsgraphic</property>
      <property name="majoroffset_sign">1</property>
      <property name="gps_start_text">2024-04-22 01:16:42</property>
      <property name="map_original_aspect_ratio">0.522711</property>
      <property name="video_start_text">1970-01-01 00:00:00</property>
      <property name="auto_gps_offset_start">1713748602</property>
      <property name="auto_gps_offset_now">1713748602</property>
    </filter>

Here's how I see it after load (ignore the GPS offset's huge value, it's relative to the Color background's "default" date):
image

@dany123
Copy link
Contributor

dany123 commented Nov 14, 2024

As for the background, there's a little helpful hint in the shotcut's UI as the center of the background img has to match the center of the GPX track so there's a button that shows this info, then you need to manually scale to match it on the image. But other than this, it should properly load without any issue as long as the frontend sends the right path to it.
! GPS file centre is: -33.904377, 151.268395

image

@shadowfax65
Copy link
Author

That was quick! Thank you very much! I will show this to the Kdenlive dev so that he can look into it more.

@dany123
Copy link
Contributor

dany123 commented Nov 14, 2024

I've had a look in kdenlive and as far as I can tell the UI was automatically generated based on the available fields in the filter's description and some important fields - mainly the one that should point to the GPS file is wrong/not usable for me (but also a field that controls the time offset should be present and editable).

I've manually edited the project file with notepad to add this line to the proper filter inside:
<property name="resource">C:/Users/Daniel/Desktop/browser_downloads/Afternoon hike at Bondi Beach to Coogee Beach Walk.gpx</property>

And something showed up but it was only 1px in size. But I could then drag it with the mouse and the map (gps track) showed up.

So the main functionality seems to be there, the issue is there's a lot of fields either missing, with bad defaults or not formatted/grouped nicely. This particular filter is quite complex so the automatic generation is just too basic for it to work.
If a kdenlive contributor wants to fix this I recommend to start by looking at how the filter looks in Shotcut and maybe ignore some of the more advanced fields like cropping and colors.

@shadowfax65
Copy link
Author

Thanks for looking into this even deeper, @dany123.

I am trying to fix the issue you described by creating the XML file Kdenlive uses for the UI.
gpsgraphic_xml.zip

I used the documentation available at https://www.mltframework.org/plugins/FilterGpsgraphic/. The only fields I did not include were the ones without a type specification but they appeared to be more informative. If you let me know how they are used I can include them.

With the XML file, Kdenlive displays a proper UI, lets the user select the .gpx and a background file via the normal file selection UI. The only thing that might be an issue is the rectangle which I implemented as animatedrect and which perhaps should be geometry.

@dany123
Copy link
Contributor

dany123 commented Nov 14, 2024

This looks way better and is functional. Just a few quick notes:

-make sure to set the defaults for trim end, crop right, crop bottom at 100 (so the first time the gpx file is loaded it will actually show a map)
-for the crop left/right/top/bottom I think the sliedr would be more useable with a smaller range (I'd say -200 to 200 would be enough for 99% of cases). But it's your choice, the values are valid anyway.
-the Crop top field is wrongly named Crop right
-I'd say the "show now dot" should be enabled by default (to show the current location)

As for the read-only fields you mention the only really important one would be: map_coords_hint. Without it it becomes a huge pain to put a correctly centered background image.
To properly show it you must wait for it to be populated after loading a gpx file, in Shotcut there's a button that when pressed it will show a text inside a textbox with the string: "GPS file centre is: -33.904377, 151.268395", you could probably do the same thing with a small questionmark button or something like that near the background buttons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants