Renaming AVI files

Started by DanHouston, September 01, 2015, 07:30:28 PM

Previous topic - Next topic

DanHouston

I'd like to rename my AVI files to have the date included in the name, but I can't seem to get it....

Here's what I've done:
exiftool -s "capture 01.avi"

I did that to find the tag I wanted, which in my case it is:
ShotDate                        : 12/26/2006 12:00:00 AM

Test it out:
Y:\video\Raw\Raw Tapes\tape01 - Copy>exiftool -ShotDate *.avi
======== capture 01.avi
Shot Date                       : 12/26/2006 12:00:00 AM
======== capture 02.avi
Shot Date                       : 12/27/2006 12:00:00 AM
======== capture 03.avi
Shot Date                       : 12/27/2006 12:00:00 AM
======== capture 04.avi
Shot Date                       : 12/30/2006 12:00:00 AM
======== capture 05.avi
Shot Date                       : 12/30/2006 12:00:00 AM
======== capture 06.avi
Shot Date                       : 1/1/2007 12:00:00 AM
======== capture 07.avi
Shot Date                       : 1/3/2007 12:00:00 AM
======== capture 08.avi
Shot Date                       : 1/13/2007 12:00:00 AM
======== capture 09.avi
Shot Date                       : 1/20/2007 12:00:00 AM
======== capture 10.avi
Shot Date                       : 1/20/2007 12:00:00 AM
======== capture 11.avi
Shot Date                       : 1/20/2007 12:00:00 AM
======== capture 12.avi
Shot Date                       : 1/20/2007 12:00:00 AM
======== capture 13.avi
Shot Date                       : 1/21/2007 12:00:00 AM
======== capture 14.avi
Shot Date                       : 1/21/2007 12:00:00 AM
======== capture 15.avi
Shot Date                       : 1/21/2007 12:00:00 AM
   15 image files read

Try to rename the files:
Y:\video\Raw\Raw Tapes\tape01 - Copy>exiftool -ext AVI -d NAME%Y_%m%d_%H%M%S%%-c.%%e "-filename<ShotDate" *.avi
Warning: No writable tags set from capture 01.avi
Warning: No writable tags set from capture 02.avi
Warning: No writable tags set from capture 03.avi
Warning: No writable tags set from capture 04.avi
Warning: No writable tags set from capture 05.avi
Warning: No writable tags set from capture 06.avi
Warning: No writable tags set from capture 07.avi
Warning: No writable tags set from capture 08.avi
Warning: No writable tags set from capture 09.avi
Warning: No writable tags set from capture 10.avi
Warning: No writable tags set from capture 11.avi
Warning: No writable tags set from capture 12.avi
Warning: No writable tags set from capture 13.avi
Warning: No writable tags set from capture 14.avi
Warning: No writable tags set from capture 15.avi
    0 image files updated
   15 image files unchanged

I read the FAQ about having to use -ext AVI so it would process a non-writable file. Then I read something that implied it can't change any TAG (including the filename tag) of non-writable files which leads me to believe it can't rename an AVI file....Seems like people are doing it so I figure I must be doing something silly?

Thanks,
Dan

Phil Harvey

Hi Dan,

I can't understand why this doesn't work.  Having said this, I don't have an AVI sample that contains a ShotDate.  If you could send one I could try this out.  My email is philharvey66 at gmail.com

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

DanHouston

Sent you a sample this morning. Hopefully it made it.

Thanks,
Dan

Phil Harvey

Hi Dan,

I got the sample, but it contains no shotdate tag:

> exiftool -exiftoolversion -shotdate -time:all ~/Desktop/tape07\ -\ Clip\ 051.avi
ExifTool Version Number         : 10.00
File Modification Date/Time     : 2015:09:03 07:54:29-04:00
File Access Date/Time           : 2015:09:03 07:57:53-04:00
File Inode Change Date/Time     : 2015:09:03 07:54:41-04:00
Date/Time Original              : 2007:08:31 17:45:59
>


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

DanHouston

Sorry about that. I made an assumption that all of the files from that camera would have it and just looked for as small a file as I had handy. Investigating further it looks like at some point all of the files lose that and have createDateOriginal in them. I'm looking for a small enough file with shotdate that I can email now.

DanHouston

Just sent you a file with shotdate in it this time. Based on the fact that I have a mix of files with and without ShotDate I am guessing it must have been based on the software I used to capture the video from the camera. I thought I was fairly consistent and always used Vegas Movie Studio to capture and edit, but apparently not.

Phil Harvey

Ah.  I should have seen this in your ShotDate output.

The problem is that the date/time is formatted incorrectly, so it doesn't respond to the -d option.

Instead, you could use an advanced formatting expression, like this:

exiftool "-filename<${shotdate;my @a=/\d+/g;$_=sprintf('NAME_%.4d_%.2d%.2d_%.2d%.2d%.2d%%-c.%%e',@a[2,0,1,3,4,5])}" -ext avi DIR

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

DanHouston