Playing with dashcam (Viofo A119 V2) mp4 files in openSUSE GNU/Linux

I briefly played with my new Viofo A119 v2 dashcam’s mp4 files in openSUSE GNU/Linux LEAP-15.0. I still have a lot to learn on this, but I was able to use some of the superb work conducted by others to make some progress with the Viofo A119’s video files.

As noted, this is a Viofo A119 v2 dashcam (where I purchased the GPS module option and also a 128 GB micro SD card to store videos). It is an old make of a dashcam, but because it uses ‘capacitors’ and not a ‘battery’, I am hoping it will work with the hot climate of Asia, where I plan to move in about a months time. Being an ‘old’ model of a dashcam, the price is currently relatively inexpensive in Europe (it is more expensive currently in Asia). Note I currently do not own an auto, but I do plan to purchase one and drive in Asia.

Earlier today, here in Europe, my wife and I rented a car for 1/2 day, so I setup the dashcam so to record some files, to give me a chance to play with the output files. For about an hours of driving, about 12 GBytes ( ! ) of mp4 files were stored on the micro SD card.

Copy dashcam mp4 files to PC

Once back at home, I connected the A119 dashcam to my LEAP-15.0 (w/KDE desktop) using the USB cable, and I immediately had a popup in the right corner allowing to mount the microSD card inside the dashcam. I dragged the mp4 video files to my LEAP-15.0 pc hard drive and proceeded to ‘play’ with them.

Video playback

The mp4 files of the A119 dashcam played back fine with smplayer , with no playback issues with video nor with volume. I also could edit the files with kdenlive, and stablize them even better with ffmpeg. So the mp4 format created no issues.

GPX file Extraction (latitude/longitude)

I thought extracting the latitude and longitude from the mp4 files might be a bit of a challenge. Fortunately others have been here before me. A gentleman by the name of Sergei wrote a python script that will extract the lat/long (and other information) embedded in the mp4 video files by the A119 dashcam, and save that information in an XML file known as ‘GPX’ format. Sergei’s web page is here: Extracting GPS data from Viofo A119 and other Novatek powered cameras.

Sergei’s script file name is “nvtk_mp42gpx.py”. To run the python script (after downloading it), it was a simply matter of the command:


> python nvtk_mp42gpx.py -i 2019_0409_091430_014.MP4 -o output.gpx

where for the above, the mp4 file from the A119 was the file “2019_0409_091430_014.MP4”.

That created an output file by the file name “output.gpx”.

Quality check of GPX file

Sergei suggested running a quality check of the GPX output file using the program “xmllint” which is an app that comes with the rpm " libxml2-tools-2.9.7-lp150.2.6.1.x86_64" that is packaged for openSUSE LEAP-15.0.

So I sent the command:


> xmllint --noout --schema http://www.topografix.com/GPX/1/0/gpx.xsd output.gpx  

and unfortunately received many instances of the error :


output.gpx:189: **element course**: Schemas validity error : Element '{http://www.topografix.com/GPX/1/0}**course**': This element is not expected. Expected is one of ( {http://www.topografix.com/GPX/1/0}magvar, {http://www.topografix.com/GPX/1/0}geoidheight, {http://www.topografix.com/GPX/1/0}name, {http://www.topografix.com/GPX/1/0}cmt, {http://www.topografix.com/GPX/1/0}desc, {http://www.topografix.com/GPX/1/0}src, {http://www.topografix.com/GPX/1/0}url, {http://www.topografix.com/GPX/1/0}urlname, {http://www.topografix.com/GPX/1/0}sym, {http://www.topografix.com/GPX/1/0}type ).
output.gpx fails to validate

So the “output” gpx file from Sergei’s python script failed that quality check.

I took a look in the gpx file and I noted this for every line:

<trkpt lat="49.865975" lon="8.643448"><time>2019-04-09T09:17:22Z</time><speed>8.267115</speed>**<course>344.070007</course>**</trkpt>

I noted a field " < course > number < / course > in that file.

So using a combination of “sed” and a text editor, I removed all instances of < course > number < / course > in that file (such that the lines instances would look like this) :

<trkpt lat="49.865975" lon="8.643448"><time>2019-04-09T09:17:22Z</time><speed>8.267115</speed></trkpt>

With that updated “output-new” gpx file (ie without the ‘course’) I again ran the “xmllint” quality check, and this time the quality was good !


> xmllint --noout --schema http://www.topografix.com/GPX/1/0/gpx.xsd ouput-updated.gpx
ouput-updated.gpx validates

This gave me strong confidence in Sergei’s python script with LEAP-15.0. I thought also it quite possible having the ‘course’ inside the GPX did not matter for other program’s use of the GPX file.

GPXSee

I note a program that one can use to display (visualize/analyze) the information inside a GPX file, is “GPXSee”. GPXSee is available (packaged) for openSUSE.

So I installed GPXSee, ran the program, and used it to open the orginal “output.gpx” that I created with Sergei’s python script. It was able to access the lat/long data inside the “output.gpx” and display the lat/long as a route on a map of the city where I currently live (and am about to move soon). It nicely illustrated where the car was driving based on the original mp4 file, from whence the output.gpx was generated.

Next

I plan to put this education ‘project’ (using the dashcam with GNU/Linux) on hold for a couple of months (and do no more work on this) - as its now down to packing, moving, and getting setup in Asia.

But I look forward to playing more with this dashcam, and openSUSE in a few months time (after I am settled in to my new abode). I am quite happy that the mp4 files can be easily played and that the lat/long information can be extracted and displayed on a map using LEAP-15.0.