OpenStreetMap 로고 OpenStreetMap

Viofo A129 Dashcam Video ➡ Mapillary

mvexel님이 English로 2022년 12월 13일에 게시함.

I purchased a dashcam a while ago because (1) people drive like absolute idiots where I live (seriously, watch that video) and (2) who knows what you might capture? It’s a Viofo A129 Pro Duo, it has a 4k front-facing camera and an additional HD rear-facing camera. It also has built-in GPS.

sample dashcam image

Because it’s always on, I figure it would be nice to use the footage for mapping purposes as well! The process is not completely straightforward, hence this blog post.

Let’s look at what the camera produces:

screenshot of folder

Just movie files, no separate GPX files. That means the location information must be embedded in the video stream somehow. Great..

Some internet sleuthing reveals that the fantastic image / video metadata swiss army knife exiftool (tagline: Metadata R Us 🤣) picked up support for extracting location metadata from video files a few years ago! The command to use is

exiftool -p gpx.fmt -ee -ext mp4 -w %f.gpx ~/tmp/*.MP4

You can read the exiftool documentation to learn more about the various parameters. What’s important is that you need the gpx.fmt file that is basically the template that exitfool uses to write out the raw location data to the familiar GPX format. You can grab it from here.

In the above form, exiftool will iterate over an entire directory of .MP4 files and write one GPX file for each. For this demo, I just copied one movie file from the SD card, so the result is one GPX file with the same name as the movie file but with the .gpx extension.

Now that we have the companion GPX file, we can use mapillary_tools to extract individual images, add location information and upload everything in one step:

mapillary_tools video_process_and_upload 
    ~/tmp/ 
    --skip_process_errors 
    --geotag_source gpx 
    --geotag_source_path ~/tmp/20221209_130755_00330F.gpx

Because the Mapillary CLI tools can only take a single GPX file as the location metadata input, a little scripting to process an entire folder of images would be really nice. I will follow up in another blog with more on that.

I am also experimenting with the camera’s time lapse mode. The video feed for the front camera alone is more than 2GB per 5 minutes, meaning on longer trips you run out of storage and the camera overwrites older files. I will post more on this in the near future as well.

My conclusion is that this definitely could be easier, but it’s also very doable if you’re not afraid of the command line.

Finally, some links for reference:

위치: Central City, Salt Lake City, Salt Lake County, Utah, 84111, United States
이메일 아이콘 Bluesky 아이콘 Facebook 아이콘 LinkedIn 아이콘 마스토돈 아이콘 텔레그램 아이콘 X 아이콘

토론

2022년 12월 13일 05:49n76님의 의견

Good to see there is another way to do this than what I found. I will give your method a try some time.

I extract the GPX data from my Viofo A119 dash cams using a script called nvtk_mp42gpx.py

It might also work on the A129 series if they use a similar Novatek processor.

In my case I sometimes use the GPX to make movie animations using GPX Animator but mostly use it along with a home brew set of scripts to create sequences of geo-referenced photos for use in JOSM.

2022년 12월 13일 05:58n76님의 의견

A postscript on my previous comment: It is possible to script the catenation of your video files with ffmpeg and you can create a single GPX file from multiple files using gpsbabel. That might be a way for you to make your Mapillary uploads easier.

I did a little video experiment using this type of scripting a while back and documented it on my non-OSM blog.

2022년 12월 14일 00:23mvexel님의 의견

Concat’ing the video files and then extracting the GPX may indeed make more sense. as long as the concat doesn’t mangle the location data stream, but no reason to assume that would be the case. Thanks for the comments!

2022년 12월 14일 22:37SimonPoole님의 의견

Unluckily it probably has to be said: check your local legislation before using a dash cam in general and specifically for mapillary.

2022년 12월 14일 23:14n76님의 의견

From a world wide point of view there may be legal issues.

But mvexel and I are both in the United States. If I understand the situation correctly, every state in the United States has decided that still and video photography in public spaces (public roads are public spaces) is okay. And no state has restricted dash cams or dash cam videos.

A number of states have laws about recording conversations. If the dash cam is set to record audio, even if only inside your own car, then you better check out your state laws.

2022년 12월 14일 23:50mvexel님의 의견

There used to be some states where having anything attached to your windshield that would obstruct a clear view for the driver was prohibited, which could include dashcams. I don’t know if that’s still the case. Regardless, I prefer to have it recording in case I need it to prove that I am not at fault if some idiot gets me into a situation. The Mapillary / Kartaview uploads are a bonus.

2022년 12월 15일 00:07SimonPoole님의 의견

From a world wide point of view there may be legal issues.

Guess what mvexels audience here is.

2022년 12월 15일 23:07mvexel님의 의견

Follow up post about automation here

2022년 12월 16일 00:47edc22님의 의견

If you use nvtk_mp42gpx.py script you can also try my upgraded version of this script for Viofo dashcam from: https://github.com/edc22osm/viofo2jpg

2022년 12월 21일 06:03UrSuS님의 의견

Thanks for the tutorial! Here is the link to your Mapillary sequence https://www.mapillary.com/app/user/mvexel?lat=40.730766935220004&lng=-111.86531575521002&z=17&pKey=533265518817876&focus=photo

I have also rear cam, but with lower quality. Interesting if I can merge both? :)

2023년 1월 17일 20:53mvexel님의 의견

I have a rear camera also (not currently installed..) and it would be interesting to process both videos at the same time.

댓글을 남기려면 로그인하세요