GPS Data from Kenwood Video File

Started by SLICKONE, July 15, 2024, 12:41:52 PM

Previous topic - Next topic

SLICKONE

Hi Phil,
I am building a traffic sign detection and classification model for a university project.
I need to know the current speed of my car and the respective frame, so my project partner recorded a video.

The file can be found here: https://drive.google.com/file/d/1hF4eAf6ouxnjquQQvY9-tsDtbUmaxWtz/view?usp=share_link

It shows the required information like gps and speed in the Kenwood Video Player.
Now to my question: Which command do I need?
I tried:

Image-ExifTool-12.76 % ./exiftool -time:all -location:all -G -a -s dash_1.mov > metadata.txtImage-ExifTool-12.76 % ./exiftool -ee dash_1.mp4
Those didn't do it. Only general metadata is printed. I would appreciate it very much if you would help.

Thanks in advance!

StarGeek

Has this video been edited in any way?  I see ffmpeg listed in the data, which is something I haven't seen in a dashcam video before.

If it's been edited, all GPS tracks will have been lost. My standard copy/paste when it comes to EXIF/GPS data in a video 

The problem is that there really isn't a standard for embedding a GPS track in a video* Currently, exiftool reads 74 different ways that a GPS track can be in a video and there are about half a dozen more in which the format hasn't been decoded. I have yet to find a program that will embed a GPS track into a video file.

The best you can do is extract the GPS data into a GPX track and save it separately.

*Technically, there is a standard by Google, but nobody follows it, and I've never found any software that write this format. I mention it in this Exiftool forum's post, which has a response from the author of exiftool


If the video hasn't been edited, then Phil will have to take a look to see if the data is embedded. And it might not be embedded. Some dashcams only hard code the data directly onto the video and don't save it as embedded data.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

SLICKONE

Firstly, Thanks for the fast reply and looking at the file.
I currently can't get a hold of my project partner so I don't know if he edited the file.

But I am fairly sure the gps data is still there since the Kenwood Media Player shows the data in its UI, when I open the video file in it.

But that would be a real bummer if it was gone. I have no idea how I can get the current speed of my car synced with a dash video.

QuoteThe best you can do is extract the GPS data into a GPX track and save it separately

How can I do that? Or am I misunderstanding you?

StarGeek

Quote from: SLICKONE on July 15, 2024, 04:28:28 PMBut I am fairly sure the gps data is still there since the Kenwood Media Player shows the data in its UI, when I open the video file in it.

Just to verify, you're not looking at the data that is hard coded directly on the video? The media player is showing the data elsewhere in the interface? Because this data is directly on the video and not being read from the file.
KMPlayer-2024-07-15_14.29.49.png

There are two previous posts regarding Kenwood dashcams (Link 1, Link 2) and exiftool ended up being able to read them.

Quote from: SLICKONE on July 15, 2024, 04:28:28 PM
QuoteThe best you can do is extract the GPS data into a GPX track and save it separately

How can I do that? Or am I misunderstanding you?

In this case, you can't at the moment, as exiftool doesn't detect any GPS data in the file. That, as I said, was part of my standard copy/paste.

If Phil is able to find the data, and it isn't one of several track formats that is completely obfuscated, then he would have to add the ability to read the track and it could be extracted following the instructions under Inverse Geotagging.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

SLICKONE

Yes, 100 percent. It looks like this:



I guess the video player somehow can read the metadata.

Nevertheless, thank you for your help!

Phil Harvey

I can see the GPS in the trailer of this file.  Expect ExifTool 12.90 to be able to extract this unless I post back here with a problem.

BTW, what model of Kenwood dash cam is this?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

SLICKONE

Thank you very much for taking a look!

I am going to ask my project partner for information on the model.

Sadly, I have to present my project on Monday. Guess I'll have to find another way.
Still very grateful for the help and your tool is great.

Have a good one.

Phil Harvey

What version of ExifTool are you using?  (perl, Window or Mac?)

I could make a pre-release available for you asap.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

SLICKONE

I'm using 17.76 on Mac.

That would be so awesome. I have no words.

Also I have the dash cam information now: Kenwood DRV-A501W Dashcam

Phil Harvey

Here you go:  ExifTool-12.90p.pkg

I'll let you do the testing for me. :)  Let me know how it goes.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

SLICKONE

Oh my god, thank you!

I know I have already taken a whole lot of your precious time, but two quick questions:

Which exiftool command do you recommend/use?

Where does the installer put the files? I can't find them. (Edit: Nevermind, CMD+I during install gave me the information)

Phil Harvey

The files are installed in /usr/local/bin.  After installing, try typing this command in a MacOS Terminal window:

exiftool -ee -p '$gpsdatetime,$gpslatitude,$gpslongitude,$gpsspeed,$accelerometer' -n FILE > out.csv

where FILE is the name of the MP4 file to read (You can drag and drop the file onto the Terminal window instead of typing the name).

After this command, you should have an out.csv file in your home directory with the GPS information from the video.  Knowing the frame rate and the time at the start of the video you can calculate the GPS for each frame.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

SLICKONE

Phil you are the best!

Works exactly as I had hoped. Here's a little excerpt from the output:

2024:07:11 12:04:12Z,50.6123860677,8.70271809895,33.00000000000,0.019999999553 -0.09000000357 -0.14000000059
2024:07:11 12:04:13Z,50.6124674479,8.70276184082,34.00000000000,-0.28999999165 0.180000007153 0.159999996424
2024:07:11 12:04:14Z,50.6125488281,8.70280354817,37.00000000000,0.159999996424 -0.09000000357 0.000000000000

I am so grateful. Is there a possibility to donate to ExifTool?
Will definitely give credit in my git and presentation.

Little aside, I got this warning:

Warning: [Minor] Tag 'Main:gpsdatetime' not defined

But the time info is still in the out.csv, so all good.

I am giddy to finally put the last pieces of my ISA in place. Have a lovely day.

Phil Harvey

Glad it works as you wanted.  :)

The warning is expected because there is no GPS in the main image metadata (it only contains timed GPS, which is extracted as sub-documents by ExifTool).

There is a Donate button on the ExifTool home page.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

One more thing:  Is the time UTC or local time?  I should remove the "Z" if it is local.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).