Exiftool .bat-file doesn't work anymore for NEW mp4 videos

Started by jochenhecht, March 24, 2025, 03:26:20 PM

Previous topic - Next topic

jochenhecht

Hi Phil,
I also use your toll to rename video files. I prefer to have the creation date of the file in the file name.
Bechause of my time zone (I live in Germany), I have to adapt the creation date by using bat files:

I have 2 bat files with these commands:

bat file 1:
exiftool -AllDates+=1 -filemodifydate+=1 %*
exiftool -d "%%Y-%%m-%%d_%%H%%M%%S.%%%%e" "-filename<createdate" -k %*

bat file 2:
exiftool -AllDates+=2 -filemodifydate+=2 %*
exiftool -d "%%Y-%%m-%%d_%%H%%M%%S.%%%%e" "-filename<createdate" -k %*

When I drag and drop the mp4 files of my old google pixel 4a on one of the bat files (mentioned above), evrything works well.
When I drag and drop the mp4 files of my new google pixel 8 on one of the bat files (mentioned above), the created file name is not correct. The bat file does not adapt to +1h (bat file 1) or to +2h (bat file 2).

Example:
Video file of Pixel 4a:
abcdefg.mp4 --> bat file --> 2024-01-05_161522.mp4    That's correct

Video file of Pixel 8:
hijklmno.mp4 --> bat file 1 --> 2025-03-12_132312.mp4   That's wrong.
Correct file name: 2025-03-12_142312.mp4
hijklmno.mp4 --> bat file 2 --> 2025-03-12_132312.mp4   That's wrong.
Correct file name: 2025-03-12_152312.mp4

Do you have any idea while bat files do not work proper with mp4 files of my new smartphone and how I can fix it?

Best regards,
jochenhecht

Phil Harvey

Hi Jochenhecht,

Which CreateDate's exist in each of these files?:

exiftool -createdate -a -G1 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 ($).

StarGeek

Are you in a +1:00 time zone?

The CreateDate in a video is supposed to be set to UTC. So if your local time was 2025:03:12 14:23:12+01:00, then the correct time in video would be 2025:03:12 13
:23:12
UTC.

It sounds like you're older phone was writing the time stamp incorrectly as local time rather than UTC.

You can add the -api QuickTimeUTC option and exiftool will automatically adjust the UTC time to the local time in your command, but you have to understand that you can't use the same command for both phones.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

jochenhecht

Hi Phil,
just for your information: I do not use old pixel 4a smartphone anymore. So, following it's about pixel 8 files.

Unfortunately I don't know how to use your required command / where to copy the command "exiftool -createdate -a -G1 FILE".

Pixel 8:
So, I drag and drop the file: PXL_20250324_214659672.mp4 (created with pixel 8) onto exiftool(-k).exe and get following information: (just showing the important ones)

File Modification Date/Time     : 2025:03:24 22:47:26+01:00
File Access Date/Time           : 2025:03:24 23:00:46+01:00
File Creation Date/Time         : 2025:03:24 22:48:16+01:00

Create Date                     : 2025:03:24 21:47:04
Modify Date                     : 2025:03:24 21:47:04

Com Android Model               : Pixel 8
Com Android Manufacturer        : Google
Track Header Version            : 0
Track Create Date               : 2025:03:24 21:47:04
Track Modify Date               : 2025:03:24 21:47:04

Media Create Date               : 2025:03:24 21:47:04
Media Modify Date               : 2025:03:24 21:47:04

When I drag and drop this file on bat file 1, I get following result:

PXL_20250324_214659672.mp4 --> bat file 1 --> 2025-03-24_214704.mp4
(correct would be: 2025-03-24_224704.mp4)


Error: No data reference for sample description 0 for Track1 - W:/03_BILDER/00 EXIF MOV rename/PXL_20250324_214659672.mp4
    0 image files updated
    1 files weren't updated due to errors


Pixel 4a:
So, I drag and drop the file: PXL_20240417_065851622.mp4 (created with pixel 4a) onto exiftool(-k).exe and get following information: (just showing the important ones)

File Modification Date/Time     : 2024:04:17 08:58:55+02:00
File Access Date/Time           : 2025:03:24 23:11:08+01:00
File Creation Date/Time         : 2025:03:24 23:11:05+01:00

Create Date                     : 2024:04:17 06:58:55
Modify Date                     : 2024:04:17 06:58:55

Track Create Date               : 2024:04:17 06:58:55
Track Modify Date               : 2024:04:17 06:58:55

Media Create Date               : 2024:04:17 06:58:55
Media Modify Date               : 2024:04:17 06:58:55

When I drag and drop this file on bat file 2, I get following result:

PXL_20240417_065851622.mp4 --> bat file 2 --> 2024-04-17_085855.mp4
(this should be correct)

Just for your information:
I am using Windows 10, Exif tool files are downloaded and installed in 2020. Sorry, I don't know how to figure out exact version of exiftool files.

StarGeek

Rename
exiftool(-k).exe
to
exiftool(-CreateDate -a -G1 -k).exe

The -a (-duplicates) option and -G1 (-groupNames1) option are required to see all the the CreateDate tags, as there might be duplicates, as well as the groups they belong two.

To find the version, rename to
exiftool(-ver -k).exe
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

I think the "No data reference" problem will be solved if you upgrade to the current version.

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

jochenhecht

Hi all,
Thanks a Lot for your Support. I will Test it tomorrow and I keep you posted!

jochenhecht

Hi all,
I made some progress!  8)

I have downloaded and installed latest exiftool (exiftool-13.25_64.zip) and I have tested again with Pixel 4a video file and pixel 8 video file. I did the same procedure as even described in post #3.

