MP4 / MOV Dates not considered in -AllDates?

Started by sx8999, January 21, 2024, 06:50:22 AM

Previous topic - Next topic

sx8999

Hi all,

I use this command to set all dates by the "OldestDate" custom Tag:

exiftool -m -overwrite_original_in_place -wm w -api RequestAll=2 "-DateTimeOriginal<OldestDateTime" "-AllDates<OldestDateTime" "-DateCreated<OldestDateTime" "-FileCreateDate<OldestDateTime" "-FileModifyDate<OldestDateTime" -r "%ddir%"

exiftool -ext mp4 -ext mov -m -overwrite_original_in_place -wm w -api QuickTimeUTC=1 -api RequestAll=2 "-creation_time<OldestDateTime" "-AllDates<OldestDateTime" "-Track*Date<OldestDateTime" "-Media*Date<OldestDateTime" "-Keys:CreationDate<OldestDateTime" "-FileCreateDate<OldestDateTime" "-FileModifyDate<OldestDateTime" -r "%ddir%"

With UserDefined Composite Tag from here https://exiftool.org/forum/index.php?topic=7986.msg80801#msg80801. I thought this way, I would really update ALL available dates tags. But it seems not so.

After running through the process, my file of concern shows the following output for AllDates:
exiftool -a -G1 -s -AllDates "%~1"->
[UserData]      DateTimeOriginal                : 2011:09:21 12:02:44+02:00
[XMP-exif]      DateTimeOriginal                : 2011:09:21 12:02:44
[QuickTime]     CreateDate                      : 2011:09:21 10:02:44
[XMP-xmp]       CreateDate                      : 2011:09:21 12:02:44
[QuickTime]     ModifyDate                      : 2011:09:21 10:02:44
[XMP-xmp]       ModifyDate                      : 2011:09:21 12:02:44

Looks synchronized. But in MediaPlayer Classic it shows yet another date:

General
Complete name                  : xyz
Format                         : MPEG-4
Format profile                 : Base Media
Codec ID                       : isom (isom/iso2/mp41)
File size                      : 11.1 MiB
Duration                       : 1 min 52 s
Overall bit rate               : 829 kb/s
Recorded date                  : 2011-09-21T12:02:44+0200
Encoded date                   : UTC 2011-09-21 10:02:44
Tagged date                    : UTC 2011-09-21 10:02:44
major_brand                    : isom
minor_version                  : 512
compatible_brands              : isomiso2avc1mp41
>>>>>>>>>>>>> creation_time                  : 2016-06-11T10:42:27.000000Z <<<<<<<<<<<<<<<<
encoder                        : Lavf60.20.100

Video
ID                             : 1
Format                         : HEVC
Format/Info                    : High Efficiency Video Coding
Format profile                 : Main@L3.1@Main
Codec ID                       : hvc1
Codec ID/Info                  : High Efficiency Video Coding
Duration                       : 1 min 52 s
Bit rate                       : 662 kb/s
Maximum bit rate               : 7 000 kb/s
Width                          : 640 pixels
Height                         : 480 pixels
Display aspect ratio           : 4:3
Frame rate mode                : Constant
Frame rate                     : 30.000 FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0 (Type 0)
Bit depth                      : 8 bits
Scan type                      : Progressive
Bits/(Pixel*Frame)             : 0.072
Stream size                    : 8.87 MiB (80%)
Writing library                : x265 3.5+113-5f066dd2d:[Windows][GCC 13.2.0][64 bit] 8bit+10bit+12bit
Encoding settings              : cpuid=1111039 / frame-threads=4 / numa-pools=20 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=640x480 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-eob / no-eos / no-hrd / info / hash=0 / temporal-layers=0 / open-gop / min-keyint=25 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=0 / b-pyramid / bframe-bias=0 / rc-lookahead=15 / lookahead-slices=0 / scenecut=40 / no-hist-scenecut / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=2 / limit-refs=3 / no-limit-modes / me=1 / subme=2 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=2 / selective-sao=4 / no-early-skip / rskip / fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=28.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / vbv-maxrate=7000 / vbv-bufsize=14000 / vbv-init=0.8 / min-vbv-fullness=50.0 / max-vbv-fullness=80.0 / crf-max=0.0 / crf-min=0.0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=2 / transfer=2 / colormatrix=2 / chromaloc=1 / chromaloc-top=0 / chromaloc-bottom=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass / no-mcstf / no-sbrc
Encoded date                   : UTC 2011-09-21 10:02:44
Tagged date                    : UTC 2011-09-21 10:02:44
Color range                    : Limited
Codec configuration box        : hvcC

