Help Needed When Copy Location-related Metadata from HEIC Image to MOV Video

Started by syspongemouse, April 06, 2023, 10:59:02 AM

Previous topic - Next topic

syspongemouse

Hello:

Firstly, my thanks to the developer for making ExifTool!

I recently started to use ExifTool for the need to copy Location-related Metadata from images I took with my iPhone to those taken with a Canon camera which does not have a GPS built-in, I can then upload those modified images to Apple Photos so I can see all my images taken at a place by simply find the place on the map. I finally have a working script to do that — copy location-related metadata from HEIC images to JPG images.

But I kept failing when I want to do the same with mov videos. I viewed all metadata from a mov file whose location-related metadata would be recognized by Apple Photos, I read the data from the HEIC image (concatenated when needed based on the format) and wrote those data to the mov file, but it still wouldn't be recognized by Apple Photos. And the date time is shifted to 8 hrs later (I'm in GMT+8).

Does anyone have any idea why this would happen? Any help will be appreciated!

StarGeek

Quote from: syspongemouse on April 06, 2023, 10:59:02 AMI read the data from the HEIC image (concatenated when needed based on the format) and wrote those data to the mov file, but it still wouldn't be recognized by Apple Photos.

What is the command you are using to do this?

QuoteAnd the date time is shifted to 8 hrs later (I'm in GMT+8).

Image time stamps are local time while the most important video time stamps are UTC

My standard copy/paste regarding video time stamps
Most video time stamps are supposed to be set to UTC and the program is supposed to adjust this to the local time zone when displayed (see 4th paragraph on the Quicktime tags page), with the most common exceptions being the Quicktime:CreationDate (not to be confused with the Quicktime:CreateDate) and the Quicktime:DateTimeOriginal.

If your computer is in the same time zone as where the video was shot, ignoring differences for Daylight/Summer time, then you can add the -api QuickTimeUTC option and exiftool will automatically adjust the time to UTC.  Otherwise, you either have to figure out the UTC yourself or use this -api option and include the correct time zone, e.g. "2023:02:03 04:05:06±07:00".
"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

syspongemouse

Thanks for your reply!

Quote from: StarGeek on April 06, 2023, 11:06:18 AMWhat is the command you are using to do this?
The following is a part of my code I have right now, where `nearest_file_a` is the source HEIC file and `file_b` is the target mov file and I added `-api QuickTimeUTC` but Apple Photos still says that it's taken 8 hrs later:
   
    lat_ref=$(exiftool -s3 -GPSLatitudeRef "$nearest_file_a")
    lat=$(exiftool -s3 -GPSLatitude "$nearest_file_a")
    lon_ref=$(exiftool -s3 -GPSLongitudeRef "$nearest_file_a")
    lon=$(exiftool -s3 -GPSLongitude "$nearest_file_a")
    pos=$(exiftool -s3 -GPSPosition "$nearest_file_a")
    alt=$(exiftool -s3 -GPSAltitude "$nearest_file_a")

    exiftool -api QuickTimeUTC -GPSLatitude="$lat" -GPSLongitude="$lon" -GPSPosition="$pos" -GPSCoordinates="{$pos}, {$alt}" "$file_b"

This is the exif output from the modified file after executing the code above:

[ExifTool]      ExifToolVersion                 : 12.42
[System]        FileName                        : MVI_4174 2.MOV
[System]        Directory                       : /Users/my/Desktop/1
[System]        FileSize                        : 110 MB
[System]        FileModifyDate                  : 2023:04:06 23:35:02+08:00
[System]        FileAccessDate                  : 2023:04:06 23:35:02+08:00
[System]        FileInodeChangeDate             : 2023:04:06 23:35:02+08:00
[System]        FilePermissions                 : -rwxrwxrwx
[File]          FileType                        : MOV
[File]          FileTypeExtension               : mov
[File]          MIMEType                        : video/quicktime
[File]          ExifByteOrder                   : Little-endian (Intel, II)
[File]          ImageWidth                      : 160
[File]          ImageHeight                     : 120
[File]          EncodingProcess                 : Baseline DCT, Huffman coding
[File]          BitsPerSample                   : 8
[File]          ColorComponents                 : 3
[File]          YCbCrSubSampling                : YCbCr4:2:2 (2 1)
[QuickTime]     MajorBrand                      : Apple QuickTime (.MOV/QT)
[QuickTime]     MinorVersion                    : 2007.9.0
[QuickTime]     CompatibleBrands                : qt  , CAEP
[QuickTime]     HandlerType                     : Metadata
[QuickTime]     MovieHeaderVersion              : 0
[QuickTime]     CreateDate                      : 2023:03:15 15:19:38
[QuickTime]     ModifyDate                      : 2023:03:15 15:19:38
[QuickTime]     TimeScale                       : 25000
[QuickTime]     Duration                        : 19.60 s
[QuickTime]     PreferredRate                   : 1
[QuickTime]     PreferredVolume                 : 100.00%
[QuickTime]     MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[QuickTime]     PreviewTime                     : 0 s
[QuickTime]     PreviewDuration                 : 0 s
[QuickTime]     PosterTime                      : 0 s
[QuickTime]     SelectionTime                   : 0 s
[QuickTime]     SelectionDuration               : 0 s
[QuickTime]     CurrentTime                     : 0 s
[QuickTime]     NextTrackID                     : 3
[QuickTime]     MediaDataSize                   : 110031824
[QuickTime]     MediaDataOffset                 : 136048
[UserData]      CompressorVersion               : CanonAVC0005
[IFD0]          Make                            : Canon
[IFD0]          Model                           : Canon EOS 600D
[IFD0]          Orientation                     : Horizontal (normal)
[IFD0]          XResolution                     : 72
[IFD0]          YResolution                     : 72
[IFD0]          ResolutionUnit                  : inches
[IFD0]          ModifyDate                      : 2023:03:15 15:19:39
[IFD0]          Artist                          :
[IFD0]          YCbCrPositioning                : Co-sited
[IFD0]          Copyright                       :
[ExifIFD]       ExposureTime                    : undef
[ExifIFD]       FNumber                         : undef
[ExifIFD]       ExposureProgram                 : Program AE
[ExifIFD]       ISO                             : 0
[ExifIFD]       SensitivityType                 : Recommended Exposure Index
[ExifIFD]       RecommendedExposureIndex        : 0
[ExifIFD]       ExifVersion                     : 0230
[ExifIFD]       DateTimeOriginal                : 2023:03:15 15:19:39
[ExifIFD]       CreateDate                      : 2023:03:15 15:19:39
[ExifIFD]       ComponentsConfiguration         : Y, Cb, Cr, -
[ExifIFD]       ShutterSpeedValue               : 0
[ExifIFD]       ApertureValue                   : 36.4
[ExifIFD]       ExposureCompensation            : 0
[ExifIFD]       MeteringMode                    : Center-weighted average
[ExifIFD]       Flash                           : Off, Did not fire
[ExifIFD]       FocalLength                     : 155.0 mm
[ExifIFD]       UserComment                     :
[ExifIFD]       SubSecTime                      : 01
[ExifIFD]       SubSecTimeOriginal              : 01
[ExifIFD]       SubSecTimeDigitized             : 01
[ExifIFD]       FlashpixVersion                 : 0100
[ExifIFD]       ColorSpace                      : sRGB
[ExifIFD]       ExifImageWidth                  : 160
[ExifIFD]       ExifImageHeight                 : 120
[ExifIFD]       FocalPlaneXResolution           : 176.7955801
[ExifIFD]       FocalPlaneYResolution           : 201.6806723
[ExifIFD]       FocalPlaneResolutionUnit        : inches
[ExifIFD]       CustomRendered                  : Normal
[ExifIFD]       ExposureMode                    : Auto
[ExifIFD]       WhiteBalance                    : Auto
[ExifIFD]       SceneCaptureType                : Standard
[ExifIFD]       OwnerName                       :
[ExifIFD]       SerialNumber                    : 323076144095
[ExifIFD]       LensInfo                        : 75-300mm f/?
[ExifIFD]       LensModel                       : EF75-300mm f/4-5.6
[ExifIFD]       LensSerialNumber                : 0000000000
[Canon]         MacroMode                       : Normal
[Canon]         SelfTimer                       : Off
[Canon]         Quality                         : n/a
[Canon]         CanonFlashMode                  : n/a
[Canon]         ContinuousDrive                 : Movie
[Canon]         FocusMode                       : One-shot AF
[Canon]         RecordMode                      : MOV
[Canon]         CanonImageSize                  : 1920x1080 Movie
[Canon]         EasyMode                        : Manual
[Canon]         DigitalZoom                     : None
[Canon]         Contrast                        : Normal
[Canon]         Saturation                      : Normal
[Canon]         CameraISO                       : Auto
[Canon]         MeteringMode                    : Center-weighted average
[Canon]         FocusRange                      : Not Known
[Canon]         CanonExposureMode               : Program AE
[Canon]         LensType                        : Canon EF 75-300mm f/4-5.6
[Canon]         MaxFocalLength                  : 300 mm
[Canon]         MinFocalLength                  : 75 mm
[Canon]         FocalUnits                      : 1/mm
[Canon]         MaxAperture                     : 4.8
[Canon]         MinAperture                     : 36
[Canon]         FlashActivity                   : 0
[Canon]         FlashBits                       : (none)
[Canon]         ZoomSourceWidth                 : 0
[Canon]         ZoomTargetWidth                 : 0
[Canon]         ManualFlashOutput               : n/a
[Canon]         ColorTone                       : Normal
[Canon]         FocalLength                     : 155 mm
[Canon]         AutoISO                         : 100
[Canon]         MeasuredEV                      : 12.88
[Canon]         TargetExposureTime              : 1
[Canon]         ExposureCompensation            : 0
[Canon]         WhiteBalance                    : Auto
[Canon]         SlowShutter                     : None
[Canon]         SequenceNumber                  : 0
[Canon]         OpticalZoomCode                 : n/a
[Canon]         CameraTemperature               : 31 C
[Canon]         FlashGuideNumber                : 0
[Canon]         FlashExposureComp               : 0
[Canon]         AutoExposureBracketing          : Off
[Canon]         AEBBracketValue                 : 0
[Canon]         ControlMode                     : Camera Local Control
[Canon]         MeasuredEV2                     : 13
[Canon]         BulbDuration                    : 0
[Canon]         CameraType                      : EOS High-end
[Canon]         NDFilter                        : n/a
[Canon]         CanonImageType                  : MVI:Canon EOS 600D
[Canon]         CanonFirmwareVersion            : Firmware Version 1.0.2
[Canon]         OwnerName                       :
[Canon]         CanonModelID                    : EOS Rebel T3i / 600D / Kiss X5
[Canon]         FrameCount                      : 490
[Canon]         FrameCount                      : 490
[Canon]         FrameRate                       : 25
[Canon]         Duration                        : 19.60 s
[Canon]         AudioBitrate                    : 1.54 Mbps
[Canon]         AudioSampleRate                 : 48000
[Canon]         AudioChannels                   : 2
[Canon]         VideoCodec                      : avc1
[Canon]         ThumbnailImageValidArea         : 0 159 15 104
[Canon]         BracketMode                     : Off
[Canon]         BracketValue                    : 0
[Canon]         BracketShotNumber               : 0
[Canon]         RawJpgSize                      : Large
[Canon]         LongExposureNoiseReduction2     : Off
[Canon]         WBBracketMode                   : Off
[Canon]         WBBracketValueAB                : 0
[Canon]         WBBracketValueGM                : 0
[Canon]         LiveViewShooting                : On
[Canon]         ShutterMode                     : Mechanical
[Canon]         FlashExposureLock               : Off
[Canon]         LensModel                       : EF75-300mm f/4-5.6
[Canon]         InternalSerialNumber            : ZC2990746
[Canon]         CropLeftMargin                  : 0
[Canon]         CropRightMargin                 : 0
[Canon]         CropTopMargin                   : 0
[Canon]         CropBottomMargin                : 0
[Canon]         AspectRatio                     : 3:2
[Canon]         CroppedImageWidth               : 2592
[Canon]         CroppedImageHeight              : 1728
[Canon]         CroppedImageLeft                : 0
[Canon]         CroppedImageTop                 : 0
[Canon]         ToneCurve                       : Standard
[Canon]         Sharpness                       : 3
[Canon]         SharpnessFrequency              : n/a
[Canon]         SensorRedLevel                  : 0
[Canon]         SensorBlueLevel                 : 0
[Canon]         WhiteBalanceRed                 : 0
[Canon]         WhiteBalanceBlue                : 0
[Canon]         ColorTemperature                : 5200
[Canon]         PictureStyle                    : Auto
[Canon]         DigitalGain                     : 0
[Canon]         WBShiftAB                       : 0
[Canon]         WBShiftGM                       : 0
[Canon]         ColorSpace                      : sRGB
[Canon]         VRDOffset                       : 0
[Canon]         SensorWidth                     : 5344
[Canon]         SensorHeight                    : 3516
[Canon]         SensorLeftBorder                : 152
[Canon]         SensorTopBorder                 : 56
[Canon]         SensorRightBorder               : 5335
[Canon]         SensorBottomBorder              : 3511
[Canon]         BlackMaskLeftBorder             : 0
[Canon]         BlackMaskTopBorder              : 0
[Canon]         BlackMaskRightBorder            : 0
[Canon]         BlackMaskBottomBorder           : 0
[Canon]         PictureStyleUserDef             : Auto; Auto; Auto
[Canon]         PictureStylePC                  : None; None; None
[Canon]         CustomPictureStyleFileName      :
[Canon]         PeripheralIlluminationCorr      : Off
[Canon]         AutoLightingOptimizer           : Standard
[Canon]         ThumbnailImage                  : (Binary data 30712 bytes, use -b option to extract)
[CanonCustom]   ExposureLevelIncrements         : 1/3 Stop
[CanonCustom]   ISOExpansion                    : Off
[CanonCustom]   FlashSyncSpeedAv                : Auto
[CanonCustom]   LongExposureNoiseReduction      : Off
[CanonCustom]   HighISONoiseReduction           : Standard
[CanonCustom]   HighlightTonePriority           : Disable
[CanonCustom]   AFAssistBeam                    : Emits
[CanonCustom]   MirrorLockup                    : Disable
[CanonCustom]   Shutter-AELock                  : AF/AE lock
[CanonCustom]   SetButtonWhenShooting           : Normal (disabled)
[CanonCustom]   LCDDisplayAtPowerOn             : Display
[CanonCustom]   AddOriginalDecisionData         : Off
[InteropIFD]    InteropIndex                    : THM - DCF thumbnail file
[InteropIFD]    InteropVersion                  : 0100
[InteropIFD]    RelatedImageWidth               : 1920
[InteropIFD]    RelatedImageHeight              : 1080
[XMP-x]         XMPToolkit                      : Image::ExifTool 12.42
[XMP-exif]      GPSLatitude                     : 30 deg 15' 22.16" N
[XMP-exif]      GPSLongitude                    : 120 deg 9' 33.65" E
[ItemList]      GPSCoordinates                  : 30 deg 15' 22.16" N, 120 deg 9' 33.65" E, 14.9 m Above Sea Level
[Track1]        TrackHeaderVersion              : 0
[Track1]        TrackCreateDate                 : 2023:03:15 15:19:38
[Track1]        TrackModifyDate                 : 2023:03:15 15:19:38
[Track1]        TrackID                         : 1
[Track1]        TrackDuration                   : 19.60 s
[Track1]        TrackLayer                      : 0
[Track1]        TrackVolume                     : 0.00%
[Track1]        MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[Track1]        ImageWidth                      : 1920
[Track1]        ImageHeight                     : 1080
[Track1]        MediaHeaderVersion              : 0
[Track1]        MediaCreateDate                 : 2023:03:15 15:19:38
[Track1]        MediaModifyDate                 : 2023:03:15 15:19:38
[Track1]        MediaTimeScale                  : 25000
[Track1]        MediaDuration                   : 19.60 s
[Track1]        HandlerClass                    : Media Handler
[Track1]        HandlerType                     : Video Track
[Track1]        GraphicsMode                    : srcCopy
[Track1]        OpColor                         : 0 0 0
[Track1]        HandlerClass                    : Data Handler
[Track1]        HandlerType                     : Alias Data
[Track1]        CompressorID                    : avc1
[Track1]        SourceImageWidth                : 1920
[Track1]        SourceImageHeight               : 1080
[Track1]        XResolution                     : 72
[Track1]        YResolution                     : 72
[Track1]        BitDepth                        : 24
[Track1]        VideoFrameRate                  : 25
[Track2]        TrackHeaderVersion              : 0
[Track2]        TrackCreateDate                 : 2023:03:15 15:19:38
[Track2]        TrackModifyDate                 : 2023:03:15 15:19:38
[Track2]        TrackID                         : 2
[Track2]        TrackDuration                   : 19.60 s
[Track2]        TrackLayer                      : 0
[Track2]        TrackVolume                     : 100.00%
[Track2]        MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[Track2]        MediaHeaderVersion              : 0
[Track2]        MediaCreateDate                 : 2023:03:15 15:19:38
[Track2]        MediaModifyDate                 : 2023:03:15 15:19:38
[Track2]        MediaTimeScale                  : 48000
[Track2]        MediaDuration                   : 19.60 s
[Track2]        HandlerClass                    : Media Handler
[Track2]        HandlerType                     : Audio Track
[Track2]        Balance                         : 0
[Track2]        HandlerClass                    : Data Handler
[Track2]        HandlerType                     : Alias Data
[Track2]        AudioFormat                     : sowt
[Track2]        AudioChannels                   : 2
[Track2]        AudioBitsPerSample              : 16
[Track2]        AudioSampleRate                 : 48000
[Track2]        LayoutFlags                     : Stereo
[Track2]        AudioChannels                   : 2
[Composite]     DriveMode                       : Continuous Shooting
[Composite]     Lens                            : 75.0 - 300.0 mm
[Composite]     ShootingMode                    : Program AE
[Composite]     Aperture                        : undef
[Composite]     ImageSize                       : 1920x1080
[Composite]     LensID                          : Canon EF 75-300mm f/4-5.6
[Composite]     Megapixels                      : 2.1
[Composite]     ScaleFactor35efl                : 1.6
[Composite]     ShutterSpeed                    : undef
[Composite]     SubSecCreateDate                : 2023:03:15 15:19:39.01
[Composite]     SubSecDateTimeOriginal          : 2023:03:15 15:19:39.01
[Composite]     SubSecModifyDate                : 2023:03:15 15:19:39.01
[Composite]     AvgBitrate                      : 44.9 Mbps
[Composite]     GPSAltitude                     : 14.9 m
[Composite]     GPSAltitudeRef                  : Above Sea Level
[Composite]     GPSLatitude                     : 30 deg 15' 22.16" N
[Composite]     GPSLongitude                    : 120 deg 9' 33.65" E
[Composite]     Rotation                        : 0
[Composite]     GPSLatitudeRef                  : North
[Composite]     GPSLongitudeRef                 : East
[Composite]     Lens35efl                       : 75.0 - 300.0 mm (35 mm equivalent: 118.0 - 471.8 mm)
[Composite]     CircleOfConfusion               : 0.019 mm
[Composite]     FOV                             : 8.4 deg
[Composite]     FocalLength35efl                : 155.0 mm (35 mm equivalent: 243.8 mm)
[Composite]     GPSPosition                     : 30 deg 15' 22.16" N, 120 deg 9' 33.65" E
[Composite]     HyperfocalDistance              : Inf m

StarGeek

Your command doesn't edit any date/time tags, so the -api QuickTimeUTC won't do anything.  The Quicktime time stamps, Quicktime:CreateDate, Quicktime:ModifyDate, and track related tags all show the same time as the EXIF tags in the file.  They should be different.

The GPSPosition tag can be in three separate locations, so you might have to test each to see which one the app is reading.  Try setting ItemList:GPSPosition/UserData:GPSPosition/Keys:GPSPosition to see which one is actually read.
"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