ExifTool Forum

General => Metadata => Topic started by: bjb on May 26, 2022, 09:12:55 AM

Title: GPS coordinates in MOV and MP4 files
Post by: bjb on May 26, 2022, 09:12:55 AM
I have a script that I wrote that uses HandBrakeCLI to convert files from .MOV to .MP4, but then also attempts to preserve various EXIF metadata by using exiftool by using the -TagsFromFile operation to copy tags from the older MOV to the newer MP4 (and then a subsequent additional run for -FileModifyDate<CreateDate). The reason for this is that I can get a good savings in disk storage doing this while also maintaining quality of the video, but I also want to make sure that I am preserving all the metadata.

While everything seems to work and the EXIF tags appear in the output MP4, when I import the MP4 into the Mac's Photos.app I don't see any information about location, or the iPhone model that I captured the video with. The original MOV's metadata is recognized, however.

If I use exiftool to view the metadata of the original MOV and resulting MP4 I do see that the MOV only has 5 GPS-related items (Coordinates, Altitude, Alt. Ref, Latitude, Longitude, Position) while the MP4 has the same but multiple copies of all except 'Position'. Additionally, I can see that the MOV has 'Model' for iPhone, but the MP4 has 'Model' and 'Camera Model Name' both referencing the iPhone.

Despite this plethora of data, Photos.app says it doesn't know what camera took the video nor does it know what GPS location the video was taken.

Does anyone have any insight on this? Is it because it is an MP4 and not a MOV? I'm assuming that Photos.app is getting camera/GPS from the EXIF data in the first place, so why doesn't it recognize it from the MP4? I'm not completely sure why the (say) GPS coordinates are multiplied when exiftool copied things, but also not sure if there is a proper name/format/placement for various EXIF tags.

Thank you!
Title: Re: GPS coordinates in MOV and MP4 files
Post by: StarGeek on May 26, 2022, 10:34:27 AM
Exiftool will copy all the data it can as long as you use
exiftool -TagsFromFile file.mov -All:All file.mp4

This will copy data from the original to the exact same location in the target.  But there are a bunch of things to take note of.

First, Apple products are very picky about reading the data and don't always follow the Quicktime standards (which they created).  And to add to the problem, there are tags with the same name in different Quicktime group 2 families (ItemList, Keys, and UserData).  This is why you need to use -All:All.

Second, you are going to lose data.  There is no option on this.  Videos do not have a standard for including EXIF data and GPS tracks, but camera manufacturers shoe horn this data into the files in non-standard ways.  And, of course, each company does it in a different way.  So when you make a new file, you are going to lose all that data.
Title: Re: GPS coordinates in MOV and MP4 files
Post by: bjb on May 26, 2022, 01:05:16 PM
I was using the -TagsFromFile, but not the -All:All.

After adding the "All" option, that seemed to do the trick! Thank you!
Title: Re: GPS coordinates in MOV and MP4 files
Post by: StarGeek on May 26, 2022, 05:12:23 PM
Without -All:All, exiftool will copy tags to the preferred locations, which may not be the original locations.  FAQ #9 (https://exiftool.org/faq.html#Q9) covers most of this but in the case of videos, you would also check the second paragraph on the Quicktime tags page (https://exiftool.org/TagNames/QuickTime.html).