Author Topic: Xiaomi Redmi Note 8 Pro DateTimeOriginal Rename using Exif  (Read 252 times)

Lostguybrazil

  • Newbie
  • *
  • Posts: 9
Xiaomi Redmi Note 8 Pro DateTimeOriginal Rename using Exif
« on: June 21, 2020, 06:37:02 PM »
Hi everyone!

I usually rename my photos by DateTimeOriginal (and include the sub second, if available), i.e.:

Code: [Select]
exiftool ^
 "-FileName<${DateTimeOriginal}%+.nc.%e" ^
 "-FileName<${DateTimeOriginal}.${SubSecTimeOriginal}%+.nc.%e" ^
 -dateFormat "%Y.%m.%d, %H.%M.%S" ^
 "C:\Directory"

This code works with all of my photos with Exif information. Except for photos taken by a Xiaomi Redmi Note 8 Pro. Attached you will find a photo taken by this camera. I am using the latest ExifTool 12.00.

Does anyone know if this camera model must be "cataloged" in order to the rename to work? If yes, how should I do it?

Many thanks and best regards

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3803
Re: Xiaomi Redmi Note 8 Pro DateTimeOriginal Rename using Exif
« Reply #1 on: June 21, 2020, 07:15:10 PM »
The reason you command doesn't work is because that file doesn't have a DateTimeOriginal tag.  It does have a ModifyDate and GPS time stamp.  Sorta weird, but it looks like the ModifyDate might be close (off by a few seconds compared to the GPS time), assuming you're in +02:00 time zone.

You could use ModifyDate and SubSecTime to rename these images.

So try this
exiftool "-FileName<${ModifyDate}%+.nc.%e" "-FileName<${ModifyDate}.${SubSecTime}%+.nc.%e" -FileName<${DateTimeOriginal}%+.nc.%e" "-FileName<${DateTimeOriginal}.${SubSecTimeOriginal}%+.nc.%e" -dateFormat "%Y.%m.%d, %H.%M.%S" "C:\Directory"

It will use DateTimeOriginal if it exists, then fall back to ModifyDate if the DateTimeOriginal tag doesn't exist.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Lostguybrazil

  • Newbie
  • *
  • Posts: 9
Re: Xiaomi Redmi Note 8 Pro DateTimeOriginal Rename using Exif
« Reply #2 on: June 22, 2020, 05:15:04 PM »
Thank you very much for your input!

Indeed the ModifyDate is the most correct time. I changed the code suggested by you adding a if else condition.

Code: [Select]
exiftool ^
 -if '$Model eq "Redmi Note 8 Pro"' -execute ^
  "-FileName<${ModifyDate}%+.nc.%e" ^
  "-FileName<${ModifyDate}.${SubSecTime}%+.nc.%e" ^
 -if '$Model ne "Redmi Note 8 Pro"' -execute ^
  "-FileName<${DateTimeOriginal}%+.nc.%e" ^
  "-FileName<${DateTimeOriginal}.${SubSecTimeOriginal}%+.nc.%e" ^
 -dateFormat "%Y.%m.%d, %H.%M.%S" ^
 "C:\Directory"

I know that the code provided by you is not that different, but I like to separate photos without EXIF information. This means that photos that were not taken by the Redmi Note 8 Pro or photos without EXIF information are not renamed, thus easily identifiable.

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3803
Re: Xiaomi Redmi Note 8 Pro DateTimeOriginal Rename using Exif
« Reply #3 on: June 22, 2020, 07:27:06 PM »
I think what you actually want is
exiftool -if '$Model eq "Redmi Note 8 Pro"' "-FileName<${ModifyDate}%+.nc.%e" "-FileName<${ModifyDate}.${SubSecTime}%+.nc.%e" -execute -if '$Model ne "Redmi Note 8 Pro"' "-FileName<${DateTimeOriginal}%+.nc.%e" "-FileName<${DateTimeOriginal}.${SubSecTimeOriginal}%+.nc.%e" -common_args -dateFormat "%Y.%m.%d, %H.%M.%S" "C:\Directory"