This leads to a wrong sorting in Google Photos which recognizes the date as 2016...
Damn - how to cope with this additionally?

Phil Harvey

What is the output of this command for that file?:

exiftool -time:all -G1 -a -s FILE

- 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 ($).

StarGeek

Quote from: sx8999 on January 21, 2024, 06:50:22 AMI thought this way, I would really update ALL available dates tags. But it seems not so.

After running through the process, my file of concern shows the following output for AllDates:

As you've seen, AllDates is a Shortcut tags for the three most common EXIF timestamps, CreateDate, DateTimeOriginal, and ModifyDate, but it will also write to tags with the same name in other groups.
"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

sx8999

Quote from: Phil Harvey on January 21, 2024, 09:12:39 AMWhat is the output of this command for that file?:

exiftool -time:all -G1 -a -s FILE

- Phil
It shows a lot more times/dates, but still not the one listed as MediaInfo -> "creation_time":




StarGeek

Can you share the file?

I installed MPC and have looked through several files but couldn't find this entry on any of them.  Also, what version/fork are you using?
"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

sx8999

Alright, I'll send you a link via PM :)
My versions are:

MPC-HC (64-bit)
---------------

Build information:
    Version:            1.9.24 (ffe50c0c7)
    Compiler:           MSVC v19.29.30145
    Build date:         Nov 12 2022

LAV Filters:
    LAV Splitter:       0.77.0.1
    LAV Video:          0.77.0.1
    LAV Audio:          0.77.0.1
    FFmpeg compiler:    MinGW-w64 GCC 12.2.0

Operating system:
    Name:               Windows 11
    Version:            10.0.22621 (64-bit)

Hardware:
    CPU:                12th Gen Intel(R) Core(TM) i7-12700H
    GPU:                NVIDIA GeForce RTX 3060 Laptop GPU (driver version: 31.0.15.3209)

Actually I do find these entries in a hell lot of mp4 files of mine.
Hmmm, very interesting.

StarGeek

That file has a tag called Keys:CreationTime, which exiftool doesn't know about, so it's not marked as a time based tag.  I've passed the link on to Phil so he can take a look at it.

Do you know what program created this file?
"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

sx8999

Alright, thanks for digging into it.

I dont know how it was created, but I checked - I have a HUGE number of files with that tag it seems... regular videos from smartphone.

I mean you two are seriously into EXIF tags - if you've not yet come across it, I would assume this tag actually should not have a big relevance - is it? Because if so, I'll just add a removal of that tag to my workflow of processing my files. I want to avoid confusion within files at all cost, so getting rid of a unused tag which shows a different date.


----------
I think I found it:
I process my files using ShutterEncoder while preserving Metadata.
I just recorded a video on my smartphone and checked before and after Encoding with Shutter Encoder.
This is what MediaInfo shows:

BEFORE:
General
Complete name                  : 20240122_064707.mp4
Format                         : MPEG-4
Format profile                 : Base Media / Version 2
Codec ID                       : mp42 (isom/mp42)
File size                      : 4.48 MiB
Duration                       : 2 s 605 ms
Overall bit rate               : 14.4 Mb/s
Performer                      : Galaxy S23
Encoded date                   : UTC 2024-01-22 05:47:11
Tagged date                    : UTC 2024-01-22 05:47:11
xyz                            : +48.8973+009.1770/
com.android.version            : 14

Video
ID                             : 1
Format                         : HEVC
Format/Info                    : High Efficiency Video Coding
Format profile                 : Main@L4@High
Codec ID                       : hvc1
Codec ID/Info                  : High Efficiency Video Coding
Duration                       : 2 s 605 ms
Source duration                : 2 s 433 ms
Bit rate                       : 15.2 Mb/s
Width                          : 1 920 pixels
Height                         : 1 080 pixels
Display aspect ratio           : 16:9
Rotation                       : 90°
Frame rate mode                : Variable
Frame rate                     : 30.000 FPS
Minimum frame rate             : 30.000 FPS
Maximum frame rate             : 30.010 FPS
Real frame rate                : 30.000 FPS
Standard                       : PAL
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Bits/(Pixel*Frame)             : 0.244
Stream size                    : 4.40 MiB (98%)
Source stream size             : 4.40 MiB (98%)
Title                          : VideoHandle
Language                       : English
Encoded date                   : UTC 2024-01-22 05:47:11
Tagged date                    : UTC 2024-01-22 05:47:11
Color range                    : Limited
Color primaries                : BT.709
Transfer characteristics       : BT.709
Matrix coefficients            : BT.709
mdhd_Duration                  : 2605
Codec configuration box        : hvcC

