Adding GPS data to movie files.

Started by Gusman, September 29, 2019, 08:04:32 AM

Previous topic - Next topic

Gusman

Hi all
Yes I am a total newbie on this sight so relegate me to the Newbie section if need be. But I've search the site and only found one relevant topic which wasn't resolved and that was back in 2016.
I want to embed mainly GPS data and Keywords but if possible Title and Author to all my movie files so that the apps I use to view, such as Aperture and Apple Photos recognises and displays in the info field. I have three main devices for video, my iPhone, Panasonic Lumix camera and a GoPro. The latter two give me .mp4 files. Whilst the iPhone .Mov.  Most of the time the iPhone includes GPS info which shows in the location pane in the Photos app. But sometimes it's missing.
Can someone give me a idiots guide to add this to the files if it is possible. I'm thinking it must be possible as Apple adds it the .Mov file.
I'm also aware that .Mp4 and .Mov have different fields so I'm assuming there would be a different terminal line for each. And also different for GPS and for Keywords.

For photos I use the Exif Editor app and this works well for my for my basic requirements but it doesn't work on video files and there doesn't seem to an app that does.

Many thanks

StarGeek

The ability for exiftool to write to MP4/Mov files is still relatively new, but the basic procedure is the same as any of the examples you'll find throughout the site,
exiftool -TAG1=DATA -TAG2=DATA ... <FileOrDir>

The thing is that we can't tell you exactly how to add the data, as we may not have access to the programs you use.  For example, I'm on Windows and use mostly free programs, so I can't figure out what data Apature and Apple Photos is reading.

Luckily, the data you're talking about appears to have the same tag name as the tag description, which isn't always the case.  I'd suggest trying a command along these lines and check to see if it works:
exiftool -Quicktime:Keywords='Keyword 1' -Quicktime:Keywords='Keyword 2' -Quicktime:Author='Author Name' -Quicktime:Title=Title <File>

If that doesn't work, then you'll have to find a file that already works and follow the instructions in FAQ #3 to figure out the correct tag name for that data you want to add.

In regards to GPS coordinates, I'd suggest waiting until the next version of exiftool comes out, which should be soon.  There's a currently a problem with the way exiftool writes the coordinates and Apple Photos doesn't read them.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Gusman

Thanks for your reply!
Ok so it may be the version of exiftool, which could explain other issues.
At the moment I'm talking with the creator of Setexifdata who's app is the closest tool I've found to achieve this. Currently the app writes the coordinates into the file. But it  doesn't show. I thought it was the section the coordinates were in, currently being populated in the XMP section. But when you look at iPhone file the coordinates are in the Composite section. I thought it something as simple as just changing the location.
I'll send a link of this thread to him to see if this may shed a better light on this.

Many thanks

Phil Harvey

The Composite section is likely generating GPSLatitude/GPSLongitude tags from the QuickTime GPSCoordinates (probably stored in the Keys group if this is an Apple device).

BTW, ExifTool 11.66 is now available, and fixes a format problem when writing QuickTime GPSCoordinates.

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

Gusman

Hi all, back again
So I thought I'd have a play using your example above. As said I'm a total newbie but I like a challenge. My understanding was you could drag in any file you would like to  edit which I have done in below example, I also typed in file name but nothing is working. Any pointers would be very much appreciated.

thanks


Phil Harvey

You need to put a SPACE in the command before you drag and drop the file.

So type this in a Terminal window:

exiftool -quicktime:keywords='Egypt'

then press the SPACE bar.

then drag and drop the file.

then press RETURN.

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

Gusman

Thanks Phil
That worked which is the good news. The bad is it created new file. That wouldn't be to bad except the creation and modify date on this file are totally out of sync. The original file was turned into a document which I managed to change back by deleting the 'original' at the end of the file.

Phil Harvey

The "_original" file is for backup purposes.  You can add -P to the command to preserve the file modify date, but if you want to preserve the creation date the only option on Mac is -overwrite_original_in_place, but then no backup is saved.

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

Gusman

Ok I'll try that on an old file I'm not worried about. Would this be placed at the end of the code?
With regards to the keywords command do I have to repeat code for each keyword as above or can I group words?
I'll leave you alone now and will have a play myself.
Many thanks

StarGeek

Quote from: Gusman on September 30, 2019, 02:04:25 PM
Ok I'll try that on an old file I'm not worried about. Would this be placed at the end of the code?

That would be easiest, but for the most part, it can go anywhere except between an option that requires a second parameter.

QuoteWith regards to the keywords command do I have to repeat code for each keyword as above or can I group words?

Upon further checking, I may be wrong with regards to keywords, as doesn't appear to be a list type tag as keywords are in image files.  I'm not sure how your programs handle them.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Gusman

