News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Xiaomi Redmi Note 8 Pro DateTimeOriginal Rename using Exif

Started by Lostguybrazil, June 21, 2020, 06:37:02 PM

Previous topic - Next topic

Lostguybrazil

Hi everyone!

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

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

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.
* 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).

Lostguybrazil

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.

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

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.
* 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).

Lostguybrazil

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!

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

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" '
* 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).

Lostguybrazil

I was using CMD. Thank you very much, this was exactly the problem! This is the final code:

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

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:

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%