Results:
Pixel 8 Video file is renamed correctly.
Pixel 4a video file is renamed correctly.

But I still have the "UTC <-> local time" issue. I tried to understand how to add the -api QuickTimeUTC option.

Can you please advise me how to do this?
Please note I am a very beginner on this topic. Means, I have no glue which file to open, ....

Thanks in advance!


Phil Harvey

Just add -api quicktimeutc to the command, like this:

exiftool -api quicktimeutc -d "%%Y-%%m-%%d_%%H%%M%%S.%%%%e" "-filename<createdate" -k %*

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

jochenhecht

Hi Phil,
on my computer there is disk C:\ where windows is installed and there is disk X:\ for all my files like images, videos, documents.
Exiftool is stored here: X:\Exiftool 1

Attempt 1:
When I go to windows -> Run -> typing: cmd c:/ -> window pops up showing: C:\Windows\System32>
When I now type in: cd X:\Exiftool 1 it shows: C:\Windows\System32>
But it should show something different, right?

Attempt 2:
So I tried another way.
I have copied bat file (see my 1st post). Then I have modified this file and renamed to: MOV rename UTC.bat
This file has following commands:

exiftool -api quicktimeutc -d "%%Y-%%m-%%d_%%H%%M%%S.%%%%e" "-filename<createdate" -k %*
exiftool -d "%%Y-%%m-%%d_%%H%%M%%S.%%%%e" "-filename<createdate" -k %*

When I now drag and drop video file to MOV rename UTC.bat there is following result:

X:\Exiftool 1>exiftool -api quicktimeutc -d "%Y-%m-%d_%H%M%S.%%e" "-filename<createdate" -k "X:\Exiftool 1\PXL_20250324_214659672.mp4"
Warning: [minor] The ExtractEmbedded option may find more tags in the media data - X:/Exiftool 1/PXL_20250324_214659672.mp4
    1 image files updated
-- press ENTER --

(When I press enter)

X:\Exiftool 1>exiftool -d "%Y-%m-%d_%H%M%S.%%e" "-filename<createdate" -k "X:\Exiftool 1\PXL_20250324_214659672.mp4"
Warning: Error opening file - X:/Exiftool 1/PXL_20250324_214659672.mp4
Error: File not found - X:/Exiftool 1/PXL_20250324_214659672.mp4
    0 image files updated
    1 files weren't updated due to errors
-- press ENTER --

When I press enter again, window is closed and file / time stamp is correct.

I have the feeling it's not running proper so far. Any idea how to improve?


Phil Harvey

Quote from: jochenhecht on March 29, 2025, 05:47:41 AMWhen I now type in: cd X:\Exiftool 1 it shows: C:\Windows\System32>

Windows is funny.  You have to "cd" to the drive first "cd X:" then the directory "cd X:\Exiftool".

QuoteX:\Exiftool 1>exiftool -api quicktimeutc -d "%Y-%m-%d_%H%M%S.%%e" "-filename<createdate" -k "X:\Exiftool 1\PXL_20250324_214659672.mp4"
Warning: [minor] The ExtractEmbedded option may find more tags in the media data - X:/Exiftool 1/PXL_20250324_214659672.mp4
    1 image files updated
-- press ENTER --

This command worked and renamed the file.  You don't need to use the ExtractEmbedded option for this command.

QuoteX:\Exiftool 1>exiftool -d "%Y-%m-%d_%H%M%S.%%e" "-filename<createdate" -k "X:\Exiftool 1\PXL_20250324_214659672.mp4"
Warning: Error opening file - X:/Exiftool 1/PXL_20250324_214659672.mp4
Error: File not found - X:/Exiftool 1/PXL_20250324_214659672.mp4
    0 image files updated
    1 files weren't updated due to errors
-- press ENTER --

This command didn't work because the file was already renamed.

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

jochenhecht

Hi,
I'd like to give you an update:
Unfortunately it is not possible (or maybe FOR ME it's not possible) to access exiftool via run mode when exiftool is NOT installed on disk C.
Also Phil's hints did not help unfortunately. (But thanks for your hints)

When exiftool files are stored on disk C, run mode works.

I have created a new bat file with following content:
exiftool -api quicktimeutc -d "%%Y-%%m-%%d_%%H%%M%%S.%%%%e" "-filename<createdate" -k %*

When I drag and drop single files, several files or a folder on that bat file, all files inside (videos and pictures) are renamed correctly. (Pixel 4a files as well pixel 8 files)

What I have recognized:
When exiftool files and image files (or video files) are not stored on same disk, drag and drop does not work.

How I work now:
Exiftool files are not stored on disk C.
I use exiftool GUI to rename images.
I use bat file (mentioned above) to rename video files.

Conclusion:
I am happy with that and thanks a lot for your support.

Regarding exiftool GUI:
I have recognized that GUI is struggling with image files which have same time stamp. That's clear.
Is there any chance to modify exiftool GUI in a way that these files get a numbering?
For example:
20250330-161234_1
20250330-161234_2
20250330-161234_3

BR
jochenhecht

FrankB

A recent version of GUI V6.3.8 does have options where you can specify what to do with duplicate file names.

rename.jpg

My advice would be to download and run the installer, and let the installer also download and install ExifTool. That should take care of installing ExifTool and adding it to your PATH. So it is always available

install.jpg

jochenhecht

Hi FrankB,
I guess you mean Oliver's Installer which you recommend to use, right?

FrankB

Hi Jochen,

Not what I meant in the screenshot.

But also a good option. With that installer also check the option 'add to path'.

Frank