Audio
ID                             : 2
Format                         : AAC LC
Format/Info                    : Advanced Audio Codec Low Complexity
Codec ID                       : mp4a-40-2
Duration                       : 2 s 560 ms
Bit rate mode                  : Constant
Bit rate                       : 256 kb/s
Channel(s)                     : 2 channels
Channel layout                 : L R
Sampling rate                  : 48.0 kHz
Frame rate                     : 46.875 FPS (1024 SPF)
Compression mode               : Lossy
Stream size                    : 80.2 KiB (2%)
Title                          : SoundHandle
Language                       : English
Encoded date                   : UTC 2024-01-22 05:47:11
Tagged date                    : UTC 2024-01-22 05:47:11


AFTER:
General
Complete name                  : 20240122_064707.mp4
Format                         : MPEG-4
Format profile                 : Base Media
Codec ID                       : isom (isom/iso2/mp41)
File size                      : 285 KiB
Duration                       : 2 s 600 ms
Overall bit rate               : 898 kb/s
Encoded date                   : UTC 2024-01-22 05:47:11
Tagged date                    : UTC 2024-01-22 05:47:11
major_brand                    : mp42
minor_version                  : 0
compatible_brands              : isommp42
creation_time                  : 2024-01-22T05:47:11.000000Z
location                       : +48.8973+009.1770/
location-eng                   : +48.8973+009.1770/
com.android.version            : 14
encoder                        : Lavf60.20.100

Video
ID                             : 1
Format                         : HEVC
Format/Info                    : High Efficiency Video Coding
Format profile                 : Main@L4@Main
Codec ID                       : hvc1
Codec ID/Info                  : High Efficiency Video Coding
Duration                       : 2 s 600 ms
Bit rate                       : 750 kb/s
Maximum bit rate               : 6 000 kb/s
Width                          : 1 080 pixels
Height                         : 1 920 pixels
Display aspect ratio           : 0.562
Frame rate mode                : Constant
Frame rate                     : 30.000 FPS
Real frame rate                : 30.000000 FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0 (Type 0)
Bit depth                      : 8 bits
Scan type                      : Progressive
Bits/(Pixel*Frame)             : 0.012
Stream size                    : 238 KiB (83%)
Title                          : VideoHandle
Writing library                : x265 3.5+113-5f066dd2d:[Windows][GCC 13.2.0][64 bit] 8bit+10bit+12bit
Encoding settings              : cpuid=1111039 / frame-threads=4 / numa-pools=20 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1080x1920 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-eob / no-eos / no-hrd / info / hash=0 / temporal-layers=0 / open-gop / min-keyint=25 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=0 / b-pyramid / bframe-bias=0 / rc-lookahead=15 / lookahead-slices=8 / scenecut=40 / no-hist-scenecut / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=2 / limit-refs=3 / no-limit-modes / me=1 / subme=2 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=2 / selective-sao=4 / no-early-skip / rskip / fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=28.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / vbv-maxrate=6000 / vbv-bufsize=12000 / vbv-init=0.8 / min-vbv-fullness=50.0 / max-vbv-fullness=80.0 / crf-max=0.0 / crf-min=0.0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=0 / overscan=0 / videoformat=5 / range=0 / colorprim=1 / transfer=1 / colormatrix=1 / chromaloc=1 / chromaloc-top=0 / chromaloc-bottom=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass / no-mcstf / no-sbrc
Language                       : English
Encoded date                   : UTC 2024-01-22 05:47:11
Tagged date                    : UTC 2024-01-22 05:47:11
Color range                    : Limited
Color primaries                : BT.709
Transfer characteristics       : BT.709
Matrix coefficients            : BT.709
Codec configuration box        : hvcC

Audio
ID                             : 2
Format                         : MPEG Audio
Format version                 : Version 1
Format profile                 : Layer 3
Format settings                : Joint stereo / MS Stereo
Codec ID                       : mp4a-6B
Duration                       : 2 s 560 ms
Source duration                : 2 s 583 ms
Bit rate mode                  : Constant
Bit rate                       : 128 kb/s
Channel(s)                     : 2 channels
Sampling rate                  : 48.0 kHz
Compression mode               : Lossy
Stream size                    : 40.1 KiB (14%)
Source stream size             : 40.5 KiB (14%)
Title                          : SoundHandle
Writing library                : LAME3.100
Language                       : English
Default                        : Yes
Alternate group                : 1
Encoded date                   : UTC 2024-01-22 05:47:11
Tagged date                    : UTC 2024-01-22 05:47:11


