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:
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:
The resulting file name will be: 20170807-080031.mp4
To execute ExifTool for all files in a directory create a script (ren-mpeg.sh):
and run it like this:
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
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>