Edit all the dates of a MP4 file in one command?

Started by trymeout, April 30, 2021, 05:11:17 PM

Previous topic - Next topic

Phil Harvey

There is always a date/time field in MOV/MP4 videos.  If it is set to zero, it seems that FFMpeg doesn't display it.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

trymeout

Quote from: Phil Harvey on May 05, 2021, 07:27:00 PM
There is always a date/time field in MOV/MP4 videos.  If it is set to zero, it seems that FFMpeg doesn't display it.

- Phil

That sucks but it is what it is. Is it a standard for people who do not want a date and time to set the date and time to 0000:00:00 00:00:00 on their MP4 videos to "remove the date and time" for picture and video gallery software to think the MP4 videos have no date set?

trymeout

Quote from: StarGeek on May 03, 2021, 08:44:08 PM
For example, if I include the timezone when setting the tag
exiftool -api QuickTimeUTC -CreateDate="2021:05:03 12:00:00-05:00" "Y:\!temp\Test1.mp4"
then the embedded time will list as 2021:05:03 17:00:00, adjusted by the five hour difference.

Is there a way to embed the timezone into the date and time and not have the date and time always be set and read in UTC time. For example if I set the date and time to "2021:05:03 12:00:00-05:00" it will be read as "2021:05:03 12:00:00-05:00" by exiftools and other porgrams like MediaInfo and not read as "2021:05:03 17:00:00" in UTC time.

StarGeek

Quote from: trymeout on May 10, 2021, 03:08:18 PM
Is there a way to embed the timezone into the date and time and not have the date and time always be set and read in UTC time.

No.

There's no way to add timezone data to the Quicktime integer timestamps like CreateDate, ModifyDate and the various track based timestamps.  They are not a string which would be able to hold a timezone.  The spec says it's supposed to be UTC and most programs will read it as such, though some programs do not properly adjust the time.  Of particular note is that Adobe programs do not adjust from UTC.

If you want exiftool to display the local time, add the -api QuickTimeUTC option when listing the data.  That option will only affect quicktime tags so it will have no effect on other tags if you include it when reading an image, for example.

Windows will always adjust the time.  Adobe will not.  I can't comment on how MediaInfo will read it. If it doesn't adjust the time like it's supposed to, then you have to decide which program you're using is more important on how it displays the data.  Unfortunately, you can't have it both ways.

Alternatively, you could use the Quicktime:CreationDate and Quicktime:DateTimeOriginal tags.  Those can hold a timezone.  In fact, some programs like Apple Photos require a timezone for those tags otherwise they display junk.  Exiftool ver 12.13 or higher will automatically write the local timezone to those tags if one isn't included.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

trymeout

Quote from: StarGeek on May 10, 2021, 04:29:00 PM
Quote from: trymeout on May 10, 2021, 03:08:18 PM
Is there a way to embed the timezone into the date and time and not have the date and time always be set and read in UTC time.

No.

There's no way to add timezone data to the Quicktime integer timestamps like CreateDate, ModifyDate and the various track based timestamps.  They are not a string which would be able to hold a timezone.  The spec says it's supposed to be UTC and most programs will read it as such, though some programs do not properly adjust the time.  Of particular note is that Adobe programs do not adjust from UTC.

If you want exiftool to display the local time, add the -api QuickTimeUTC option when listing the data.  That option will only affect quicktime tags so it will have no effect on other tags if you include it when reading an image, for example.

Windows will always adjust the time.  Adobe will not.  I can't comment on how MediaInfo will read it. If it doesn't adjust the time like it's supposed to, then you have to decide which program you're using is more important on how it displays the data.  Unfortunately, you can't have it both ways.

Alternatively, you could use the Quicktime:CreationDate and Quicktime:DateTimeOriginal tags.  Those can hold a timezone.  In fact, some programs like Apple Photos require a timezone for those tags otherwise they display junk.  Exiftool ver 12.13 or higher will automatically write the local timezone to those tags if one isn't included.

Is there any date time tags that will not embed a UTC or any timezone like EXIF picture date time tags which are noted saved in UTC time or any time zone and are considered the local time?

And how would you set the Quicktime:CreationDate with a custom timezone embeded?

StarGeek

Quote from: trymeout on May 10, 2021, 05:19:44 PM
And how would you set the Quicktime:CreationDate with a custom timezone embeded?

FAQ #5
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

trymeout

Cool, is there a way to take this command and to have it do exactly this without having to type out the time twice on it? "2020:11:11 12:00:00-0500"

exiftool -overwrite_original -api QuickTimeUTC -time:all="2020:11:11 12:00:00-0500" -wm w -xmp:dateTimeOriginal="2020:11:11 12:00:00-0500" "output.mp4"

Phil Harvey

Writing Time:All should also write XMP:DateTimeOriginal.  I don't see why you need that argument at all.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

trymeout

When I use the -time:all= command only on this short video it will only write the six date and time tags

Create Date                     : 2020:11:11 17:00:00
Modify Date                     : 2020:11:11 17:00:00
Track Create Date               : 2020:11:11 17:00:00
Track Modify Date               : 2020:11:11 17:00:00
Media Create Date               : 2020:11:11 17:00:00
Media Modify Date               : 2020:11:11 17:00:00


Phil Harvey

If you use -wm w then only existing tags will be written.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

trymeout

Thank you for all of your help. These are the commands I was able to create to make my life much easier

To delete all date and time metadata from a video file and add the XMP Date/Time Original Metadata
exiftool -overwrite_original -xmp:dateTimeOriginal="2000:01:01 00:00:00" "file.mp4"

To set the date and time with the timezone being saved to the XMP Date/Time Original Metadata if there is a XMP Date/Time Original Metadata field in the video file
exiftool -overwrite_original -api QuickTimeUTC -time:all="2020:12:25 18:11:22-06:00" -wm w "file.mp4"

trymeout

I found a better metadata field to set the time without it having to be UTC or even set to any time zone by using the ContentCreateDate tag. The following commands below works for example when you want the video to be set to 2022:11:22 12:00:00 in your local time zone.

Step 1: Delete all date and time fields
exiftool -overwrite_original -time:all= "file.mp4"

Step 2: Add the ContentCreateDate field
exiftool -overwrite_original -ContentCreateDate="2000:01:01 00:00:00" "file.mp4"

Step 3: Set all date and time fields to 2022:11:22 12:00:00 in -06:00
exiftool -overwrite_original -api QuickTimeUTC -time:all="2022:11:22 12:00:00" -wm w "file.mp4"

And this is how it is displayed

$ exiftool "file.mp4"
Create Date                     : 2022:11:22 18:00:00
Modify Date                     : 2022:11:22 18:00:00

Track Create Date               : 2022:11:22 18:00:00
Track Modify Date               : 2022:11:22 18:00:00

Media Create Date               : 2022:11:22 18:00:00
Media Modify Date               : 2022:11:22 18:00:00

Content Create Date             : 2022:11:22 12:00:00


The local time is 12:00 and it will set the UTC time to 18:00.

Is there a way to set the date and time to lets say 12:00:00 but have it in a different time zone like -05:00 without adding "-05:00" to the end of the time in the third command and without having to change the clock on the computer. I personally like how the Content Create Date time is set to 12:00:00 and not 12:00:00-06:00.

Phil Harvey

Quote from: trymeout on May 21, 2021, 12:53:42 PM
Is there a way to set the date and time to lets say 12:00:00 but have it in a different time zone like -05:00 without adding "-05:00" to the end of the time in the third command and without having to change the clock on the computer.

How would the time zone then be determined?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).