Trace an animated route over a map

En rédigeant mon précédent post, j’étais bien sûr que vous alliez trouver une solution.
Cela n’a pas failli, je n’ai qu’un seul mot:
Bravo @Elusien , félicitations :clap: :+1:
J’espère que les utilisateurs Mac pourront utiliser votre technique.

When I wrote my previous post, I was sure that you would find a solution.
It didn’t fail, I have only one word:
Bravo @Elusien , congratulations :clap: :+1:
I hope that Mac users will be able to use your technique.

It should be fine on a Mac, Inkscpe 1.0.2 is available on Windows, MacOS and Linux, as is OBS Studio and although Sharex is not supported there are several screen-capture programs that are.

This is why i like to develop apps using HTML/CSS&Javascript, since these are available on every platform.

J’ai essayé Inkscape, mais j’avoue que ce n’est pas évident quand on a l’habitude d’un autre logiciel de dessin vectoriel.
Actuellement, j’essaie de comprendre OBS, mais si ce n’est que pour enregistrer une capture d’écran, Quicktime sur OSX sait le faire.
C’est dommage que Shotcut ne puisse plus utiliser les fichiers .html suite à la suppression de WebVfx, mais j’ai encore un peu d’espoir quand je vois le code dans un fichier .mlt comprenant un filtre “Rich: Text”
Si ce n’est pas du html, cela lui ressemble.

I’ve tried Inkscape, but I must admit that it’s not easy when you’re used to another vectorial drawing program.
Currently, I’m trying to understand OBS, but if it’s only to save a screenshot, Quicktime on OSX can do it.
It’s a shame that Shotcut can’t use .html files anymore after the removal of WebVfx, but I’m still a little hopeful when I see the code in an .mlt file with a “Rich: Text” filter.
If it’s not html, it looks like it.

<property name="shotcut:filter">richText</property>
      <property name="html">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.SF NS Text'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Verdana'; font-size:54pt; font-weight:600; color:#ffffff;&quot;&gt;Texte écrit avec Text: Rich&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</property>
      <property name="shotcut:animIn">00:00:00.000</property>

Rich Text is HTML (4, not 5), but only a small subset provide by Qt, which Shotcut uses. The subset can be seen here: https://doc.qt.io/qt-5/richtext-html-subset.html.

tt has a subsystem called The Qt WebEngine module which provides a web browser engine that makes it easy to embed content from the World Wide Web into a Qt application.

Qt WebEngine provides C++ classes and QML types for rendering HTML, XHTML, and SVG documents, styled using Cascading Style Sheets (CSS) and scripted with JavaScript. It is based on the same Chromium software that is used to create browsers like Google Chrome and Microsoft Edge.

Unfortunately it appears that Dan would have to put an awful lot of effort into Shotcut to use it. However, if he did, it would effectively resurrect a (better?) version of WebVfx.

You don’t have to use Inkscape for your SVG files. You can use Adobe Illustrator, Affinity Designer, any other SVG editor, or in fact just a text editor to create the raw XML file. I’ve used Inkscape in the past and the fact that it is open-source is a big plus.

Here is another way, where not the path itself is animated but only a red dot as you travel along:

Its all done in Shotcut and Google Earth, but its quite a work with many keyframes for the animation of the dot.

Je commence à comprendre.
SVG c’est bon, Intaglio que j’utilise pour les dessins 2D le gère
Créer un mp4 à partir de l’écran c’est bon aussi.
Il me reste à comprendre votre code pour mettre en page tout cela (pt, px, mm, couleurs, délais etc…)
Avec cette technique on doit pouvoir faire des choses intéressantes…

I am beginning to understand.
SVG is good, Intaglio that I use for 2D drawings manages it.
Creating an mp4 from the screen is good too.
I still have to understand your code to layout all this (pt, px, mm, colors, delays etc…)
With this technique we should be able to do interesting things…

Diapo36

2 Likes

Well done in understanding the reasoning behind the code, which is “exposed” to the user in the set of parameters. I would have loved to have had this technique available for when my wife and I toured New Zealand. I may even go back and do one to add the report on my website.

I am currently working on a “helper” application, since there can be quite a bit of re-arranging of the paths (e.g. the order, the timing, the colour, the thickness etc.) if you have multiple ones. I should have something to try tomorrow.

Very useful application!

I downloaded your mlt file, even tried it with another map. It worked but only because the route I used was compatible - I have no idea how or why it worked. I understand the rectangle and I generally understand keyframes, but putting the two together is beyond me. Can you or someone else point me to a tutorial describing how to move the mask around as the video progresses?

Well done - it looks like it may have ben a Herculean effort to do this. I have been thinking for some time about doing something similar, but using the HTML canvas element and running the video and just clicking at points where I want the red dot to travel between (a mouse click is a whole lot easier than keyframing). I may knock up some “proof of concept” code once I’ve titdies up the projects I’m working on at present

2 Likes

