Copy a pic [Composite]GPSPosition and write it in a mp4 [Userdata]GPSCoordinates

Started by FabienCC, October 31, 2022, 01:01:39 PM

Previous topic - Next topic

FabienCC

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.

Phil Harvey

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
...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 ($).

FabienCC

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 ?

StarGeek

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


To copy tags, you would use the -TagsFromFile option.

exiftool -TagsFromFile /A/Source.jpg -gps* /path/to/B/
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

wywh

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

Phil Harvey

You could do this:

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

- 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 ($).

wywh

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