In the first part of this article, I went over the details of a process for renaming photos to include the geographic location in the filename. Some people asked if the same can be done for videos, and the answer is “probably.”
Earlier this year, I went on a month-long overlanding trip across the US. I mounted a bunch of GoPro cameras all over my truck and took thousands of videos. Upon returning home – exhausted and sunburned – I quickly realized that my recollection of the entire trip consisted primarily of driving, refueling, and looking for campgrounds or hotels.
I couldn’t remember which parks or even which states I visited. So when I looked at my collection of several terabytes of video recordings with informative filenames like “GH010182.MP4,” I realized that getting through this pile will take some effort.
I needed a quick way of glancing at the filename and immediately knowing when and where the video was made. GoPro encodes GPS coordinates, among other useful data, within the MP4 file, and this information can be extracted with
However, seeing something like “38.626,-109.508” doesn’t tell me much. The latitude and longitude need to be converted to a recognizable address, requiring a geolocation service. I used Geocodio, which met my needs and budget.
The script is below, and you can also download it from my GitHub repo. You must get your own API key from Geocodio and insert it in the script. Before you run the script, you must make a backup of your videos in case the renaming process goes awry.
Simply go to the directory containing your video files and run the script. It will only process the files in the current folder without going into any subfolders. You can change this behavior by adjusting the
-maxdepth argument for the
find command. You may also change the filename mask to match your needs.
These were the original names of the files I used for testing this script:
GH010135.MP4 GH010162.MP4 GH010182.MP4 GH010288.MP4
And these are the new names created by the script:
20220706-1128-000-190_s_park_st_lake_city_co_81235-31s-GH010135.MP4.mp4 20220706-1318-000-497_county_rd_30_lake_city_co_81235-13s-GH010162.MP4.mp4 20220707-1321-000-1098_county_rd_33_lake_city_co_81235-120s-GH010182.MP4.mp4 20220712-1825-000-1119_state_hwy_191_moab_ut_84532-411s-GH010288.MP4.mp4
Experienced Unix/Linux System Administrator with 20-year background in Systems Analysis, Problem Resolution and Engineering Application Support in a large distributed Unix and Windows server environment. Strong problem determination skills. Good knowledge of networking, remote diagnostic techniques, firewalls and network security. Extensive experience with engineering application and database servers, high-availability systems, high-performance computing clusters, and process automation.