Renaming files and shifting time

lacibaci

Well-Known Member
Joined
Mar 5, 2015
Messages
1,616
Reaction score
818
Country
United States
This could be a general how-to and it is not necessarily exclusive to Garmin but since Garmin Dash Cam 55 is the only hardware I have with this behavior, here we go:

Problem:
Garmin's file naming convention stinks. Instead of using something like 20171231-153127.mp4 they decided on this: GRMN0001.MP4. Since the length of each segment is 1 minute, good luck finding you footage.

I decided on using ExifTool by Phil Harvey (http://owl.phy.queensu.ca/~phil/exiftool/) because I've used it before to organize my picture collection and it worked flawlessly. Also, the tool has command line interface and it is available for all OSs that I use (Windoze, Linux and macOS)

Garmin's files store several date/time tags:
Code:
lac@heron:~$ exiftool -s Desktop/DCIM/105UNSVD/GRMN0001.MP4 | grep -i date
FileModifyDate                  : 2017:08:07 04:03:58-04:00
FileAccessDate                  : 2017:08:07 20:45:24-04:00
FileInodeChangeDate             : 2017:08:07 19:30:40-04:00
CreateDate                      : 2017:08:07 12:00:31
ModifyDate                      : 2017:08:07 12:00:31
TrackCreateDate                 : 2017:08:07 12:00:31
TrackModifyDate                 : 2017:08:07 12:00:31
MediaCreateDate                 : 2017:08:07 12:00:31
MediaModifyDate                 : 2017:08:07 12:00:31

Out of these I liked "CreateDate" but unfortunately it is stored as UTC. Video above was created 2017/08/07 08:00:31 (EDT) local time. So I would like the tool to rename GRMN0001.MP4 to 20170807-080031.mp4

Solution:
Code:
lac@heron:~$ exiftool '-filename<CreateDate' -d %Y%m%d-%H%M%S%%-c.%%le -globalTimeShift -4 GRMN0001.MP4
The resulting file name will be: 20170807-080031.mp4

To execute ExifTool for all files in a directory create a script (ren-mpeg.sh):
Code:
#!/bin/sh
echo "Renaming and shifting (-4 EDT)..."
exiftool '-filename<CreateDate' -d %Y%m%d-%H%M%S%%-c.%%le -globalTimeShift -4 -r -ext MP4 -ext JPG $1

and run it like this:

Code:
lac@heron:~$ ./ren-mpeg.sh <directory>
 
maybe just view the details in explorer and include the file creation date in the list of fields to view
 
maybe just view the details in explorer and include the file creation date in the list of fields to view
I think you missed my point. The goal was to rename the file(s.)
 
I think you missed my point. The goal was to rename the file(s.)

yeah understood what you were doing, just pointing out that if the end goal was to be able to find things easier by knowing time and date you can see that info without having to do this, there are advantages and disadvantages to each type of file naming convention
 
This is a good idea, yes the filenames are annoying
 
The Garmin file modification times are accurate and not UTC. I found that you can import them with Lightroom and name the imported files according to date/time. But have had issues with import from a Panasonic camcorder so I don't really trust it.

Does anybody know of any open source programs that do the same thing?
 
Has anyone tried the Windows or Mac Virb Edit desktop version (not the mobile app)? I use to use it with my GoPro but not longer have a Windows or Mac machine as I use Chromebooks now.

The PC / Mac Virb desktop program was pretty robust last I used it..
 
Back
Top