ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Tommi on May 25, 2022, 06:33:47 AM

Title: Sorting images shot in the same second
Post by: Tommi on May 25, 2022, 06:33:47 AM
Hi everybody. I am using ExifTool to rename images according to their DateTimeOriginal tag. Nevertheless, when there are more pictures shot in the same second, e.g. bursts, the pictures order is messed up.

as of right now the command I use is:
exiftool '-FileName<FileModifyDate' '-FileName<DateTimeCreated' '-FileName<GPSDateTime' '-FileName<CreateDate' '-FileName<DateTimeOriginal' -d %Y.%m.%d-%H.%M.%S%%c.%%le -r ./*

Even if %%c adds an index to images when there are more than one shot in the same second, it nevertheless happens that files without any index appear first, together with all of the others without any index. For example, if I shot a burst of images at second :54, I will see images shot at :55, :56, :57, before viewing images :541, :542, etc...

How can I make so that the first image of a burst has index 0, but only if there is more than one image shot in the same second, so that it is sorted properly?
Title: Re: Sorting images shot in the same second
Post by: greybeard on May 25, 2022, 09:05:10 AM
Is this for a specific camera? My FujiFilm camera writes a sequence number so that I can always determine image sequence without being concerned about time
Title: Re: Sorting images shot in the same second
Post by: StarGeek on May 25, 2022, 10:24:18 AM
You would use the -FileOrder option (https://exiftool.org/exiftool_pod.html#fileOrder-NUM---TAG) and pick a tag that will correctly show the order.  If the original filenames are in the correct order, you could use -FileOrder Filename for example.  If the camera records subseconds properly, you could use -FileOrder SubSecDateTimeOriginal.  Or you could use the image sequence tag as greybeard says, though you would have to figure out exactly which tag.  Use the command in FAQ #3 (https://exiftool.org/faq.html#Q3) to find it.
Title: Re: Sorting images shot in the same second
Post by: wywh on May 25, 2022, 10:44:56 AM
I do not use subseconds in filenames and my routine is:

exiftool -fileOrder FileName '-FileName<DateTimeOriginal' -d '%Y-%m%d-%H%M-%S%%lc.%%e' .

But I recently added some subsecond commands to my exiftool cookbook:

exiftool -d %Y-%m%d-%H%M-%S '-FileName<${DateTimeOriginal}.${SubSecTimeOriginal}.%e' .

exiftool -fileOrder FileName '-FileName<SubSecDateTimeOriginal' -d '%Y-%m%d-%H%M-%S%3f.%%e' .

exiftool -d '%Y-%m%d-%H%M-%S' '-fileName<${DateTimeOriginal}.${SubSecTimeOriginal;$_.=0 x(3-length)}%+c.%e' .

exiftool '-FileName<${DateTimeOriginal}%+2nc.%e' '-FileName<${DateTimeOriginal}.${SubSecTimeOriginal}%+2nc.%e' -dateFormat '%Y-%m%d-%H%M-%S' .

exiftool -d '%Y-%m%d-%H%M-%S' '-fileName<${DateTimeOriginal}-000%+2nc.%e' '-fileName<${DateTimeOriginal}-${SubSecTimeOriginal;$_.=0 x(3-length)}%+2nc.%e' .