ExifTool Forum

General => Metadata => Topic started by: lectrician1 on February 12, 2023, 01:00:40 PM

Title: Copying GPS data from one video to another
Post by: lectrician1 on February 12, 2023, 01:00:40 PM
I am trying to copy GPS data from one mp4 file (.insv file) to an output mp4 file.

The output mp4 file is an equirectangular export of the original .insv file (+ another .insv file for the other lens of the Insta360 camera). Therefore, it is basically a complete copy of the original video.

Insta360 offers no way to copy GPS data during the equirecangular export in their Insta360 Studio software so I am looking to add it myself using exiftool.



I know the original .insv file has GPS data because I successfully exported it to a .gpx file:

exiftool.exe -ee -api largefilesupport -p gpx.fmt VID_20230212_095220_00_010.insv > yay.gpx
Warning: Truncated '\x00\x02\x00\x00' data - C:/Users/jayan/Nextcloud/Pictures/Insta360 OneX2/VID_20230212_095220_00_010.insv
Warning: [Minor] Insta360 accelerometer data is huge. Processing only the first 20000 records - C:/Users/jayan/Nextcloud/Pictures/Insta360 OneX2/VID_20230212_095220_00_010.insv

and when I opened yay.gpx it showed the correct data.

However, when I try to copy all the tags (which I think should include the GPS data) from the .insv to the .mp4:

exiftool.exe -tagsFromFile "C:\Users\jayan\Nextcloud\Pictures\Insta360 OneX2\VID_20230212_095220_00_010.insv" -all:all "C:\Users\jayan\Downloads\360 export\third try walc\VID_20230212_095220_00_010.mp4"
Warning: Truncated '\x00\x02\x00\x00' data - C:\Users\jayan\Nextcloud\Pictures\Insta360 OneX2\VID_20230212_095220_00_010.insv
    1 image files updated

and then I try exporting the GPS data from the .mp4 to a .gpx file:

exiftool.exe -ee -api largefilesupport -p gpx.fmt "C:\Users\jayan\Downloads\360 export\third try walc\VID_20230212_095220_00_010.mp4" > yay.gpx
the gpx file has no points in it which makes me think it didn't copy the GPS data.



I also tried using this command to copy the GPS data:

exiftool.exe -P -progress -overwrite_original_in_place -extractEmbedded -tagsFromFile "C:\Users\jayan\Nextcloud\Pictures\Insta360 OneX2\VID_20230212_095220_00_010.insv" -all:all "C:\Users\jayan\Downloads\360 export\third try walc\VID_20230212_095220_00_010.mp4"
Warning: Truncated '\x00\x02\x00\x00' data - C:\Users\jayan\Nextcloud\Pictures\Insta360 OneX2\VID_20230212_095220_00_010.insv
Warning: [Minor] Insta360 accelerometer data is huge. Processing only the first 20000 records - C:\Users\jayan\Nextcloud\Pictures\Insta360 OneX2\VID_20230212_095220_00_010.insv
======== C:/Users/jayan/Downloads/360 export/third try walc/VID_20230212_095220_00_010.mp4 [1/1]
    1 image files updated

however outputing it to the .gpx also resulted in no points in the gpx file.
Title: Re: Copying GPS data from one video to another
Post by: StarGeek on February 12, 2023, 01:10:47 PM
Exiftool cannot embed a gpx track in a video file.  I have yet to find any program with that ability.  The main problem is the fact there isn't a standard for doing so.  Exiftool currently knows 66 different ways a GPS track in a video file.  How would you choose which one is the "correct" one?

This also applies to EXIF data in a video file. There's not standard for including it, so every camera company does it in different ways.
Title: Re: Copying GPS data from one video to another
Post by: lectrician1 on February 12, 2023, 01:31:07 PM
QuoteExiftool cannot embed a gpx track in a video file.  I have yet to find any program with that ability.

Yeah I couldn't find one either. That's why I'm asking how I can copy the metadata which should contain the GPS data, whether it's in the EXIF or XMP idk, from one file to another.

Both the input file (.insv is technically an .mp4) and the output file are mp4s. Should they not have their GPS data stored in similar ways so that replacing the metadata of one with the other should have no issues? Like I said, they're the same video too. They have the same length and framerate.
Title: Re: Copying GPS data from one video to another
Post by: StarGeek on February 12, 2023, 03:06:18 PM
You can set a single coordinate.  For a video, you have 2 options, XMP and/or Quicktime tags.

Example:
C:\>exiftool -P -overwrite_original -XMP:GpsLatitude=40.6892 -XMP:GPSLongitude=-74.0445 -XMP:GPSDateTime="2023:02:12 12:00:00Z" -Quicktime:GPSCoordinates="40.6892, -74.0445" Y:\!temp\aa\Test.mp4
    1 image files updated

C:\>exiftool -G1 -a -s -e -gps* Y:\!temp\aa\Test.mp4
[ItemList]      GPSCoordinates                  : 40 deg 41' 21.12" N, 74 deg 2' 40.20" W
[XMP-exif]      GPSLatitude                     : 40 deg 41' 21.12" N
[XMP-exif]      GPSLongitude                    : 74 deg 2' 40.20" W
[XMP-exif]      GPSDateTime                     : 2023:02:12 12:00:00Z

There isn't a Quicktime GPS date/time tag because the Quicktime:CreateDate is already supposed to be set to UTC.

As for copying, it depends upon whether any of the above tags exist.  Copying would be something like
exftool -TagsFromFile Source.mp4 -GPS* target.mp4
Title: Re: Copying GPS data from one video to another
Post by: pepad89 on February 20, 2023, 01:49:07 PM
I used this command:

C:\Users\pc>"C:\Users\pc\Downloads\exiftool-11.99_64\ExifTool.exe" -p "C:\Users\pc\Downloads\exiftool-11.99_64\gpx.fmt" -ee "D:\360\16.1.2023\VID_20230116_074640\origin_6_lrv.mp4" > "C:\Users\pc\Downloads\gpx_sample074640.gpx"

You must have version of exiftool 11.99_64 if u have large video.
After process you have single file GPX

When u want take this GPS location to another video u must have in this video same GPS time and date and have it in atributs.

Now u can match GPX file with your video by -geotag or i using Geosetter on win. :)
Title: Re: Copying GPS data from one video to another
Post by: StarGeek on February 20, 2023, 04:10:02 PM
The problem isn't creating a GPS track from a video file, it's adding a GPS track to a video file.