"CreateDate" tag support for MKV

Started by dma_k, November 21, 2022, 08:25:23 AM

Previous topic - Next topic

dma_k

Probably I have overlooked that on MKV tags support page, but it seems that there are no mappings for the following tags (counterpart MKV tags are just a proposal):
  • DateTimeOriginal ← DATE_RECORDED
  • CreateDate (aka DateTimeDigitized) ← DATE_DIGITIZED
Please share your ideas.

Phil Harvey

I don't understand the MKV documentation that you referenced.  Here is the MKV documentation for the tags that ExifTool supports.

If there are other tags that ExifTool isn't extracting, upload a sample and post a link here and I'll take a look.

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

dma_k

What you reference, is a binary documentation of MKV container. Well, as far as I see there is no place how to store e.g. DateTimeOriginal in it, however MKV allows tags to be attached to MKV, that is how it looks like in my case:

$ mkvextract file.mkv tags -

<?xml version="1.0"?>
<!-- <!DOCTYPE Tags SYSTEM "matroskatags.dtd"> -->
<Tags>
  <Tag>
    <Targets>
      <TargetTypeValue>50</TargetTypeValue>
    </Targets>
    <Simple>
      <Name>DATE_WRITTEN</Name>
      <String>2013:04:14 18:03:55</String>
    </Simple>
    <Simple>
      <Name>ENCODER</Name>
      <String>Lavf59.27.100</String>
    </Simple>
  </Tag>
  <Tag>
    <Targets>
      <TrackUID>14626108510462809658</TrackUID>
      <TargetTypeValue>50</TargetTypeValue>
      <TargetType>MOVIE</TargetType>
    </Targets>
    <Simple>
      <Name>ENCODER</Name>
      <String>Lavc59.37.100 libx264</String>
    </Simple>
    <Simple>
      <Name>BPS</Name>
      <String>204479</String>
      <TagLanguage>eng</TagLanguage>
    </Simple>
    <Simple>
      <Name>DURATION</Name>
      <String>00:05:15.931000000</String>
      <TagLanguage>eng</TagLanguage>
    </Simple>
    <Simple>
      <Name>NUMBER_OF_FRAMES</Name>
      <String>4739</String>
      <TagLanguage>eng</TagLanguage>
    </Simple>
    <Simple>
      <Name>NUMBER_OF_BYTES</Name>
      <String>8075173</String>
      <TagLanguage>eng</TagLanguage>
    </Simple>
  </Tag>
  <Tag>
    <Targets>
      <TrackUID>17217197257077623472</TrackUID>
      <TargetTypeValue>50</TargetTypeValue>
      <TargetType>MOVIE</TargetType>
    </Targets>
    <Simple>
      <Name>ENCODER</Name>
      <String>Lavc59.37.100 libvorbis</String>
    </Simple>
    ...
  </Tag>
</Tags>

So I suppose that tags are the right place to store DateTimeOriginal and CreateDate because I see no way to place this information into container itself.

FYI: I have eventually come across list of tags supported by MediaInfo which dumps the information like this:
Complete name                            : file.mkv
Format                                   : Matroska
Format version                           : Version 4
...
Writing application                      : Lavf59.27.100
Writing library                          : Lavf59.27.100
DATE_RECORDED                            : 2013:04:14 18:03:55
MKV was created by ffmpeg:
ffmpeg ... -metadata "DATE_RECORDED=2013:04:14 18:03:55" file.mkv

Phil Harvey

Can you provide a sample MKV containing metadata like this?  I don't have time to download/install ffmpeg and figure out how to run 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 ($).

StarGeek

Quote from: dma_k on November 21, 2022, 03:37:54 PMFYI: I have eventually come across list of tags supported by MediaInfo

I believe a lot of these tags are TagName/TagString pairs which are de facto "standards" agreed upon by the various video communities that use MKV files, though I could be wrong.  They aren't single tags, but rather two separate tags.  If you look at the file with exiftool, you will see output similar to this
[Matroska]      TagName                        : COMPATIBLE_BRANDS
[Matroska]      TagString                      : isomiso2avc1mp41
[Matroska]      TagName                        : COMMENT
[Matroska]      TagString                      : comment here
[Matroska]      TagName                        : DATE
[Matroska]      TagString                      : 2020-11-04T15:34:46+01:00
[Matroska]      TagName                        : EPISODE_SORT
[Matroska]      TagString                      : 0
[Matroska]      TagName                        : SEASON_NUMBER
[Matroska]      TagString                      : 0
[Matroska]      TagName                        : MEDIA_TYPE
[Matroska]      TagString                      : 9
[Matroska]      TagName                        : HD_VIDEO
[Matroska]      TagString                      : 0
[Matroska]      TagName                        : ENCODER
[Matroska]      TagString                      : Lavf58.20.100

Ah, and looking at the XML output, that seems to be the case, as each "tag" is listed as a <Name>/<String> pair.
"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

StarGeek

This may also be of use.  You can use the Matroska join_tags.config file (related, the XML join_tags.config file) to list these TagName/TagString pairs as single tags.  As an example, after the tag pairs, the pairs are listed as if they were individual tags.

