B4K and Mapillary

GPSMapper

Member
App Developer
Joined
Jul 15, 2017
Messages
38
Reaction score
22
Country
Poland
Dash Cam
Blackvue DR650S-2CH / Viofo A119 V3
Hi All,

I have ordered a sample and looking forward to use it as a replacement for my Blackvue DR650S with Mapillary and Openstretcam
I am an active Mapillary and Openstreetcam contributor and I would like to optimize my workflows to sample and process (geotag) imagery from B4K.

Mapillary tools (open-source command-line tool developed and supported by Mapillary and community) provides native support for GoPro family actioncams and Blackvue DR900S dashcams -
it can sample video clips to individual frames (images) at a given rate (i.e. 1 frame per second, or 1 frame per 2 seconds), extract the metadata and geotag resulting sequences preparing them for upload.

All other dashcams/action cams require additional steps: sample video in frames, get the GPS log from external app/file, synchronie the two and geotag resulting sequences.
I am doing it like this for DR650S with external GPS logger, while built-in one was not reliable.

But having in mind that B4K stores GPS metadata within the file (similar to GoPros and BV DR900S), I am keen to optimize and automate workflow with mapillary tools by adding support for B4K.

I have already contacted Phil Harvey (Exiftool author) and Mapillary devs, but they were not able to quickly find the trace of GPS metadata within B4K TS sample files.
(I have used raw file from this post https://dashcamtalk.com/forum/threads/updated-iq.43849/ , thanks @SawMaster )

Maybe someone has some specs on how/where GPS metadata is stored in B4K TS files?
I can see that metadata is there (using GPS player from Blueskysea and DVplayer has also added B4K support recently)

@estore009 , can you help here?

I really want to spend some effort on promoting B4K among Mapillary contributors community as it seems to be excellent alternative to DR900S (4 times cheaper!)

And couple of additional questions to the owners (while I am waiting for delivery):
1. Does GPS metadata stored somewhere in the external files apart from TS video itself on B4K?
2. If yes, can you please share a sample?

Many thanks in advance!
 
Last edited:
1. Does GPS metadata stored somewhere in the external files apart from TS video itself on B4K?
No, its GPS data embedded in the footage!
 
embedded in the footage
Any clues where to look / how to find it inside the file? ;)

Update from Phil:

This file contains only 3 programs: 1. clock reference, 2. HEVC video, and 3. AAC audio. If timed GPS exists in this file, then it is in the HEVC video stream. ExifTool doesn't yet have the ability to decode H.265, and it would be a LOT of work to do this (if I could find the specification at all).
@estore009, can you confirm?
 
Last edited:
OK, I've got the GPS data logging datasheets from Blueskysea (actually they are the same with Viofo A119 V3 which i have also received this morning), will give it a try once I'll get both cams in my hands.
 
Last edited:
UPDATE:
Thanks to mapillary community support - TS sampling and GPS data processing script is ready
While everything has started with a simple gpsdata extraction , the result is by many means more advanced and powerful than what mapillary_tools are offering

The script is pretty much complete, only distance-based sampling was not tested thoroughly yet.

For those who are interested in Mapillary or Openstreetcam contribution - script could be found here
It’s written on python, so obviously you will need:
  • python installed
  • some additional libraries not included in default python installation:
    Code:
    pip install opencv-python
    pip install exif
usage:
python ts_processor.py --input 'filename_or_folder'

You could check all default parameters applied inside the script
ONLY .TS files are supported, there is no support for .MP4
It is confirmed working with Viofo A119 V3 and Blueskysea B4K produced files, but some other Novatek 966x based models (supporting .TS) may work as well (not tested)

From my testing I can say that most common an optimal config would be:
--sampling_interval 1
--timeshift 0.5

1st is basically tells to extract 1 image per second
2nd is very important one. I have observed that gps coordinates recorded inside the video stream are a little bit late (out-of-sync), which means that gps position on the map is a little behind the actual sampled image location.
With timeshift parameter you could make an adjustment.
After extensive testing on both B4K and A119V3 footage I can say that 0.5 appears to be the optimal value under most conditions and will be giving you a precise positioning of your sampled data.

Thanks to interpolation support, you can obviously do the sampling at a higher fps, i.e. 2-5 frames per second (sampling interval 0.5-0.2 sec) is working fine and gps coordinates are accurately interpolated.
Interpolation inside the tunnels works fine (obviously resulting in interpolated coordinates distributed along straight line) and you can control this behavior with --min_coverage parameter.

image


I will prepare and upload some test sequences later next week so those of you who are interested could have a look.

In general with this script the workflow is very much straightforward and time-efficient:
  1. do the batch processing using ts_processor with desired parameters set
  2. (Optional) batch crop images to remove OSD info and/or side reflections.
  3. post-process&upload with mapillary_tools or directly with Web or Desktop uploader
 
Last edited:
Also here you could find a simple python script which only extracts gpsloc data out of TS files (supporting and tested with B4K and A119V3 only)
Autodetected as Blueskysea B4K.
timestamp;GPS status;NW hemisphere;EW hemisphere;lat;lon;speed(kmh);bearing
2021-1-9T21:16:27Z;A;N;W;34.827612;-82.610807;52.87;148.9
2021-1-9T21:16:28Z;A;N;W;34.827498;-82.610726;52.82;149.2
2021-1-9T21:16:29Z;A;N;W;34.82738;-82.610645;51.56;150.4
2021-1-9T21:16:30Z;A;N;W;34.827262;-82.610563;51.45;151.8
2021-1-9T21:16:31Z;A;N;W;34.82714;-82.610498;50.65;154.5
...
2021-1-9T21:17:24Z;A;N;W;34.820268;-82.606022;59.43;148.4
2021-1-9T21:17:25Z;A;N;W;34.820138;-82.605941;59.5;148.8
2021-1-9T21:17:26Z;A;N;W;34.820003;-82.605843;60.89;150.4
GPS data analysis ended, no of gpsfix points 60

SergeiF has also released an update of his gps>gpx extraction script, adding support for .TS videos (Viofo A119V3 and B4K) and fixing compatibility with A119 V3 .MP4 container as well
 
Last edited:
Though this is well above my level of understanding, it seems that you have done very well @Dusha999 (y)(y)

I appreciate any and all advancements relating to dashcams, someone will benefit from them even if I don't, and that is a good thing.

Phil
 
Back
Top