Menu

Helping exiftool understand dates

2 days ago
17 hours ago
  • Frederic Da Vitoria

    I am trying to extract and parse dates from .mts files, in order to rename files. The usual "-FileName<DateTimeOriginal" -d %Y%m%d%H%M%.%e works well with .jpg (and other file types too), but I found that it fails on my Sony .mts files. Using -DateTimeOriginal, I found that in these .mts files, dates are formatted this way: 2026:01:06 10:59:27+02:00 DST. I guess the +02:00 DST is what exiftool does not understand. Is there a way to help exiftool?

     
  • StarGeek

    StarGeek - 2 days ago

    The %. in your -d (-dateFormat) option breaks that option. Additionally, you are using the %e as a date code (which only works under Mac/Linux and breaks under Windows), not as a file extension. To use it as a file extension, you need to double the percent signs.

    Try
    -d %Y%m%d%H%M.%%e

    For further details on using file name percent codes in the -d option, see Common Date Format Codes

     
  • Frederic Da Vitoria

    Thank you for your answer.

    I tried:

    exiftool "-FileName<DateTimeOriginal" -d %Y%m%d%H%M%.%%e *.mts
    

    and got:

    Warning: [minor] The ExtractEmbedded option may find more tags in the video data - 0001.MTS
    Warning: New file name is empty - 0001.MTS

    which is exactly what I got previously with %e instead of %%e.

    I tried:

    exiftool "-FileName<DateTimeOriginal" -ee2 -d %Y%m%d%H%M%.%%e *.mts
    

    and got:

    Warning: New file name is empty - 0001.MTS

    When I try:

    c:\winprogs\exiftool\exiftool -p "${createdate#;DateFmt('%Y-%m-%d_%H%M%S')}" *.jpg
    

    I get a correct date, but when I try:

    c:\winprogs\exiftool\exiftool -p "${createdate#;DateFmt('%Y-%m-%d_%H%M%S')}" *.mts
    

    I get:

    Warning: [minor] The ExtractEmbedded option may find more tags in the video data - 0001.MTS

    BTW, I am using exiftool version 13.59

     

    Last edit: Frederic Da Vitoria 17 hours ago

Log in to post a comment.

Auth0 Logo