C:\>exiftool -config join_tags.config -G1 -a -s -e "Y:\!NoOnlineBackup\Steam_Libraryxxx\steamapps\common\Warhammer 40000 Gladius - Relics of War\Data\Cinematics\Clips\Intros\AdeptusMechanicus.mkv"
[ExifTool]      ExifToolVersion                 : 12.51
[System]        FileName                        : AdeptusMechanicus.mkv
[System]        Directory                       : Y:/!NoOnlineBackup/Steam_Libraryxxx/steamapps/common/Warhammer 40000 Gladius - Relics of War/Data/Cinematics/Clips/Intros
[System]        FileSize                        : 67 MB
[System]        FileModifyDate                  : 2021:11:22 07:53:04-08:00
[System]        FileAccessDate                  : 2022:11:22 13:10:04-08:00
[System]        FileCreateDate                  : 2021:11:22 07:53:04-08:00
[System]        FilePermissions                 : -rw-rw-rw-
[File]          FileType                        : MKV
[File]          FileTypeExtension               : mkv
[File]          MIMEType                        : video/x-matroska
[Matroska]      EBMLVersion                     : 1
[Matroska]      EBMLReadVersion                 : 1
[Matroska]      DocType                         : matroska
[Matroska]      DocTypeVersion                  : 4
[Matroska]      DocTypeReadVersion              : 2
[Matroska]      TimecodeScale                   : 1 ms
[Matroska]      MuxingApp                       : Lavf57.83.100
[Matroska]      WritingApp                      : Lavf57.83.100
[Matroska]      Duration                        : 0:01:09
[Matroska]      TagName                         : DATE
[Matroska]      TagString                       : 2021-11-15T14:35:17+01:00
[Matroska]      TagName                         : ENCODER
[Matroska]      TagString                       : Lavf57.83.100
[Matroska]      TagName                         : ENCODER
[Matroska]      TagString                       : Lavc57.107.100 libvpx-vp9
[Matroska]      TagName                         : DURATION
[Matroska]      TagString                       : 00:01:09.166000000
[Matroska]      DURATION                        : 00:01:09.166000000
[Matroska]      DATE                            : 2021-11-15T14:35:17+01:00
[Matroska]      ENCODER                         : Lavf57.83.100
[Matroska]      ENCODER                         : Lavc57.107.100 libvpx-vp9
[Track1]        TrackNumber                     : 1
[Track1]        TrackLanguage                   : und
[Track1]        CodecID                         : V_VP9
[Track1]        TrackType                       : Video
[Track1]        VideoFrameRate                  : 30
[Track1]        ImageWidth                      : 1920
[Track1]        ImageHeight                     : 1080
[Track1]        VideoScanType                   : Unknown (2)
[Track1]        DisplayUnit                     : Unknown (4)
[Composite]     ImageSize                       : 1920x1080
[Composite]     Megapixels                      : 2.1

Took me too long to dig this out and Google couldn't find it
"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

dma_k

Quote from: StarGeek on November 22, 2022, 04:17:24 PMThis may also be of use.  You can use the Matroska join_tags.config file (related, the XML join_tags.config file) to list these TagName/TagString pairs as single tags.  As an example, after the tag pairs, the pairs are listed as if they were individual tags.
Would be great if you could share the parameters you mass to exiftool in your case. I see that tags are displayed when I add -ee, but I think it should be possible to rename (in your case) DATE to CreateDate?
Quote from: Phil Harvey on November 21, 2022, 08:40:03 PMCan you provide a sample MKV containing metadata like this?
Here is MKV example.

Phil Harvey

#7
Thanks for the sample, this is useful.  Reading the documentation, MKV also supports nested tags, which I should also support.  Do you have a sample of this? (I couldn't find one after lots of Googling.)  eg. ORIGINAL/ARTIST or ORIGINAL/ARTIST/EMAIL or COUNTRY=Canada/COPYRIGHT.

Also, it is hard to believe this for a modern specification, but MKV date/time tags have no time zone support!

- Phil

Edit: Also, people will never learn how to format things properly.  The sample you have has an incorrectly formatted date/time (the date should use "-" as a separator, but ":" is used in this file).

Edit2: Another gripe: Country codes are stored completely differently from language codes.  The country is a top-level nested tag, and the language is a tag attribute. (As opposed to something like XMP where the language-country code is an attribute.)
...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 ($).

dma_k

Quote from: Phil Harvey on November 25, 2022, 11:21:59 AMReading the documentation, MKV also supports nested tags, which I should also support. Do you have a sample of this? (I couldn't find one after lots of Googling.) eg. ORIGINAL/ARTIST or ORIGINAL/ARTIST/EMAIL or COUNTRY=Canada/COPYRIGHT.
Unfortunately I don't have any examples of those tags since I create MKV by myself. I have googled and found that nesting tags are just <Simple> tags nesting in <Simple> tag. The examples' screenshots can be found in this post, and DTD is in this project. My advice would be not to try to capture everything, just to improve what is mostly used...
Quote from: Phil Harvey on November 25, 2022, 11:21:59 AMAlso, it is hard to believe this for a modern specification, but MKV date/time tags have no time zone support!
I agree, that is very improvident not to include timezone. I am not even sure what should be assumed (localzone?)

Phil Harvey

Quote from: dma_k on November 27, 2022, 06:10:31 PMI have googled and found that nesting tags are just <Simple> tags nesting in <Simple> tag.

I googled and found that too, which doesn't help much because I sort of need a sample for testing.  I have the code written, but it needs testing.  Also, I think when they say "Simple", they are talking about the "SimpleTag" in the documentation I referenced.

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

dma_k

Quote from: Phil Harvey on November 27, 2022, 09:19:23 PMI googled and found that too, which doesn't help much because I sort of need a sample for testing.  I have the code written, but it needs testing.  Also, I think when they say "Simple", they are talking about the "SimpleTag" in the documentation I referenced.
I think would be more practical to take some software that puts tags to MKV, and verify ExifTool that way. I tried VLC viewer for that purpose, but on some reason it does not save tags back to MKV (maybe that function is broken?). Then I tried MKVToolNix GUI, but it does not have a functionality to edit artist :'(
Gets not trivial to test it...

Phil Harvey

Yes it does.  I'll go ahead and release it anyway.  It is working well for me for the samples that I do have.

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