Rename all files to BURST format

Started by lmiol, October 17, 2022, 03:04:38 AM

Previous topic - Next topic

lmiol

Hi!
Google Photo can use BURST format
it means 4 images (for example) are shows like 1 block of images with 4 frames.
google photo app recognize it by img name, for example
IMG_1_BURST20221017194216846.jpg
IMG_2_BURST20221017194216846.jpg
IMG_3_BURST20221017194216846.jpg
IMG_4_BURST20221017194216846.jpg

this is very usefull when you do 4 shots at once and photo gallery is look more compact: 1 photo block instead of 4

So my question is
How to determine only first photo in folder and check exifdata modifydate (and time) of it, then rename all images into this modifydate using format with different numbers (edit exifdata not required)

IMG_1_BURST20221017194216846.jpg

Phil Harvey

I don't know what the "846" in those file names represents, but otherwise this command may do what you want:

exiftool "-testname<IMG_%nC_BURST${createdate}.%e" -d %Y%m%d%H%M%S DIR

Note that this will also rename files that were not in bursts.

If you are happy with the output of this command, change "testname" to "filename" to actually do the renaming.

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

lmiol

Quote from: Phil Harvey on October 17, 2022, 06:43:49 AMI don't know what the "846"
probably miliseconds, which puted only to filename by googlecamera app (miliseconds not exists in exifdata as i know)
i think 000 can be used for this

lmiol

Quote from: Phil Harvey on October 17, 2022, 06:43:49 AMNote that this will also rename files that were not in bursts.
hmm it seems files is not been renamed

Warning: No writable tags set from DIR/IMG_20221017_194216846.jpg
Warning: No writable tags set from DIR/IMG_20221017_194218247.jpg
Warning: No writable tags set from DIR/IMG_20221017_194219341.jpg
Warning: No writable tags set from DIR/IMG_20221017_194221881.jpg
    1 directories scanned
    0 image files updated
    4 image files unchanged

lmiol


Phil Harvey

Try using DateTimeOriginal instead of CreateDate in the command.

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

lmiol

Quote from: Phil Harvey on October 17, 2022, 07:45:09 AMTry using DateTimeOriginal instead of CreateDate in the command.
nope, doesn't work, same error
i am using exiftool last version 12.4.8.0

Phil Harvey

Use this command to see what date/time tags are available, and choose one of them:

exiftool -time:all -s FILE

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

lmiol

Quote from: Phil Harvey on October 17, 2022, 08:38:11 AMUse this command to see what date/time tags are available, and choose one of them:

exiftool -time:all -s FILE
FileModifyDate                : 2022:10:17 19:42:40+03:00
FileAccessDate                 : 2022:10:17 19:53:25+03:00
FileCreateDate                 : 2022:10:17 19:42:05+03:00
ModifyDate                      : 2022:10:17 19:42:05
DateTimeOriginal             : 2022:10:17 19:42:05
CreateDate                       : 2022:10:17 19:42:05

it seems problem somewhere else

Phil Harvey

The quoting I gave is for a Windows CMD shell.  You may have to use single quotes if running in something else.  Otherwise, make sure you have typed everything correctly because that command should work.

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

lmiol

Quote from: Phil Harvey on October 17, 2022, 08:46:23 AMYou may have to use single quotes
single quotes doesnt work too
C:\lab>exiftool '-filename -d mHS DIR 0<IMG_e'
The system cannot find the file specified.

Quote from: Phil Harvey on October 17, 2022, 08:46:23 AMmake sure you have typed everything correctly because that command should work.
I just copy your string without any changes

Phil Harvey

Quote from: lmiol on October 17, 2022, 10:47:14 AMC:\lab>exiftool '-filename -d mHS DIR 0<IMG_e'
The system cannot find the file specified.

Wow.  There is so much wrong with this I don't know where to start.  It looks nothing like the command I suggested:

Quote from: Phil Harvey on October 17, 2022, 06:43:49 AMexiftool "-testname<IMG_%nC_BURST${createdate}.%e" -d %Y%m%d%H%M%S DIR

It seems you are running under Windows.  Are you using CMD or PowerShell?

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

lmiol

