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.
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 ...
I used ffmpeg to compress and exiftool to re-tag, following
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
I suggest using the excellent exiftool by Phil Harvey:
exiftool -TagsFromFile fromImage.jpg toImage.jpg
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):
to.MOV (no address/location showed!):
Apparently, something is missing, so after compression the location cannot be presented.
- What should I do to let my iPhone show where the compressed video's original file was taken?
- Is there a way to copy and overwrite all metadata? Is it possible to make the metadata identical?
- 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?
In this appendix, I list the date/time and GPS related metadata of the original and compressed videos.
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
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).