Geotagging a MOV File with Mapillary Tools

Introduction

We can use a Mapillary Tools to extract image stills from video files for upload to Mapillary. Our action cam does not have GPS, so we need to ‘geotag’ the images with a synchrounously recorded GPX track, by matching their timestamps whose of the track points.

Note: You may prefer working with time lapse images instead.

Setup

So here’s our setup:
– Bicycle
– Android device running GPS Logger
– Akaso EK7000 Action cam

Synchronize the camera clock to the Android device clock. In this setup you can do this by turning on the camera WiFi by pressing the down button. Connect the Android device to the camera WiFi. Then use the Akaso Go app to connect to the camera. Time will be synchronized. After that you can disconnect.

Recording

First start recording the GPS position, so the video will be covered by it. Then start recording the video. When you´re done, stop the recordings and transfer the GPX file from the Android device and the MOV file from the camera to your PC.

Mapillary Tools

Take a look at how to install and use Mapillary Tools on your system: https://github.com/mapillary/mapillary_tools. Here, we’re on Linux.

To use these tools to upload our data, add an ‘organization’ to your Mapillary profile. You’ll need the ID of this organization to upload your geotagged imagery.

Geotagging

Now we have a GPX and a MOV file.

$ ls -1tr
FILE240308-143351F.MOV
20240308-143313.gpx

I’m on Mapillary Tools version 0.11.1.

The MOV filename contains the start time of the video in my time zone (GMT+1). The GPX file contains UTC time stamps.

$ grep trkpt.*time 20240308-143313.gpx | head -1
<trkpt lat="51.78986520" lon="6.14152569"><ele>99.619</ele><time>2024-03-08T13:33:13.999Z</time><speed>0.000</speed><sat>20</sat></trkpt>

We’ll have to correct for that in the geotagging command. Here it is:

$ mapillary_tools video_process . --geotag_source "gpx" --geotag_source_path 20240308-143313.gpx --video_sample_distance -1 --video_sample_interval 2 --video_start_time '2024_03_08_13_33_51_00'

The result should be a directory of JPEG files and an image description JSON file:

$ ls -1trR mapillary_sampled_video_frames/
mapillary_sampled_video_frames/:
FILE240308-143351F.MOV
mapillary_image_description.json

mapillary_sampled_video_frames/FILE240308-143351F.MOV:
FILE240308-143351F_NA_000003.jpg
FILE240308-143351F_NA_000002.jpg
FILE240308-143351F_NA_000001.jpg
FILE240308-143351F_NA_000007.jpg
FILE240308-143351F_NA_000006.jpg
FILE240308-143351F_NA_000005.jpg
FILE240308-143351F_NA_000004.jpg
FILE240308-143351F_NA_000011.jpg
FILE240308-143351F_NA_000010.jpg
...

Upload

Now upload the geotagged imagery to contribute to Mapillary (with the ID of your organization as <organization_key>):

$ mapillary_tools upload mapillary_sampled_video_frames/FILE240308-143351F.MOV/ --desc_path mapillary_sampled_video_frames/mapillary_image_description.json --user_name "<username>" --organization_key "<organization_kay>"

Reference

GitHub Issue

One thought on “Geotagging a MOV File with Mapillary Tools”

Comments are closed.