ExifTool Forum

ExifTool => Newbies => Topic started by: OOmatrixOO on April 29, 2019, 03:41:33 PM

Title: How to rename files with different ext
Post by: OOmatrixOO on April 29, 2019, 03:41:33 PM
Hi.
I use this to rename my pictures.

exiftool -o "Bearbeitet/" -fileOrder DateTimeOriginal "-filename=#%%1.3C.%%le" "-filename<${DateTimeOriginal}_test_%%1.3C.%%le" -d %%Y-%%m-%%d -ext jpg %1

This works great. Now i would rename jpg and mp4 files in the same folder like this.

I found this in the documentation:
exiftool -ext JPG DIR             # process only JPG files
    exiftool --ext cr2 --ext dng DIR  # supported files but CR2/DNG
    exiftool -ext+ txt DIR            # supported files plus TXT
    exiftool -ext "*" DIR             # process all files
    exiftool -ext "*" --ext xml DIR   # process all but XML files
    exiftool -ext "*" --ext . DIR     # all but those with no ext


and changed -ext jpg to -ext "*" Since I thought so all files are edited. But this didnt work.

What i'm doing wrong?
Title: Re: How to rename files with different ext
Post by: StarGeek on April 29, 2019, 03:57:34 PM
To process MP4s as well as jpegs, all you need to do is add -ext mp4

The reason your listed command probably didn't work is because the MP4 files probably don't have a DateTimeOriginal tag.  DateTimeOriginal is an EXIF tag, which is rare in video files.  Most video metadata is in the Quicktime group.

If you run
exiftool -time:all -g1 -a -s
you'll see all the time related tags in the file.

The tag you probably want to use with the mp4 files is CreateDate but you might run into a problem. The timestamps in mp4 files are supposed to be in UTC time, while jpg images are usually set to the local time where they were shot.  If the timestamps are in UTC, then you can add -api  QuicktimeUTC and exiftool will adjust the time to the local timezone of the computer.

To put that all together, try this command
exiftool -o "Bearbeitet/" -fileOrder DateTimeOriginal "-filename=#%%1.3C.%%le" "-filename<${CreateDate}_test_%%1.3C.%%le" "-filename<${DateTimeOriginal}_test_%%1.3C.%%le" -d %%Y-%%m-%%d -ext jpg -ext mp4 -api QuicktimeUTC %1

The command will use the DateTimeOriginal if it exists, but fallback to CreateDate when it doesn't, like in MP4 files.
Title: Re: How to rename files with different ext
Post by: OOmatrixOO on April 30, 2019, 06:12:46 AM
Ok i understand and yes it works. Thank you very much.