1/ Ouvrez à nouveau le projet mlt avec Shotcut.
2/ Sélectionnez le clip “Carte.png” sur la timeline.
3/ Dans la fenêtre “Filtres” sélectionnez “Mask: Simple shape”
4/ Modifiez le Mode de “Ajouter” à “Soustraire”
Le rectangle du masque apparait en rouge. Mettez le clip en lecture pour observer le défilement du masque. Au début du clip le masque cache complètement l’itinéraire, puis il se déplace vers la droite jusqu’à le découvrir complètement. 2 images clés suffisent, une au début, l’autre à la fin. Pour ajuster la vitesse, il faut allonger ou diminuer la longueur du clip.

1/ Open again the mlt project with Shotcut.
2/ Select the clip “Carte.png” on the timeline.
3/ In the “Filters” window select “Mask: Simple shape”.
4/ Change the Mode from “Add” to “Subtract”.
The rectangle of the mask appears in red. Play the clip to observe the mask scrolling. At the beginning of the clip the mask hides the route completely, then it moves to the right until it is completely uncovered. 2 key frames are enough, one at the beginning, the other at the end. To adjust the speed, you have to lengthen or shorten the length of the clip.

Translated with www.DeepL.com/Translator (free version)

1 Like

@Namna you are brilliant, I tried your idea and it worked perfectly. It took me a while to find where in the screen was it as I couldn’t see the layer moving. Is there any way to add a border while working on it to identify it then take the border out?

Also, a quick question regarding the image. Not sure if I should open another topic. Imported image png and jpg, the quality degrades a lot. Very much pixelated. Any tricks for when importing images to shotcut?

Thank you so much for your hard work, amazing and simple.

Pour le premier point, c’est facile. Le temps du réglage, mettez le mode du masque sur “Soustraire” au lieu de “Ajouter”, vous voyez alors le cadre en rouge. (voir post ci-dessus)

Pour png vs jpg je ne suis pas spécialiste, mais je sais que png accepte la “couleur” transparente et pas jpg

Pour la pixellisation, si vous obtenez l’image par capture d’écran cela dépend de la résolution de l’écran et de la taille de l’image. Il existe certainement d’autres possibilités pour télécharger l’image, mais j’avoue que je ne me suis jamais penché sur la question.
D’autres membres vont bien certainement nous éclairer.

For the first point, it’s easy. During the adjustment, put the mode of the mask on “Subtract” instead of “Add”, you then see the frame in red. (see post above)

For png vs jpg I’m not a specialist, but I know that png accepts transparent “color” and not jpg.

For the pixelization, if you get the image by screen capture it depends on the screen resolution and the image size. There are certainly other possibilities to download the image, but I must admit that I never thought about it.
Other members will certainly enlighten us.

Edit
https://www.alvipixels.co.uk/blog/tutorials/high-resolution-google-map-300dpi/

2 Likes

Merci beaucoup!

Changing it to “subtract” makes it make sense. I did it with my sample. “Subtract” to make it easy to set up, then change it to “Add” for the final version.

I do aviation videos, so you can just imagine where this will work!

1 Like

Nouveau problème!
Avec mon matériel (pas très récent je l’avoue) je ne peux pas enregistrer l’écran en 1280x720 à plus de 8ips. Après import et conversion par Shotcut en 30 ips, le résultat final est très saccadé.

New problem!
With my hardware (not very recent I admit it) I can’t record the screen in 1280x720 at more than 8ips. After import and conversion by Shotcut in 30 fps, the final result is very jerky.

Is that using OBS as the screen recorder? I get 60fps for most of the animations I’ve tried. I am looking at a better way of animating the lines using SMIL (https://en.wikipedia.org/wiki/SVG_animation) instead of Javascript CSS transforms. That may speed the processing up a bit, but not 8 times as fast.

These are the OBS settings I use for Recording:

You could try “Indistinguishable Quality, Large File Size” to see if that helps as the encoder will have less processing to do.

1 Like

Merci encore @Elusien, il m’a fallu quelques heures pour comprendre OBS. J’ai perdu beaucoup de temps à chercher le bouton “Refresh” que vous montrez dans votre démo afin de faire démarrer l’animation.
Sur Mac il semble que ce soit légèrement différent.
Il faut:
1/ cliquer sur l’œil 1 pour effacer l’écran
2/ cliquer sur 2 "démarrer l’enregistrement
3/ cliquer sur l’œil 1 à nouveau pour démarrer la lecture.
Au final, j’obtiens bien une vidéo 1280x720 à 30 ips, problème réglé.

Thanks again @Elusien, it took me a few hours to understand OBS. I wasted a lot of time looking for the “Refresh” button that you show in your demo to start the animation.
On the Mac it seems to be slightly different.
It has to be:
1/ click on eye 1 to clear the screen
2/ click on 2 "start recording
3/ click on eye 1 again to start reading.

Capture d’écran 2021-01-20 à 14.39.53

In the end, I do get a 1280x720 video at 30 fps, problem solved.

Capture d’écran 2021-01-20 à 14.44.47

Glad to see you got it working. Just 1 more point though, under “Settings -> Advanced” there are a couple more options you can set. The process priority - you can set it to “High” and the option to “Enable Browser Source Hardware Acceleration”.