ExifTool Forum

ExifTool => Newbies => Topic started by: FabienCC on October 31, 2022, 01:01:39 PM

Title: Copy a pic [Composite]GPSPosition and write it in a mp4 [Userdata]GPSCoordinates
Post by: FabienCC on October 31, 2022, 01:01:39 PM
hello,

I have been using exiftool for a few weeks to solve the lack of timestamp of some videos.

Today I would like to do the same with the gps coordinates.

In my present workflow I would like to extract/copy GPS coordinates of a photos (in which I implemented the GPS coordinates easily with Lightroom) and write it in the mp4 movie.
I saw in this forum that the most effective tag currently to be recognized by Lightroom and Google Photos was the [Userdata]GPSCoordinates.

So how can I copy the [Composite]GPSPosition tag of a pic and write it in the [Userdata]GPSCoordinates of a movie file ? (in one command if possible)

Thanks for this awesome tool and for the help
Fabien.
Title: Re: Copy a pic [Composite]GPSPosition and write it in a mp4 [Userdata]GPSCoordinates
Post by: Phil Harvey on October 31, 2022, 01:14:27 PM
Hi Fabien,

Assuming the pic is .jpg and the movie is .mp4 and they otherwise have the same file name, you could do this to copy the coordinates for all files in a directory:

exiftool -ext mp4 -tagsfromfile %d%f.jpg "-userdata:gpscoordinates<gpsposition" DIR

- Phil
Title: Re: Copy a pic [Composite]GPSPosition and write it in a mp4 [Userdata]GPSCoordinates
Post by: FabienCC on November 17, 2022, 12:23:24 PM
Hello,
and above all, thank you for the super fast response!. I did not see it because I thought I would receive an email at the time of publication. Regardless: Thank you!

It works very well.

However, in my workflow, it would be great to have only one jpg (containing GPS coordinates), located in folder A, and copy its GPS coordinates to all mp4 files located in folder B.

Is it possible ?
Title: Re: Copy a pic [Composite]GPSPosition and write it in a mp4 [Userdata]GPSCoordinates
Post by: StarGeek on November 17, 2022, 02:35:00 PM
Quote from: FabienCC on November 17, 2022, 12:23:24 PMI did not see it because I thought I would receive an email at the time of publication.

Select "Receive Emails and Alerts" in the upper right corner of the thread
(https://i.imgur.com/iPSCh0L.png)

To copy tags, you would use the -TagsFromFile option (https://exiftool.org/exiftool_pod.html#tagsFromFile-SRCFILE-or-FMT).

exiftool -TagsFromFile /A/Source.jpg -gps* /path/to/B/
Title: Re: Copy a pic [Composite]GPSPosition and write it in a mp4 [Userdata]GPSCoordinates
Post by: wywh on November 18, 2022, 05:07:41 AM
Quote from: Phil Harvey on October 31, 2022, 01:14:27 PMexiftool -ext mp4 -tagsfromfile %d%f.jpg "-userdata:gpscoordinates<gpsposition" DIR

I'll keep that in mind when copying GPS from an image to a movie. This works fine (Apple devices and Google Photos use Keys):

exiftool -m -P -n -overwrite_original_in_place -ext mp4 -TagsFromFile %d%f.jpg '-Keys:GPSCoordinates<Composite:GPSPosition' .
Is it possible to copy also 'GPS:GPSAltitude' from a .jpg to a .mp4? I tried the following and other variations with and without -n but they fail to copy also altitude to a .mp4:

exiftool -m -P -n -overwrite_original_in_place -ext mp4 -TagsFromFile %d%f.jpg '-Keys:GPSCoordinates<Composite:GPS*' .

exiftool -m -P -overwrite_original_in_place -ext mp4 -TagsFromFile %d%f.jpg '-Keys:GPSCoordinates<GPS:GPSAltitude' .

Warning: Error converting value for Keys:GPSCoordinates (ValueConvInv)

But either of these manual commands work:

exiftool -m -P -n -overwrite_original_in_place -Keys:GPSCoordinates='-36.6101 -66.91515 119.9' a.mp4

exiftool -m -P -overwrite_original_in_place -Keys:GPSCoordinates='-36.6101, -66.91515, 119.9' a.mp4

- Matti
Title: Re: Copy a pic [Composite]GPSPosition and write it in a mp4 [Userdata]GPSCoordinates
Post by: Phil Harvey on November 18, 2022, 12:22:14 PM
You could do this:

exiftool -tagsfromfile %d%f.jpg '-keys:gpscoordinates<$gpslatitude, $gpslongitude, $gpsaltitude' FILE

- Phil
Title: Re: Copy a pic [Composite]GPSPosition and write it in a mp4 [Userdata]GPSCoordinates
Post by: wywh on November 18, 2022, 02:30:49 PM
Quote from: Phil Harvey on November 18, 2022, 12:22:14 PMYou could do this

Thanks! This works also for altitude:

exiftool -m -P -overwrite_original_in_place -ext mp4 -TagsFromFile %d%f.jpg '-Keys:GPSCoordinates<$GPSLatitude, $GPSLongitude, $GPSAltitude' .

exiftool -a -G1 -s -n -Location:All .

[Keys]          GPSCoordinates                  : -36.6101 -66.91515 119.9

- Matti