Renaming Canon cr3 using %f format code produces unusual non-numeric result

Started by scopulorum, May 15, 2022, 03:12:57 PM

Previous topic - Next topic

scopulorum

Renaming Canon cr3 using %f format code ( fractional seconds ) produces unusual non-numeric result.
Other file formats ( e.g. jpg, mp4 ) behave as expected.
Changing quote style (single vs double with -d string ),  TAG ( e.g. CreateDate vs DateTimeOriginal ) , or -testname (e.g. vs "-FileName<CreateDate" ), or -a flag, don't change the result.
The result is consistent between the several files I've tried.


% exiftool  -m -d '%Y-%m-%d_%H-%M-%S_%%2f.%%e'  "-testname<CreateDate" /Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/img_2217_copy.cr3
'/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/img_2217_copy.cr3' --> '/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/2021-10-18_05-11-39_im.cr3'
    0 image files updated
    1 image files unchanged
% exiftool -m -d "%Y-%m-%d_%H-%M-%S_%%2f.%%e"  "-testname<CreateDate" /Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/20210902_143152.mp4
'/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/20210902_143152.mp4' --> '/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/2021-09-02_20-32-05_20.mp4'
    0 image files updated
    1 image files unchanged

Am I missing something?
Might this be a bug?
Is there a reasonable workaround?

Thanks in advance for your consideration.


StarGeek

The code you want is %f, not %%f.  The latter is for inserting the filename in a date format string.  Using %%2f takes the first two letters of the file name, e.g. im.

See Common Date Format Codes and the -w (-TextOut) option.
* 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).

scopulorum

Thanks for the response.

According to https://exiftool.org/filename.html, "Note that these codes must be escaped with an extra % if used within a date format string."
Which seems to be accurate in my experience. (see below; removing extra % produces literal '2f' ).

Also, btw, I get the same issue with a jpg saved from the cr3 but not native jpg files.


% exiftool -a -m -d '%Y-%m-%d_%H-%M-%S_%2f.%%e'  "-testname<DateTimeOriginal" /Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/img_2216_copy.jpg
'/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/img_2216_copy.jpg' --> '/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/2021-10-18_05-11-33_2f.jpg'
    0 image files updated
    1 image files unchanged
% exiftool -a -m -d '%Y-%m-%d_%H-%M-%S_%%2f.%%e'  "-testname<DateTimeOriginal" /Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/20220501_172702_005.jpg
'/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/20220501_172702_005.jpg' --> '/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/2022-05-01_17-27-02_20.jpg'
    0 image files updated
    1 image files unchanged


Also, FYI, MacOS 12.3.1 ; exiftool  12.30
Any other thoughts?

StarGeek

Works here, though you probably want to remove the underscore, as the decimal appears to be built in.
C:\>exiftool -d "%Y-%m-%d_%H-%M-%S_%2f.%%e"  "-testname<DateTimeOriginal" Y:\!temp\ccc\img_2216_copy.jpg
'Y:/!temp/ccc/img_2216_copy.jpg' --> 'Y:/!temp/ccc/2021-10-18_05-11-33_.00.jpg'
    0 image files updated
    1 image files unchanged


Make sure you're using at least version 12.35, as that is when the %f code was added.
* 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).

scopulorum

Thanks again. The version seems to have been the issue:

% /usr/local/bin/exiftool -ver
12.41
% /usr/local/bin/exiftool -m -d "%Y-%m-%d_%H-%M-%S_%3f.%%e"  "-testname<DateTimeOriginal" /Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/img_2216_copy.cr3
'/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/img_2216_copy.cr3' --> '/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/2021-10-18_05-11-33_.000.cr3'
    0 image files updated
    1 image files unchanged

% /opt/homebrew/bin/exiftool -ver
12.30
% /opt/homebrew/bin/exiftool -m -d "%Y-%m-%d_%H-%M-%S_%3f.%%e"  "-testname<DateTimeOriginal" /Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/img_2216_copy.cr3
'/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/img_2216_copy.cr3' --> '/Users/juniper/tmp/_current_workspace/media_library_sorting/media_in/2021-10-18_05-11-33_3f.cr3'
    0 image files updated
    1 image files unchanged