1

This is a long standing practical problem (more than one year). I always want to finish it, but every time I tried I failed. I have consulted several threads for it.

I have a bunch of daily-life videos, and I am making more with my iphone. Before my macbook get filled up with the videos, I'd really want to compress and organize them in a clean and systematic way.

TL;DR

Object: I want to compress my videos without losing metadata, or at least keeping the minimum amount of metadata so my iPhone can present the videos with when and where they were taken.

Obstructions: Exiftool's "-tagsfromfile" does not copy and overwrite the metadata completely. I have even tried some variations: -all, -all:all, −overwrite_original ...


Background

I used ffmpeg to compress and exiftool to re-tag, following

How can I reduce a video's size with ffmpeg?

See this answer. Quoted below for convenience:

ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4

However, compression by ffmpeg kills almost all metadata, so I turned to exiftool by

Can EXIF data be copied completely from one image to another?

I suggest using the excellent exiftool by Phil Harvey:

exiftool -TagsFromFile fromImage.jpg toImage.jpg

Problem

The main problem is while -TagsFromFile does copy/overwrite some metadata, it does not do it completely, at least for my videos. I have also tried

exiftool −overwrite_original -r -TagsFromFile from.MOV -all to.MOV

and some other varieties e.g. replacing -all to -all:all, but nothing works.

Perhaps the most I care are the tags -CreationDate and -GPS (see Appendix) because I want to keep track of when and where my photos and videos were taken, and because I want those data to at least be presented in my iPhone.

Here are the previews of the videos from.MOV (original) and to.MOV (compressed) in my iPhone.

from.MOV (location hidden):

enter image description here

to.MOV (no address/location showed!):

enter image description here

Apparently, something is missing, so after compression the location cannot be presented.


Questions

  1. What should I do to let my iPhone show where the compressed video's original file was taken?
  2. Is there a way to copy and overwrite all metadata? Is it possible to make the metadata identical?
  3. Side question: When I was playing around with exiftool's -TagsFromFile function, I used it to try to overwrite the metadata of an image to another (both taken by iPhone). However, this case was worse than the videos' case: not only the location was not overwritten, nor the time! Again, I have tried some varieties replacing -all to -all:all. So is there a way to fix this?

Appendix

In this appendix, I list the date/time and GPS related metadata of the original and compressed videos.

from.MOV (original):

File Size                       : 2.9 MB
File Modification Date/Time     : 2018:05:16 05:50:36-05:00
File Access Date/Time           : 2018:05:16 07:54:42-05:00
File Inode Change Date/Time     : 2018:05:16 07:51:58-05:00
File Permissions                : rw-r--r--
File Type                       : MOV
Create Date                     : 2018:05:16 10:50:36
Modify Date                     : 2018:05:16 10:50:38
Track Create Date               : 2018:05:16 10:50:36
Track Modify Date               : 2018:05:16 10:50:38
Creation Date                   : 2018:05:16 05:50:36-05:00
GPS Coordinates                 : xx deg yy' z.zz" N, aa deg bb' c.cc" W, 261.305 m Above Sea Level
GPS Altitude                    : 261.305 m
GPS Altitude Ref                : Above Sea Level
GPS Latitude                    : xx deg yy' z.zz" N
GPS Longitude                   : aa deg bb' c.cc" W
GPS Position                    : xx deg yy' z,zz" N, aa deg bb' c.cc" W

to.MOV (compressed):

File Size                       : 194 kB
File Modification Date/Time     : 2018:05:16 07:54:42-05:00
File Access Date/Time           : 2018:05:16 07:54:57-05:00
File Inode Change Date/Time     : 2018:05:16 07:54:42-05:00
File Permissions                : rw-r--r--
File Type                       : MOV
Creation Date                   : 2018:05:16 05:50:36-05:00
Track Create Date               : 2018:05:16 10:50:36
Track Modify Date               : 2018:05:16 10:50:38
Media Create Date               : 2018:05:16 10:50:36
Media Modify Date               : 2018:05:16 10:50:38
Creation Date                   : 2018:05:16 05:50:36-05:00
Create Date                     : 2018:05:16 10:50:36
Modify Date                     : 2018:05:16 10:50:38
GPS Altitude Ref                : Above Sea Level
GPS Latitude                    : xx deg yy' z.zz" N
GPS Longitude                   : aa deg bb' c.cc" W
GPS Altitude                    : 261.3 m Above Sea Level
GPS Latitude Ref                : North
GPS Longitude Ref               : West
GPS Position                    : xx deg yy' z.zz" N, aa deg bb' c.cc" W

(I have changed the location into xyzabc just for privacy :P)

As you can see, not only are the date/time slightly different, but there even are more redundant new tags. Probably the thing that concerns me the most is that the tag -GPS Coordinates is not copied from from.MOV to to.MOV. Though the essential information has been copied, I guess that might be the reason why my iphone does not show its location. Thus this leads to my second question (above).


1
  • Unfortunately no answer, but it seems to be related/identical as this bug: trac.ffmpeg.org/ticket/4209 I'm also looking for the solution to this. It could be a namespace / naming issue of the metadata in the file.
    – Tim
    Nov 6, 2019 at 19:13

1 Answer 1

1

Not a solution but a work-around using https://www.bento4.com from https://trac.ffmpeg.org/ticket/6193#comment:6

ffmpeg -i source.mov converted.mp4
mp4extract moov/meta source.mov source-metadata
mp4edit --insert moov:source-metadata converted.mp4 converted-withmeta.mp4

hope this helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .