Skip to main content

How To: Renaming AVI movie files using the Date and Time the movie was digitized

I am fanatical about storing my photos and home videos on my NAS using the date and time they were taken so that any media renderer will naturally sort them chronologically. It also takes any guesswork out of figuring out when the movie or photo was taken as it's simply the file name i.e. 20110824-100559 being 2011, August 24th @ 10:05:59 AM. See my other post here that shows how I use "Lupas Rename 2000" to automatically do this for hundreds (or even thousands) of photos in seconds.

Recently I found some older AVI files that had been recorded on my retired Canon S2 digital camera. The associated THM (thumbnail) file that has the date and time the movie was created had been deleted so I needed a way to extract the date and time directly from the AVI file. Again, I use the excellent EXIF Tool by Phil Harvey to accomplish this task. A little tweak on the command line for the code I used to rename my IOS MOV files and we're underway.

Exiftool Installation for Windows 7/8
  • Download the excellent ExifTool by Phil Harvey here. Use the "Windows Executable" version.
  • Extract the program and rename the exe from 'exiftool(-k).exe' to 'exiftool.exe'
  • Move the 'exiftool.exe' program to C:\Windows
  • Further installation instructions here
Now to rename your AVI movie files using the date and time the movie was taken (the IDIT 26 Tag).
  • Copy the code below to the clipboard (highlight and use CRTL +C) exiftool "-filename<${datetimeoriginal}" -ext AVI -d "%Y%m%d-%H%M%S.%%e" . (don't forget the space and fullstop at the end)
  • Navigate to the folder where you have the movies stored. Don't enter the folder itself as you need to be selecting the folder in the next step
  • Hold down the 'Shift' key and right click the folder containing the movies pegged for renaming
  • Select 'Open command window here'
  • Right click and choose paste to drop in the exiftool code
  • Hit enter
  • After a period of time (see below), the command window will give you a report of the scan process

  • Your movies are now renamed using the date and time...cool.
Modifiers
How much stuff is in the folder dictates the time it takes to scan the folder so try and keep the folder void of everything but the movies that need renaming as the program will scan everything in the folder.

Creating corresponding thumbnails for XBMC
For those that are interested and that may be using XBMC too, after renaming the AVI 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.
  • Download ffmpeg and place it in your Windows\System32 folder
  • Copy this code: for %i in (*.avi) do ffmpeg -i "%i" -f mjpeg -t 0.001 -ss 5 -y "%~ni.tbn" (the last speech marks are part of the code)
  • As before, hold down shift and right click to open a command prompt in the right folder location
  • Right click in the command window and paste the ffmpeg code copied above and hit Enter
Thumbnails will now be created for every movie file with the same file name. You can change how far in ffmpeg goes to create the thumbnail by modifying the -ss 5 switch and the (*.avi) switch to whatever extension your movie has. XBMC will be very happy now!

Comments

Popular posts from this blog

Using ESPEasy with Home Assistant via MQTT

Preface: I've just started playing around with Home Assistant on a Raspberry Pi and exploring the world of MQTT to control devices on the network. Learning curve is a bit steep but worth the effort as MQTT is very fast. The hardware and software tools I'm using are as follows: 2 x Sonoff relay units 2 x NodeMCU Boards ESPEasy firmware (must be version 121 or above as that contains the MQTT 'retain' flag option. Home Assistant software on Raspberry Pi2 MQTT Test Software: PC: MQTT.fx Android: MQTT Dashboard

My Notepad++ tricks when editing YAML files in Home Assistant

To comment out a whole section in one go: Highlight the text you want to comment out and use CTRL + Q. If you do this at the start of a line, it will only comment that line. CTRL + Q is toggle mode (comment on/off). CTRL + K will allow you to add multiple comments one after the other.

Installing ha-bridge on your Raspberry Pi

EDIT: Updated 14th June 2017 to reflect version 4.5.5. Default port is now 80 to keep Google Home happy and service now supports MQTT! Advice on backups also added 7th Feb. Version 4x also supports adding a Home Assistant instance which is great! Want to control your Vera, Harmony hub or Home Assistant entities with your Amazon echo or Google Home? ha-bridge is the best way to achieve that and installation is actually quite easy and takes less than 5 minutes. Here are the steps.