mp4 change exif data from filename (WhatsApp videos)

Started by puschel_1, September 09, 2022, 09:44:06 AM

Previous topic - Next topic

puschel_1

Hello!
Can you also help me here?
I would like my WhatsApp videos in the format here VID_20130423_175714.mp4 also with EXIF data, does that work with the ExifTool also and how must then the command line look to get the date from the file name in the Exif data?

Thanks and have a nice weekend!
Flo

StarGeek

I think WhatsApp strips videos of any useful metadata.  Run this command on a file to see all the time related tags

exiftool -time:all -G1 -a -s file.mp4

Odds are, the only time stamps will be the file system ones

If you find a useful tag, note it's name and run this command, replacing TAG with the name of the tag you want to use
exiftool -d "%Y%m%d_%H%M%S" "-Filename<VID_${TAG}.%e" /path/to/files

You don't mention what command line you're using.  The above command would be for Windows CMD.  If you're using anything else, change the double quotes " into single quotes '
"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

puschel_1

Thanks for your answer!

I want to use the date in the filename for the exif-Data of the videos ;)

StarGeek

Minor point, it wouldn't be EXIF data, it would be Quicktime data.  All EXIF data is metadata, but not all metadata is EXIF data

As long as the filename contains 14 numbers representing the year month day hour minute second in that order, you could use
exiftool -api QuickTimeUTC "-AllDates<Filename" /path/to/files/

This assumes that you are in the same time zone as where the video was shot.  If the time zone is different, then you would use this, changing ±00:00 to the proper time zone, i.e -07:00, +03:00, etc
exiftool -api QuickTimeUTC "-AllDates<${Filename}±00:00" /path/to/files/

These commands creates backup files.  Add -Overwrite_Original to suppress the creation of backup files.  Add -r to recurse into subdirectories.  If this command is run under Unix/Mac/Powershell, swap any double/single quotes to avoid bash interpretation.
"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

wywh

#4
Very minor point, but I usually add '-wm w' (Write existing tags) because I dislike new unnecessary overlapping date tags. For example in addition to the modified 'QuickTime:CreateDate' also these are otherwise created:

[UserData]      DateTimeOriginal                : 2013:04:23 17:57:14+03:00
[XMP-exif]      DateTimeOriginal                : 2013:04:23 17:57:14
[XMP-xmp]       CreateDate                      : 2013:04:23 17:57:14
[XMP-xmp]       ModifyDate                      : 2013:04:23 17:57:14


And I use '-overwrite_original_in_place' because I want all macOS metadata to be preserved. Maybe this is unnecessary, though? (an extra step is added to allow the original file attributes to be preserved. For example, on a Mac this causes the original file creation date, type, creator, label color, icon, Finder tags, other extended attributes and hard links to the file to be preserved (but note that the Mac OS resource fork is always preserved unless specifically deleted with -rsrc:all=). This is implemented by opening the original file in update mode and replacing its data with a copy of a temporary file before deleting the temporary. The extra step results in slower performance, so the -overwrite_original option should be used instead unless necessary)?

- Matti

PH Edit: Make quote from documentation blue

StarGeek

Quote from: wywh on September 10, 2022, 01:53:47 AMVery minor point, but I usually add '-wm w' (Write existing tags) because I dislike new unnecessary overlapping date tags

I totally understand this.  For my own files, I do want the XMP in there as well but when I'm answering a question, every single time it involves a video, I end up running it twice.  Once when I'm figuring out the answer, then again after I smack myself in the head and prefix Quicktime: to all the tags before I copy/paste it to the forum.


QuoteAnd I use '-overwrite_original_in_place' because I want all macOS metadata to be preserved. Maybe this is unnecessary, though?
...
The extra step results in slower performance, so the -overwrite_original option should be used instead unless necessary?


With a Mac, it's needed if you want to preserve the MacOS metadata.  On Windows, I wouldn't suggest it.  While Windows has it's Alternate Data Stream, basically a less organized version of the MacOS MDItem/Xattr data, there almost no way to actually read/write such data from the desktop.  Certainly no built in way.  It's rarely ever used.

Though I recently found out that Chromium-based browsers on Windows do save the URL in the ADS for downloaded files.
"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