In this case, obviously the newly created key has nearly the same date (because I just captured and encoded right after each other).
But yes, this could lead to deviation in the future, e.g. if one decides to encode old videos...

wywh

#8
Quote from: sx8999 on January 22, 2024, 12:47:29 AMShutterEncoder while preserving Metadata

Yes, ShutterEncoder uses ffmpeg and its metadata preserving options generate that 'Keys:CreationTime' tag:

ffmpeg -i input.mp4 -c copy -movflags use_metadata_tags -map_metadata 0 output.mp4             
ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers

exiftool -a -G1 -s -fileOrder5 FileName -api QuickTimeUTC=1 -QuickTime:CreateDate -Keys:All .
======== ./input.mp4
[QuickTime]     CreateDate                      : 2001:01:01 12:00:00+02:00
======== ./output.mp4
[QuickTime]     CreateDate                      : 2001:01:01 12:00:00+02:00
[Keys]          MajorBrand                      : mp42
[Keys]          MinorVersion                    : 1
[Keys]          CompatibleBrands                : isommp41mp42
[Keys]          CreationTime                    : 2001-01-01T10:00:00.000000Z
[Keys]          Encoder                         : Lavf58.76.100

Currently it is best to avoid trying to preserve metadata with ffmpeg and use exiftool for that.

https://www.reddit.com/r/shutterencoder/comments/181wtrf/incorrect_movie_metadata/

https://superuser.com/questions/1817856/incorrect-movie-keys-metadata-with-ffmpeg

- Matti

sx8999

Hmmm, interesting.
Or just remove this newly created Key afterwards using Exiftool? But the way I read it is: It still is a difference, right?

wywh

Quote from: sx8999 on January 22, 2024, 06:17:00 AMremove this newly created Key afterwards using Exiftool

I'd remove it only if some app happens to use it. It seems '-Keys:All=' is currently needed for that:

exiftool -a -G1 -s -fileOrder5 FileName -api QuickTimeUTC=1 -QuickTime:CreateDate -Keys:All output.mp4
[QuickTime]     CreateDate                      : 2001:01:01 12:00:00+02:00
[Keys]          MajorBrand                      : mp42
[Keys]          MinorVersion                    : 1
[Keys]          CompatibleBrands                : isommp41mp42
[Keys]          CreationTime                    : 2001-01-01T10:00:00.000000Z
[Keys]          Encoder                         : Lavf58.76.100

exiftool -overwrite_original -Keys:CreationTime= output.mp4                                          
Warning: Sorry, Keys:CreationTime doesn't exist or isn't writable
Nothing to do.

exiftool -a -G1 -s -fileOrder5 FileName -api QuickTimeUTC=1 -QuickTime:CreateDate -Keys:All output.mp4
[QuickTime]     CreateDate                      : 2001:01:01 12:00:00+02:00
[Keys]          MajorBrand                      : mp42
[Keys]          MinorVersion                    : 1
[Keys]          CompatibleBrands                : isommp41mp42
[Keys]          CreationTime                    : 2001-01-01T10:00:00.000000Z
[Keys]          Encoder                         : Lavf58.76.100

exiftool -overwrite_original -Keys:All= output.mp4                                       
    1 image files updated

exiftool -a -G1 -s -fileOrder5 FileName -api QuickTimeUTC=1 -QuickTime:CreateDate -Keys:All output.mp4
[QuickTime]     CreateDate                      : 2001:01:01 12:00:00+02:00

- Matti

sx8999

Damn, I just wanted to clean it up - because why keep an information which seamingly is nowhere used...
So I wanted to only Focus on the relevant entries.

But you are right, I can't remove this one alone.
Tried several commands:

exiftool -overwrite_original -Keys:CreationTime= output.mp4                                         
exiftool -overwrite_original "-Keys:CreationTime=" output.mp4             
exiftool -overwrite_original "-CreationTime=" output.mp4                 

Nothing worked to remove it. And yes obviously dont wanna use Keys:All.                     

Phil Harvey

Thanks all.  I'll add support for this tag in version 12.74 (to be released within a few days) so you can edit/delete it as you please.  Also so it will show up in the Time group.

- 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 ($).

sx8999

Wow thats great to hear. Thanks so much for your amazing efforts :)

sx8999

I saw it's released! Thanks! Works as expected