I have no clue: simplest command not working

Started by johnsko, June 15, 2023, 07:27:16 PM

Previous topic - Next topic

johnsko

I am trying what I think is a very simple command to change the value of one tag without success.  Suspecting it might be due to OneDrive, I copied file to a local directory but got similar results.  (The difference was the instead of editing the existing file, it created a second file (and renamed first with "mp4_original" extension).  However the tag data was unchanged in both files.


C:\Users\johns\OneDrive\_Albums\Americas\Brazil 2023-06-05\Video>exiftool -GPSLatitude=-17.275756 20230604_072715.mp4
    1 image files updated

C:\Users\johns\OneDrive\_Albums\Americas\Brazil 2023-06-05\Video>exiftool -n -GPSLatitude 20230604_072715.mp4
GPS Latitude                    : -17.2931


StarGeek

You should be using the command in FAQ #3.  Odds are that there are multiple GPS tags in the file and depending upon the group they are in, they may not be editable.

Depending upon the camera, the GPSLatitude might be in the EXIF block.  But because EXIF is non-standard in video files, exiftool may not be able to edit it.  Additionally, even if exiftool can edit the EXIF:GPSLatitude tag, you are not editing the EXIF:GPSLatitudeRef tag which contains the reference direction. The EXIF:GPSLatitude cannot hold a negative number and the North (positive)/South (negative) direction is read from the EXIF:GPSLatitudeRef.

The most likely place that exiftool is reading GPS coordinates from in a video file is the Quicktime:GPSCoordinates tag.  This tag will contain both the Latitude and Longitude, including the reference direction, in a single tag.  But this is further complicated by the fact that the GPSCoordinates can appear in three different Quicktime subgroups, Keys:GPSCoordinates, ItemList:GPSCoordinates, or UserData:GPSCoordinates.

The command in FAQ 3 will show you any tags with duplicate names and the actual locations they belong too.  When you don't include the -a (-duplicates) option and the -G (-groupNames) option, the only result exiftool will show you is the Composite:GPSLatitude tag, which is a tag exiftool creates on the fly by reading any of the above listed tags, whichever one appears last in the file.

On the other hand, the command you are using to write the GPSLatitude is almost certainly being written to yet another GPS location, XMP:GPSLatitude.

Quote from: johnsko on June 15, 2023, 07:27:16 PM(The difference was the instead of editing the existing file, it created a second file (and renamed first with "mp4_original" extension).

Exiftool never directly edits a file in place.  It always creates a new file, and renames the original.  From the docs
QuoteBy default the original files are preserved with _original appended to their names -- be sure to verify that the new files are OK before erasing the originals.

The backup files can be suppressed by adding the -overwrite_original option.
* 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).

Martin Z

Hi John, building on what @StarGeek was saying, as there are multiple groups of tags EXIF, XMP, QuickTime, etc tags are often duplicated and the same data ends up being stored in multiple places in the file. A tip that I sometimes overlook myself, is the value is just getting a plain read out from EXIFTool of all the data in the file (which is doubly-ironic for me, as despite all I've learnt it's the simplest EXIFtool command possible)...

> EXIFtool 20230604_072715.mp4
> EXIFtool -s 20230604_072715.mp4  <-- If you prefer tag names

So, for example to check all the places your GPS data might be hiding, you can do...
> EXIFtool -s 20230604_072715.mp4 | findstr /c:GPS
GPSCoordinates : 67 deg 34' 10.52" N, 5 deg 7' 27.22" W
GPSLatitude    : 67 deg 34' 10.52" N
GPSLongitude   : 5 deg 7' 27.22" W
GPSPosition    : 67 deg 34' 10.52" N, 5 deg 7' 27.22" W



PS: I'm a relatively new EXIFtool / forum user myself and I definitely relate to what it's like when a new tool doesn't work like you expect and the learning curve just seems so steep, but have to say the forum team here is great and have learnt so much thanks to people like @StarGeek and @Phil, just keep playing with EXIFtool and ask when you get stuck, and it will start to click into place sooner than you might think 👍🏼

johnsko

This is a powerful but complex tool and I am quite thankful to @Stargeek and Martin Z and Phil for the tool and help how to use it.  I waited until I had adequate time to devote to reading and experimenting--which I should have done first.  Happy to report that I learned and resovled a few (very basic) things.

As recommended in FAQ 3, exiftool -a -G1 -s filename.ext does did indeed help me understand a lot.  As predicted there was GPS data in the Quicktime UserData subgroup. My initial attempt resulted in inserting GPS data into XMP-exif, also as predicted.

exiftool -a -g "-gps*" filename.mp4 helped me see only what I needed with explicit group name.

exiftool -UserData:GPSCoordinates="value" filename.txt completed my task as desired and I was able to confirm by seeing the coordinates I had entered as signed decimal degrees converted upon retrieval to directional DMS.

A minor note (probably known): exiftool saves newbies like me from mistakes by preserving an untouched file with _original appended to the extension.  However, it appears that during subsquent editing efforts on the same file a new _original is created, overwriting the first one, rather than creating an _original(2).

THANKS MUCH!

wywh

Quote from: StarGeek on June 15, 2023, 08:55:41 PMYou should be using the command in FAQ #3

Why something like 'exiftool -a -G1 -s' is not the default?

- Matti

StarGeek

A few reasons I can think of off hand.  Without the -s option, exiftool gives tag descriptions, which can be localized (see -lang option), unlike tag names.

I think most people just want to see what's in the file and don't want to deal with all the complex details of metadata. These people will probably never come to the forums to ask questions. The trouble here is that they get a glimpse and make assumptions about what they see.

And then there's the legacy aspect.  Making a change to force the FAQ #3 command after all these years will probably break innumerable scripts and workflows.
* 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).