I have compressed my videos from my old mobile phone using Handbrake. I want the new compressed videos to have the date of the originals in their metadata so I can move them to the DCIM folder of my Google Pixel 7 and have Google Photos sort them chronologically.
I have tried the following commands (being placed in the original videos folder):
exiftool "-AllDates<DateTimeOriginal" -overwrite_original_in_place C:\Users\angee\Videos\comprimidos
exiftool "-AllDates<DateTimeOriginal" -overwrite_original_in_place -P C:\Users\angee\Videos\comprimidos
exiftool -TagsFromFile C:\Users\angee\Videos\2022-2023 -FileCreateDate -FileModifyDate C:\Users\angee\Videos\comprimidos
exiftool "-createdate<filecreatedate" -P C:\Users\angee\Videos\comprimidos
None of this has worked. Some commands have not changed at all, others have made the creation date change to the current date at the time the command was executed.
Thank you very much in advance if anyone knows how to solve the problem. Sorry for my lack of knowledge.
This is such a common problem that I should make a FAQ for it.
You have to decide which date/times to set and where to copy them from.
First, run this command to list all date/time tags and their locations:
exiftool -a -G1 -s -time:all FILE
Then write your command to copy between the desired tags. Note that "System" tags are stored in the filesystem and not the file itself, so these may be written without editing the file. If you write any other tag (ie. real tags in the file), then the System date/time tags will get reset to the current date unless you also add the -P option.
The first problem will be to figure out what date/time information Google Photos uses, and write that.
I can't help you with a specific command because I don't know what O/S you are using or how your files are named.
- Phil
Result in my original video:
C:\Users\angee\Videos\2022-2023>exiftool -a -G1 -s -time:all VID20210810091349.mp4
[System] FileModifyDate : 2023:02:09 00:59:08+01:00
[System] FileAccessDate : 2023:02:15 15:08:13+01:00
[System] FileCreateDate : 2023:02:14 00:17:02+01:00
[QuickTime] CreateDate : 2021:08:10 07:13:55
[QuickTime] ModifyDate : 2021:08:10 07:13:55
[Track1] TrackCreateDate : 2021:08:10 07:13:55
[Track1] TrackModifyDate : 2021:08:10 07:13:55
[Track1] MediaCreateDate : 2021:08:10 07:13:55
[Track1] MediaModifyDate : 2021:08:10 07:13:55
[Track2] TrackCreateDate : 2021:08:10 07:13:55
[Track2] TrackModifyDate : 2021:08:10 07:13:55
[Track2] MediaCreateDate : 2021:08:10 07:13:55
[Track2] MediaModifyDate : 2021:08:10 07:13:55
Result in my compressed video (I want to edit):
C:\Users\angee\Videos\comprimidos>exiftool -a -G1 -s -time:all VID20210810091349.mp4
[System] FileModifyDate : 2023:02:14 22:58:49+01:00
[System] FileAccessDate : 2023:02:15 15:05:19+01:00
[System] FileCreateDate : 2023:02:14 20:31:50+01:00
[QuickTime] CreateDate : 2023:02:15 12:41:41
[QuickTime] ModifyDate : 2023:02:15 12:41:41
[Track1] TrackCreateDate : 2023:02:14 23:29:47
[Track1] TrackModifyDate : 2023:02:14 23:29:47
[Track1] MediaCreateDate : 2023:02:14 23:29:47
[Track1] MediaModifyDate : 2023:02:14 23:29:47
[Track2] TrackCreateDate : 2023:02:14 23:29:47
[Track2] TrackModifyDate : 2023:02:14 23:29:47
[Track2] MediaCreateDate : 2023:02:14 23:29:47
[Track2] MediaModifyDate : 2023:02:14 23:29:47
[UserData] DateTimeOriginal : 2023:02:15 12:41:41+01:00
[XMP-exif] DateTimeOriginal : 2023:02:15 12:41:41+01:00
[XMP-xmp] CreateDate : 2023:02:15 12:41:41+01:00
[XMP-xmp] ModifyDate : 2023:02:15 12:41:41+01:00
I have tried the following command but it still does not work:
exiftool "CreateDate" -overwrite_original_in_place -P C:\Users\angee\Videos\comprimidos
I have managed to edit the date of a single file with:
exiftool -tagsfromfile "C:\Users\angee\Videos\2022-2023\VID20210810091349.mp4" "-alldates<createdate" "C:\Users\angee\Videos\comprimidos\VID20210810091349.mp4"
I need to apply it to the whole directory, there are more than 1.5k videos.
You're just trying random things on a command line without understanding what you are doing. This is dangerous.
I think that a command something like this may be what you want:
exiftool -tagsfromfile C:\Users\angee\Videos\2022-2023\%f.%e "-all:all<time:all" -ext mp4 C:\Users\angee\Videos\comprimidos
- Phil
Thank you very much. It worked great!
Yes, I know it's dangerous, I've wrecked my ubuntu partition too many times.... I'm a poor novice and irresponsible engineer :/
- Ángel.
One thing to remember about recompressing your videos is that some metadata will be permanently lost. If there is actual EXIF data or a GPS track in the original, there is really no way to copy these over. This metadata is non-standard in video files and every company embeds it in different ways.
Quote from: Phil Harvey on February 15, 2023, 09:44:39 AM"-all:all<time:all"
I'll have to remember that one.
Quote from: StarGeek on February 15, 2023, 09:53:59 AMQuote from: Phil Harvey on February 15, 2023, 09:44:39 AM"-all:all<time:all"
I'll have to remember that one.
I checked the documentation on this because my memory isn't great. Yes, by default the family 1 group is preserved when writing with a destination group of "All" (independent of the group you specified for the source tag), but you can change this by adding a leading family number if you want:
If "All" is used as a [destination] group name, then the specified tag(s)
are written to the same family 1 group they had in the source file (ie. the
same specific location, like ExifIFD or XMP-dc). For example, the common
operation of copying all writable tags to the same specific locations in the
output FILE is achieved by adding "-all:all". A different family may be
specified by adding a leading family number to the group name (eg.
"-0all:all" preserves the same general location, like EXIF or XMP).
- Phil
I use macOS so YMMV. My memo to copy metadata to re-encoded iPhone and Canon movies:
Copy some 'Keys' from .mov to a same name .m4v in the same folder (I edit dates with a different command):
exiftool -m -P -overwrite_original_in_place -TagsFromFile '%-.0f.mov' -Keys:GPSCoordinates -Keys:Make -Keys:Model -Keys:Software *.m4v
Canon R6:
exiftool -m -P -overwrite_original_in_place -TagsFromFile '%-.0f.mp4' '-Keys:Make<IFD0:Make' '-Keys:Model<IFD0:Model' *.m4v
Copy date and some 'Keys' from .mov to a same name .m4v in the same folder:
exiftool -m -P -overwrite_original_in_place -TagsFromFile '%-.0f.mov' '-AllDates<QuickTime:CreateDate' '-Track*Date<QuickTime:CreateDate' '-Media*Date<QuickTime:CreateDate' -Keys:CreationDate -Keys:GPSCoordinates -Keys:Make -Keys:Model -Keys:Software *.m4v
Copy all from .mov to a same name .m4v in the same folder and set file dates (all Track*Date, Media*Date, Keys might not be updated if they do not exist in the source so I use a different command for dates):
exiftool -TagsFromFile '%-.0f.mov' -All:All *.m4v -execute '-FileCreateDate<QuickTime:CreateDate' '-FileModifyDate<QuickTime:CreateDate' -common_args -m -P -overwrite_original_in_place .
I use either Final Cut Pro or ffmpeg to re-encode or re-edit some movies. Currently it is best to use FCP or ffmpeg just for re-encoding and do the metadata in exiftool because the re-encoders do not properly handle movie metadata.
- Matti