The -execute option is used after that section of the command is complete and is implied for the last section.  The -Common_Args option is needed so that -dateFormat "%Y.%m.%d, %H.%M.%S" "C:\Directory" applies to both parts of the command.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Lostguybrazil

  • Newbie
  • *
  • Posts: 9
Re: Xiaomi Redmi Note 8 Pro DateTimeOriginal Rename using Exif
« Reply #4 on: June 23, 2020, 01:30:23 PM »
Thank you for your input! Unfortunately the suggested code did not work... Do you know why? I receive the error message that all "files failed condition". Thanks!

Code: [Select]
exiftool ^
 -if '$Model eq "Redmi Note 8 Pro"' ^
  "-FileName<${ModifyDate}%+.nc.%e" ^
  "-FileName<${ModifyDate}.${SubSecTime}%+.nc.%e" ^
 -execute ^
 -if '$Model ne "Redmi Note 8 Pro"' ^
  "-FileName<${DateTimeOriginal}%+.nc.%e" ^
  "-FileName<${DateTimeOriginal}.${SubSecTimeOriginal}%+.nc.%e" ^
 -common_args ^
 -dateFormat "%Y.%m.%d, %H.%M.%S" ^
 "C:\Directory"

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3803
Re: Xiaomi Redmi Note 8 Pro DateTimeOriginal Rename using Exif
« Reply #5 on: June 23, 2020, 05:28:59 PM »
Are you using PowerShell or CMD? If the latter, swap double/single quotes.

edit: Actually, it finally hit me that you're mixing how you are using quotes.  In CMD, double quotes should be on the outside of an argument, single quotes on the inside, e.g.
-if "$Model eq 'Redmi Note 8 Pro' "

I think Powershell is like Mac/Linux, single quotes need to be around anything with a dollar sign $, with double quotes on the inside.
-if '$Model eq "Redmi Note 8 Pro" '
« Last Edit: June 24, 2020, 11:04:40 AM by StarGeek »
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Lostguybrazil

  • Newbie
  • *
  • Posts: 9
Re: Xiaomi Redmi Note 8 Pro DateTimeOriginal Rename using Exif
« Reply #6 on: June 25, 2020, 08:03:46 AM »
I was using CMD. Thank you very much, this was exactly the problem! This is the final code:

Code: [Select]
exiftool ^
 -if "$Model eq 'Redmi Note 8 Pro'" ^
  "-FileName<${ModifyDate}%+.nc.%e" ^
  "-FileName<${ModifyDate}.${SubSecTime}%+.nc.%e" ^
 -execute ^
 -if "$Model ne 'Redmi Note 8 Pro'" ^
  "-FileName<${DateTimeOriginal}%+.nc.%e" ^
  "-FileName<${DateTimeOriginal}.${SubSecTimeOriginal}%+.nc.%e" ^
 -common_args ^
 -dateFormat "%Y.%m.%d, %H.%M.%S" ^
 "C:\Directory"

Lostguybrazil

  • Newbie
  • *
  • Posts: 9
Re: Xiaomi Redmi Note 8 Pro DateTimeOriginal Rename using Exif
« Reply #7 on: July 11, 2020, 06:22:58 AM »
An update regarding this topic: I now transfer the ModifyDate to the DateTimeOriginal (the same for SubSecModifyDate to SubSecTimeOriginal) before renaming all photos using the DateTimeOriginal (and SubSecTimeOriginal when available). I am using Command Prompt:

Code: [Select]
set path="C:\Directory"
:: echo %path%

exiftool ^
 -if "$Model eq 'Redmi Note 8 Pro'" ^
 -overwrite_original ^
 "-DateTimeOriginal<ModifyDate" ^
 "-SubSecTimeOriginal<SubSecModifyDate" ^
 %path%

exiftool ^
 "-FileName<${DateTimeOriginal}%+.nc.%e" ^
 "-FileName<${DateTimeOriginal}.${SubSecTimeOriginal}%+.nc.%e" ^
 -dateFormat "%Y.%m.%d, %H.%M.%S" ^
 %path%