Howto rename MOV files using 'CreateDate'

Started by zivodevo, May 20, 2010, 08:26:49 AM

Previous topic - Next topic

zivodevo

1st time user and I'm stuck with a command line that will allow me to rename a bunch of MOV files based on the 'createdate'. I've tried also sorts of variations without success. This one (exiftool "-FileName<CreateDate" -d "%Y%m%d_%H%M%S.%%e" DIR) does not find the MOV files as I'm assuming it's just looking for images but it would be exactly what I'm after.

Can anyone assist please?

Regards,

Pete from NZ. ???

Phil Harvey

Hi Pete,

You've got the right idea.  I think reading FAQ number 16 will help you solve your problem.

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

zivodevo

Phil,

Thank you for your prompt reply. I got it processing now with expected errors as the 'createdate' line has characters that are not writeable in Windows.Warning: Error creating 'Test/2010-02-12T13:27:14-0800' - Test/20100213-092954.MOV

Any way to remove undesirable characters like : & T?

Pete

Phil Harvey

Hi Pete,

The -d option specifies the exact formatting of the date/time tags, so you can set the format to whatever you want.  I don't see how you could possibly get the problem you specified unless either:

1) you used "-d %Y-%m-%dT%H:%M:%S" in your command

2) the CreateDate tag you are extracting is in a (very) non-standard location

3) you are using a very old version of exiftool

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

zivodevo

Phil,

I used this code (exiftool "-FileName<CreateDate" -ext MOV -d "%Y%m%d_%H%M%S.%%e" Test) and got this output.

C:\Convert>exiftool "-FileName<CreateDate" -ext MOV -d "%Y%m%d_%H%M%S.%%e" Test
Warning: Error creating 'Test/2010-02-12T12:36:38-0800' - Test/20100213-083739.MOV
Warning: Error creating 'Test/2010-02-12T13:27:14-0800' - Test/20100213-092954.MOV
    1 directories scanned
    0 image files updated
    2 files weren't updated due to errors


when dropping the file onto ExifTool, this is what the data extracted looks like:

ExifTool Version Number         : 8.19
File Name                       : 20100213-092954.MOV
Directory                       : C:/Convert/Test
File Size                       : 68 MB
File Modification Date/Time     : 2010:05:20 22:40:56+12:00
File Permissions                : rw-rw-rw-
File Type                       : MOV
MIME Type                       : video/quicktime
Major Brand                     : Apple QuickTime (.MOV/QT)
Minor Version                   : 0.0.0
Compatible Brands               : qt
Version                         : 0
Modify Date                     : 2010:05:20 10:40:56
Time Scale                      : 600
Duration                        : 02:37
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 3
Track Version                   : 0
Track Create Date               : 2010:02:12 21:27:14
Track Modify Date               : 2010:02:12 21:27:27
Track ID                        : 1
Track Duration                  : 02:37
Track Layer                     : 0
Track Volume                    : 0.00%
Image Width                     : 640
Image Height                    : 480
Graphics Mode                   : ditherCopy
Op Color                        : 32768 32768 32768
Compressor ID                   : avc1
Source Image Width              : 640
Source Image Height             : 480
X Resolution                    : 72
Y Resolution                    : 72
Compressor Name                 : H.264
Bit Depth                       : 24
Video Frame Rate                : 30.01
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2010:02:12 21:27:14
Media Modify Date               : 2010:02:12 21:27:27
Media Time Scale                : 44100
Media Duration                  : 02:37
Media Language Code             : und
Balance                         : 0
Handler Class                   : Data Handler
Handler Type                    : Alias Data
Handler Vendor ID               : Apple
Handler Description             : Core Media Data Handler
Audio Channels                  : 1
Audio Bits Per Sample           : 16
Audio Sample Rate               : 44100
Audio Format                    : chan
User Data mod                   : iPhone 3GS
Create Date                     : 2010-02-12T13:27:14-0800
User Data swr                   : 3.1.2
User Data xyz                   : +34.0952-117.7699+277.000/
User Data mak                   : Apple
XMP Toolkit                     : XMP Core 4.4.0
Creator                         : Peter Stothers
Image Size                      : 640x480
Rotation                        : 90


Maybe something to do with the way that Apple code the 'createdate'? My problem is, the createdate is the only accurate time that movie was taken. Other dates and times are based on NZDT time even though the iPhone date and time was set correctly to my location (US at the time).

Pete

Phil Harvey

#5
Hi Pete,

Ah, I see the problem.  I will fix this in the next release.  There is one QuickTime CreateDate tag which is not being formatted properly.

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

zivodevo

Thank you Phil, outstanding support! Love the software. Simple yet extremely powerful.

zivodevo

Hi Phil,

Have just tried your new 8.20 version and now nothing gets scanned and no errors. Using the same code as above with a dozen or so MOV files in my "Convert" folder. Any clues?

C:\Convert>exiftool "-FileName<CreateDate" -ext MOV -d "%Y%m%d_%H%M%S.%%e" Test
    1 directories scanned
    0 image files read

C:\Convert>

Phil Harvey

"Convert" folder?  Your command processes images in a "Test" folder.  This command should work if the "Test" directory contains any .MOV files.

Try "dir Test" to see what the directory contains.

If you wanted to process images in the "Convert" folder, you should do this after changing to the "Convert" directory:

exiftool "-FileName<CreateDate" -ext MOV -d "%Y%m%d_%H%M%S.%%e" .

or this from anywhere:

exiftool "-FileName<CreateDate" -ext MOV -d "%Y%m%d_%H%M%S.%%e" c:\Convert

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

zivodevo

Wow Phil, fast reply!

If I move my files to the test folder it works! Thank you.

Tried running the command you gave me in another folder with ExifTool in that folder too but it doesn't want to work. Am I missing something? Can the ExifTool.exe be located somewhere central and referred to in the command line?

C:\Adownloads\!ToFile\iPhone\Vid>exiftool "-FileName<CreateDate" -ext MOV -d "%Y
%m%d_%H%M%S.%%e"
No file specified

C:\Adownloads\!ToFile\iPhone\Vid>

Phil Harvey

You forgot the "." at the end of the command to indicate the current directory.

It looks like it was finding exiftool.exe OK.  But yes, you can put exiftool.exe somewhere central -- just follow the installation instructions for Windows.

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

zivodevo

Thank you Phil, all working beautifully now!

For those that are interested and that may be using XBMC too, after renaming the MOV files with the date and time the movie was taken, I then use FFMPEG to create thumbnails with a *.tbn extension 5 seconds into each clip using the following code.

for %i in (*.mov) do ffmpeg -i "%i" -f mjpeg -t 0.001 -ss 5 -y "%~ni.tbn"

Place ffmpeg in your Windows\System32 folder. Change how far in ffmpeg goes to create the thunmbnail by modifying the -ss 5 switch and the (*.mov) switch to whatever extension your movie has.