Dashcam OpenStreetMap mapping

Using OpenStreetMap (OSM) based map apps is a key part of being able to use my phone for navigation without using up my fairly costly data plan. But part of the price for that is putting time into improving OSM’s data. “Mapping” has, at times, become an obsession.

For many areas I frequent OSM’s biggest failing is a lack of speed limit data, so that has been a focus for me. In the past I everytime I got in my car I was compulsive about setting up my Android phone on my dash with OsmTracker configured with a custom button set to easily record speed limits. I had one non-speed button configured to mark a generic item of interest. The idea was that I could use satellite imagery to remind myself what the generic item(s) were later.

As I got more and more of my local area mapped I started to get lazy about setting up OsmTracker for every outing. Then I found myself in the position of noticing something that ought to be added or changed on OSM but not having a way to assure I’d remember it later or have an exact location when I could fire up JOSM.

Around that same time I ended up getting a dash cam and it dawned on me that I could use the video file(s) from it to remind myself of the stuff that I wanted to edit on OSM. At first I’d simply pull up the video for what I was interested in and make the edits.

Often while scanning the videos looking for the item I wanted to map I could see other features that should be added. Features that I’d been ignoring when using OsmTracker as I did not have a button for them and could not see sufficient detail from aerial imagery. So I started to use the videos to map other items I hadn’t bothered with before.

But scanning a video and finding the exact spot in JOSM can be difficult outside of developed areas where there are cross streets and buildings that can be identified in the aerial imagery. My dash cam has a GPS receiver and I have it configured to put the lat/lon on the video image, but typing the numbers off the video into JOSM is an extra step.

My next step was to read the OSM wiki page on video mapping to see if I could be doing things better. The wiki reminded me that ffmpeg can extract still frames out of a video file. And it informed me of the nifty exiftool that allows one to read and write meta data in video and still images.

But to improve things, it looked like I needed to get the GPS data from the video. The GPS data on my Viofo A119s v2 dash cam is in a proprietary format and it was not obvious how to extract it. My initial searches for that turned up only GUI based proprietary software, much of it that would not run on my Macintosh. To be easily scripted a CLI based tool was desired. Eventually I found a Python script that would extract the GPS data from my Viofo A119s v2 dash cam and create a GPX file.

I’ve wrapped those tools into a bash script, inspired by samples on the video mapping wiki page, that allows me to convert my dash cam videos into a GPX track and a set of geo-referenced images that I can open in JOSM.

Am I duplicating the work of Mapillary and/or OpenStreetCam? I guess so. But while Mapillary allows their images to be used in OSM they are proprietary. And I never got the OpenStreetCam app to work properly on my phone.

Here is a sample of what an extracted GPX and associated geo-referenced images from my Viofo A119s v2 looks like in the JOSM editor:

Dash cam images in JOSM

And here is the script, warts and all.