Hi all
Thanks for you help so far.
I've had a good play around and got some positive results. At the bottom in red is the last test I did and results are mixed but good in general.
For GPS my viewing apps, iPhoto/Aperture picked up the location and displayed. Unfortunately Photos didn't, but you did highlight this previously. It was also picked up on another third party app so I'm reasonably happy this result is good and its Apple Photos that is the issue.
Keywords also worked but the issue reversed. Apple Photos picked up the keywords but iPhoto/Aperture didn't. I prefer this result as Photos will be my main viewer and Keywords will be my main search option.
However is there a keywords option in another section such as EXIF or XMP? Is there a definitive list to useable fields I could refer to rather than testing in a command line and waiting to see if it works?

Phil, I did come across some issues which quite possibly is me but thought I'd highlight anyway.
While testing GPS, if I tried to input in the degrees/min/sec format it would change the 51 to 57 is this a bug? I only tried one set of coordinates so can't comment further as it was easier in decimal for me anyway.

For the commands in green, this issue is strange because it would never execute on the first input, I would have to input again for it to work? Should this happen or is it me?

The command in blue but also above in green. The keyword part of the command would include the file path as a keyword also. I tried more spaces and closing the keywords with a comma but nothing worked. It only worked in the last example in red.

Lastly I couldn't get the 'overwrite_original_in_place' to work as you can see in my last command, your guidance would be most appreciated  :)

Last login: Tue Oct  1 00:02:02 on ttys000
Waynes-iMac:~ wayneegee$ exiftool -Quicktime:GPSCoordinates=51.634597,0.606939 -Quicktime:Keywords='Egypt' /Users/wayneegee/Desktop/Exiftool\ test/P1220568.MP4
> exiftool -Quicktime:GPSCoordinates=51.634597,0.606939 -Quicktime:Keywords='Egypt' /Users/wayneegee/Desktop/Exiftool\ test/P1220568.MP4
    1 image files updated

Waynes-iMac:~ wayneegee$ exiftool -Quicktime:Keywords='Egypt' /Users/wayneegee/Desktop/Exiftool\ test/P1220567.MP4
> exiftool -Quicktime:Keywords='Egypt' /Users/wayneegee/Desktop/Exiftool\ test/P1220567.MP4
    1 image files updated

Waynes-iMac:~ wayneegee$ exiftool -Quicktime:Keywords='House,Movie, /Users/wayneegee/Desktop/Exiftool\ test/P1220566.MP4
> exiftool -Quicktime:Keywords='House,Movie, /Users/wayneegee/Desktop/Exiftool\ test/P1220566.MP4
    1 image files updated

Waynes-iMac:~ wayneegee$ exiftool -Quicktime:GPSCoordinates=51.634597,0.606939 -Quicktime:Keywords='House, Movie, Test overwrite_original_in_place /Users/wayneegee/Desktop/Exiftool\ test/P1220568.MP4
Error: File not found - Movie,
Error: File not found - Test
Error: File not found - overwrite_original_in_place
    1 image files updated
    3 files weren't updated due to errors
Waynes-iMac:~ wayneegee$ exiftool -Quicktime:GPSCoordinates=51.634597,0.606939 -Quicktime:Keywords=House,Movie,Test  overwrite_original_in_place /Users/wayneegee/Desktop/Exiftool\ test/P1220567.MP4
Error: File not found - overwrite_original_in_place
    1 image files updated
    1 files weren't updated due to errors

Waynes-iMac:~ wayneegee$


Phil Harvey

Quote from: Gusman on October 01, 2019, 07:20:11 AM
While testing GPS, if I tried to input in the degrees/min/sec format it would change the 51 to 57 is this a bug? I only tried one set of coordinates so can't comment further as it was easier in decimal for me anyway.

Works for me (Note I had to remove the seconds double-quote because it would interfere with the overall quoting):

> exiftool -gpscoordinates="3 deg 30' 0.00sec, 5 deg 36' 0.00sec" a.mov
    1 image files updated
> exiftool -gpscoordinates -gpscoordinates# a.mov
GPS Coordinates                 : 3 deg 30' 0.00" N, 5 deg 36' 0.00" E
GPS Coordinates                 : 3.5 5.6


As for the other problems, your quotes are funny and will cause problems.  Make sure you use plain single quotes ('), not funny slanted quotes as you used (eg. 'Egypt').

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

Gusman

I've only got one quote button on my keyboard? ' or " with shift. 'Test'  :-\
What are your thoughts on the overwrite issue?

Gusman

Actually as to my last test line I didn't use any quote and all worked ok except the overwrite command. Excuse my ignorance but what function do the quotes perform?

Phil Harvey

The quotes are only necessary if the argument contains special characters such as SPACE, >, < or other quotes.

This stack exchange topic explains about your quote problem.

Your problem with the overwrite is that you forgot the dash before the option: -overwrite_original_in_place

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