Quote from: Phil Harvey on October 17, 2022, 10:54:46 AMWow.  There is so much wrong with this I don't know where to start.  It looks nothing like the command I suggested:
No, this is error in window
Inside file the string is right:


Quote from: Phil Harvey on October 17, 2022, 10:54:46 AMIt seems you are running under Windows.  Are you using CMD or PowerShell?

tried both

lmiol

exiftool "-filename<IMG_%%nC_BURST${CreateDate}.%%e" -d %%Y%%m%%d%%H%%M%%S *jpg
pause
This works fine (double %)

lmiol

But it catch CreateDate from every file and put it to same filename
result:


But it should catch CreateDate only from First file in list and put to every filename. It is possible?

Phil Harvey

So you are running from inside a .bat file?  This was important information.

In your initial examples all burst images had the same date/time.  Now you are saying they are different and you want to use the timestamp from the first one?  How is ExifTool supposed to tell which images should be part of the burst?  It seems as if we are back to the beginning here, and I don't understand exactly what you are trying to do.  I could take a guess, and give you another command that I think might work, but the way things have been going I don't think that would help.

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

lmiol

#16
I'm sorry, it seems I misled you.
I selected only one square in the image at section "From this" and thought it was enough
Quote from: lmiol on October 17, 2022, 07:32:33 AM

Now i see, i should did it more specific, like this:

Not each to each, but one to each

Quote from: Phil Harvey on October 17, 2022, 03:25:33 PMSo you are running from inside a .bat file?
i am execute 1.bat

Phil Harvey

OK,  The only way to do this is to take copy the date/time from the first file, so in your .bat file the command would be:

exiftool -tagsfromfile IMG_20221017_194216846.jpg "-filename<IMG_%%nC_BURST${CreateDate}000.%%e" -d %%Y%%m%%d%%H%%M%%S -fileorder filename *.jpg

Here I have also added the "000" as in your example after the date/time.  Also, I have added -fileorder filename to be sure the files are processed in the correct order because sometimes the directory entries aren't sorted.

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

lmiol

Quote from: Phil Harvey on October 18, 2022, 03:18:25 PMOK,  The only way to do this is to take copy the date/time from the first file, so in your .bat file the command would be:

exiftool -tagsfromfile IMG_20221017_194216846.jpg "-filename<IMG_%%nC_BURST${CreateDate}000.%%e" -d %%Y%%m%%d%%H%%M%%S -fileorder filename *.jpg

Here I have also added the "000" as in your example after the date/time.  Also, I have added -fileorder filename to be sure the files are processed in the correct order because sometimes the directory entries aren't sorted.

Thank you, Phil. It works brilliant!
But it is possible to determine first file of sort for -tagsfromfile automatically?
I mean do not specify manually IMG_20221017_194216846.jpg

Phil Harvey

ExifTool can't help you to determine the name of the first file.  There is probably a way to do this using batch-file commands, but I can't help with that.

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

lmiol

Quote from: Phil Harvey on October 18, 2022, 07:56:39 PMExifTool can't help you to determine the name of the first file.  There is probably a way to do this using batch-file commands
Got it. Thank you for your time and useful help, Phil!

lmiol

#21
Quote from: Phil Harvey on October 18, 2022, 03:18:25 PMexiftool -tagsfromfile IMG_20221017_194216846.jpg "-filename<IMG_%%nC_BURST${CreateDate}000.%%e" -d %%Y%%m%%d%%H%%M%%S -fileorder filename *.jpg

And what if names of files are
PXL_20230101_122059555.jpg
PXL_20230101_122101444.NIGHT.jpg
PXL_20230101_122102221.PORTRAIT.jpg

and how to rename from -tagsfromfile PXL_20230101_122059555.jpg
into this:
PXL_20230101_122059555.BURST-1.jpg
PXL_20230101_122059555.NIGHT-2.jpg
PXL_20230101_122059555.PORTRAIT-3.jpg
?

(because this is another BURST format for Google Photo, for PXL_ prefix files, which i discoved recently)


UPDATE:
After exiftool rename It is seems it is need to use regex to find [0123456789]+-
and then put BURST word
I wil try to do it myself and back later