Thursday, 7 May 2015

GPX hyperlapse

In the last post I described how to create a virtual hiking tour (, and then I wondered if I could do something similar, but at street level, taking images from Google Street View. The goal was to take GPS data (either from a route that I have followed myself on foot, on bike, etc. or from data points generated by the driving directions of Google maps).

If we want driving directions from Google Maps, one easy way to generate GPS data points in a .GPX file is to:

  • use google maps to generate a route

  • grab the URL generated above in Google Maps and feed it to GPS Visualizer to get a .gpx file with the GPS data points following the given route

If, instead, we want GPS points from a route that we did previously, we can just, for example, download the GPX file directly from Endomondo.

At these point, we can try our luck with sites like or but if we want finer control, we will need to do some extra work.

If we use the .gpx files above, the results will not be very good, since there will be not many data points and/or due to the GPS receiver limitations, the points can be outside roads, resulting in shaky and jumpy street view images. So, we can do two things to improve this.

First, we are going to generate more data points by interpolating, with GPSbabel  (see For example, to get data points every 5 meters:

gpsbael -i gpx -f track.gpx -x interpolate,distance=0.005k -o gpx -F newtrack.gpx

Second, we can try to fit those GPS points to a proper road (assuming we were on a bike tour, running, etc. on roads). To do this, we can use the site You need to apply for an API key. Once you do that, we can convert our original shaky GPS data with

curl -X POST -H 'Content-Type: application/gpx+xml' --data-binary @newtrack.gpx "" -o output.xml 

This works OK with the GPX file from Endomondo, which has time stamps, but it will break (the developer knows about this, so perhaps it is fixed when you try it) for the Google Maps generated GPX file, which doesn't have time stamps. To fix it, we just have to add timestamps to the GPX file before accessing So I turn all the trkpt from something like:

to something like (you can just put the same timestamp for all the trkpt's):

The output from TrackMatching matches the roads much better, hopefully, than the original GPX data, but it comes in an unfamiliar format that I have not been able to convert easily to a GPX file (if you know how to do it with some GPS conversion software, please let me know). I was too lazy to write a script to do the necessary transformations automatically, and instead I used search/replace in my text editor, so that from the output.xml file I extract all the wpt ....="" stuff and modify each waypoint of the form wpt y="28.465961" x="-16.269638" to (if you don't know how to do search/replace with regular expressions, this is a good time to learn!):

Now in the .gpx file obtained with GPSBabel, delete all the trkpt entries (so there will be an empty section, and in their place put all these new trkpt definitions.

With the help of GPS Visualizer again, you can verify that the new .gpx file is matched to roads better than the original one. Just use the options to convert a .gpx file to Google Maps as follows:

As an example, this is how the track looks like with the .gpx file directly downloaded from Endomondo:

And this after massaged by TrackMatching:

Now that we have .gpx files with many data points and nicely following roads, it is time to get the Google Street View images to put everything together. The code I used is a minimal variation of the code available at (discovered at In case the pastebin expires, I uploaded the code to GitHub ( You can download it with:

git clone

The file is still very crude, so you will have to change things by hand. It will work by default on a file called input.gpx (either change that or make a symbolic link named input.gpx pointing to the file you want to work with). Next, leave uncommented the appropriate line: for the .gpx file coming from Endomondo:

gpx_trackseg = gpx_file.getroot()[1][3] # For Endomondo .gpx

For the .gpx file coming from Google Maps:

gpx_trackseg = gpx_file.getroot()[3][1] # For GPSBABEL .gpx

You should also have a Google Street View Image API Key (if you don't have one, you can get instructions at Put it in (in place of YOUR_GOOGLE_API_KEY) and execute it as:


and all the corresponding images will be downloaded from Google Street View.

From these images use your favourite method to create a video. For example:

avconv -r 10 -i %5d.jpeg -b:v 1000k input.mp4

(Downloading the images takes a while, so make sure you calculate the appropriate rates beforehand. I found that around 10 FPS is a good number above (the images are taken at intervals, and if you try a normal video rate of 24FPS, the video will be too shaky). Assuming the 5 meters interval given to GPSBabel above, this will mean a virtual speed of 50 m/s or 180 km/h. Depending on the effect you want to create and the place where the images are taken (for example a city vs. a very open road with nothing near), this might be too fast or too slow. You will have to experiment a bit).

As an example, here it is the result for an Endomondo generated track (a bicycle route):

And here for a .gpx file generated via Google Maps as explained above (for this one, at the beginning there were some 'bad' frames that I removed by hand with Kdenlive video editor):

Thursday, 30 April 2015

Creating a virtual hiking tour

Lately I'm back to hiking and when I do a route I use my mobile phone with a GPS application (at the moment I use Wikiloc) to record the track. Last week I climbed Teide, and Wikiloc offers the possibility of easily embedding the data from their site, which is nice:

But you shouldn't stop there and you can also create a guided tour of the route. Doing it is quite simple, and I list below the steps I took to create the video tour of the Teide climb:

  • First, download the file from Wikiloc in KML format, and open it with Google Earth. Then, select the route and you can see an icon in the right part of the left panel that says "Play Tour" (play it a couple of times first to cache all the necessary images). Options to modify the speed, camera angles, etc. are available at Tools::Options::Touring.
  • Then, when we are ready, we just play it and at the same time record it with, for example, Kazam (30 FPS gives pretty good quality).
  • The resulting file is pretty big. To make it smaller we can use WinFF with output as MPEG-4 (very high quality). As an example, from 656MB this turns the file into 71MB, which can now be mildly edited with Kdenlive, and we render it all together for Web site::YouTube 1280x720. The resulting video is now 51MB, and we can upload it directly to YouTube: 

Thursday, 12 February 2015

Classical guitar progress logging (Feb'15)

With many obvious mistakes... plenty to improve yet, but I want to move on... (This time I did found the webcam, but synchronizing audio and video is really tough sometimes...) :

Tuesday, 16 December 2014

Classical guitar progress logging (Dec'14)

After almost a year without playing the guitar. For this one, I couldn't find the webcam, so only audio, at SoundCloud:

Sunday, 1 December 2013

Introduction to Music Production (Coursera)

I just finished another course at Coursera: Introduction to Music Production by Loudon Stearns of Berklee College of Music.

The most demanding stuff from this course were the assignments, in which we had to create short lessons explaining some of the concepts that we learned each week. I went for the screencast mode of teaching, and these are the assignments for each week. Doing the assignments was hard work, but I learned a lot that way, and I hope I can take another music-related course from Coursera in the near future...

Week 1: Topic: "Typical recording signal flow using your own equipment"

Week 2: Topic: "Efficiently create a compile from multiple audio recordings in your DAW."

Week 3: Topic: "Submix practical: Demonstrate the configuration of a Submix in a DAW or physical mixing board and Parallel effects practical: Demonstrate the configuration of parallel effects in a DAW or physical mixing board."

Week 4: Topic: "Demonstrate how to use a specific compression plugin, including threshold, ratio, attack, and release. Describe what visuals the device has, including gain reduction meters, transfer functions, and gain reduction traces if any."

Week 5: Topic: "Demonstrate the delay spectrum with examples of comb filtering, creating pitches with delays, slapback delays, and synchronized long delays."

Week 6: Topic: "On a synthesizer of your choice demonstrate the usage of these controls: Oscillator waveform, oscillator frequency, filter type, filter frequency, filter resonance, and amplitude envelope ADSR. How are they similar and how are they different from the simple synthesizer used in the video demonstrations?"

Thursday, 14 November 2013

Classical guitar progress logging (Nov'13)

Soon I'll have a decent microphone, but for the moment another recording with the crappy one. This month a very nice piece by Julio Sagreras: "Maria Luisa: Mazurka".

Maria Luisa: Mazurka (by Julio Sagreras) from Angel de Vicente on Vimeo.

The video is here.

Monday, 4 November 2013

Screencasts with Ubuntu Studio 13.10

For a course I am taking on Music Production at Coursera, I need to do screencasts and upload them to YouTube or similar. Before I forget what I found, I put it here. Some details about my settings:
  • I'm running UbuntuStudio 13.10 with the XFCE4 Desktop Environment
  • The screencast recording application I'm using is Kazam (during my first attempts there was an issue with libx264-123 which was causing Kazam to crash, but luckily for me the bug was solved just a couple of days ago).
  • The video editing software I'm using is OpenShot Video editor.
  • My display has a resolution of 1920x1080.

So, first I just use Kazam to record my screencast. For this course I'm mostly interested in recording the Ardour application, which has lots of information, so I will be recording the whole screen.

The resulting video has a very good quality, and I can edit it with Openshot (though remember first to stop Ardour and to stop JACK, since Openshot is not JACK-friendly). Once ready I can export it with the following settings (just by modifying a couple of things after choosing the Vimeo-HD profile given by Openshot):

The resulting video is of very good quality, and I can upload it to YouTube. In YouTube the quality is still very good, but you have to view it at the right resolution. As far as I know you cannot give a link to the video to stream at 1080p, but you can at least force 720p by adding &hd=1 to the YouTube link.

So that gives a quite nice video quality, and you could have it almost perfect by making sure that your viewers will use 1080p, but this might not be possible due to their bandwith, and in any case there is a lot of information in a full screen, so it is nice to add a little help to focus minds (i.e. zooming).

Zooming looks like it should be quite basic, but I couldn't find any other satisfactory way of doing it than by running Compiz. I certainly don't want to run Compiz in a regular basis, but I installed it and learnt how to activatate/desactivate it just for the recording session. Basically, to install it (taken with changes from, I just did:

sudo apt-get install compiz compiz-plugins compiz-plugins-extra compizconfig-settings-manager

I didn't have to do any of the other stuff suggested in that page. With that in place, I start Compiz by running in a terminal:

compiz --replace

Then I open the CompizConfig Settings Manager and configure the magnifier as per the images below (it was important to de-select the "Enhanced Zoom Desktop", as otherwise this seems to override my preferred Magnifier effect):

Now, when I'm done with the recording, if I want my resources back and I want to get rid of Compiz, from another terminal I type (which I can killl with Control-C after the command has done its magic):

xfwm4 --replace

This will kill Compiz and give me my XFCE4 desktop back.

With all this in place, I can have a very nice indeed screencast. As an example: