Replacing/appending gps track of a mp4

Started by MikeM, January 18, 2023, 06:30:46 AM

Previous topic - Next topic

MikeM

Hi, I'm wondering if it is possible to replace or append a CAMM gps track to mp4 (or really any gps format...).
I got tags by doing
exiftool -ee -G3 --Track1:* --Track2:* -api LargeFileSupport=1 -X VID.mp4 > tags.txt
which outputs for example
<Track3:SampleTime>0:01:03</Track3:SampleTime>
 <Track3:SampleDuration>0.01 s</Track3:SampleDuration>
 <Track3:GPSDateTime>2018:06:04 08:43:04.1Z</Track3:GPSDateTime>
 <Track3:GPSMeasureMode>3-Dimensional Measurement</Track3:GPSMeasureMode>
 <Track3:GPSLatitude>XX deg XX&#39; 7.67&quot; N</Track3:GPSLatitude>
 <Track3:GPSLongitude>XX deg XX&#39; 41.66&quot; E</Track3:GPSLongitude>
 <Track3:GPSAltitude>37.8 m</Track3:GPSAltitude>
 <Track3:GPSHorizontalAccuracy>0.579999983310699</Track3:GPSHorizontalAccuracy>
 <Track3:GPSVerticalAccuracy>0.579999983310699</Track3:GPSVerticalAccuracy>
 <Track3:GPSVelocityEast>-2.20491433143616</Track3:GPSVelocityEast>
 <Track3:GPSVelocityNorth>-10.5452861785889</Track3:GPSVelocityNorth>
 <Track3:GPSVelocityUp>0</Track3:GPSVelocityUp>
 <Track3:GPSSpeedAccuracy>0</Track3:GPSSpeedAccuracy>
Then tried
exiftool -tagsfromfile tags.txt out.mp4
but I can't seem to be able to write continuous GPS data into the other mp4... (also tried adding -all:all, -gps:all and other variations, but I might be doing something wrong)

All in all my goal would be to be able to write arbitrary GPS track such as
<Track3:SampleTime>0.20 s</Track3:SampleTime>
 <Track3:SampleDuration>0.20 s</Track3:SampleDuration>
 <Track3:GPSLatitude>X1 deg YY&#39; 20.10&quot; N</Track3:GPSLatitude>
 <Track3:GPSLongitude>X1 deg YY&#39; 6.69&quot; E</Track3:GPSLongitude>
 <Track3:SampleTime>0.40 s</Track3:SampleTime>
 <Track3:SampleDuration>0.20 s</Track3:SampleDuration>
 <Track3:GPSLatitude>X2 deg YY&#39; 20.10&quot; N</Track3:GPSLatitude>
 <Track3:GPSLongitude>X2 deg YY&#39; 6.69&quot; E</Track3:GPSLongitude>
 ...
or to append these continuous GPS packets into an mp4 so I can build the track one by one.

I also tried importing from .gpx which looks like
<trk>
<name>reel_0005_20210906-125956</name>
<trkseg
<trkpt lat="XX.0763717375" lon="YY.0485558810"><time>2020-05-04T15:03:11.6</time><ele>50.28</ele></trkpt>
<trkpt lat="XX.0763716195" lon="YY.0485558810"><time>2020-05-04T15:03:11.8</time><ele>50.30</ele></trkpt>
<trkpt lat="XX.0763715009" lon="YY.0485558810"><time>2020-05-04T15:03:12</time><ele>50.30</ele></trkpt>
<trkpt lat="XX.0763713806" lon="YY.0485559251"><time>2020-05-04T15:03:12.2</time><ele>50.30</ele></trkpt>
...
</trkseg>
</trk>
with no luck.

NOTE: I don't want to copy GPS data from one mp4 to another nor do I want to just geotag the file with singular latlon. I want to be able to modify/create the "duplicate tags" that software can use to display a video + it's path on a map (without separate gps files, just from the video alone).

Phil Harvey

ExifTool doesn't yet have the ability to write timed GPS.

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

MikeM

Okay good to know, thanks! Any plans of adding this in the (near) future? I'm honestly shocked at the lack of tools to do this (I found one and it is broken, writes invalid data) considering how common use-case this is and the formats are known too... (at least camm is well documented)

Phil Harvey

Well, ExifTool currently supports reading 66 different formats of timed GPS.  There is no chance that ExifTool will ever support writing all of these.

The good news is that the CAMM format is probably one I would consider supporting first because it is the only one with a published specification.

The bad news is that the CAMM format is the most complex, and would be the most difficult to implement. :(  (Which is probably one reason why everybody seems to be inventing their own format.)

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