How to interpret the timestamp in filename in downloaded files
Hi I had to, one at a time :-(, to download 543 videos, not I need to be able to label to file names correctly. i.e. the downloaded file from Ring: 1272036\_6870141820246961153\_stamp.mp4 How do I translate the filename to a proper yyyyMMddhhmmss name? Thanks
7249 •
0 •
10 •
28-09-2020 07:50:49
Responses (8)
- W
WOW, but still sounds GREEK to me. Why can't Ring just make it easy on its users and rename all the files for us? Hate it when a company is NOT customer-centric/friendly
•0
11-05-2021 09:20:41
- S
For anyone still looking for this, I created a PowerShell Script to rename the files. function Convert-RingNameToDate { [CmdletBinding()] param ( [Parameter(Mandatory=$true, Position=0, HelpMessage='Please add a help message here')] [System.Int64] $number ) $bits = [Convert]::ToString($number,2) $MSB = [string]$bits[0..30] -replace(' ','') $Dec = [convert]::ToInt64($MSB,2) $Epoch = Get-Date -Date "01/01/1970" $DateTime = $Epoch.AddSeconds($Dec) return (Get-date ($DateTime) -Format YYYY-mm-dd-HH-mm-ss) } $Folder = "D:\Temp\Ring" $Items = Get-ChildItem $Folder -Filter *.mp4 -Recurse Foreach ($item in $Items){ $newname = "$(Convert-RingNameToDate($item.BaseName)).mp4" if (-not (Test-Path "$($item.DirectoryName)\$($newname)") ){ $item | Rename-Item -NewName $newname } } To use: Where I download the videos in a ZIP file, and they are named: 6946548309236321348.mp4 Change $Folder to the location of your Ring Video files. You can modify the format of the filename from "yyyy-MM-dd-HH-mm-ss" to anything you like. [PowerShell date formatting](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-date?view=powershell-7.1#example-3--get-the-date-and-time-with-a--net-format-specifier) One more thing: I found the conversion to date/time was in UTC. If you wish to add or remove hours edit the line: $DateTime = $Epoch.AddSeconds($Dec) to $DateTime = $Epoch.AddSeconds($Dec).AddHours(-5) # CST
•2
11-04-2021 11:46:21
•
VThanks for writing the Powershell script! Only the format method was not correct. return (Get-date ($DateTime) -Format "yyyy/MM/dd HH:mm K")
•0
30-04-2021 08:59:05
WHi there. I just saw that the Ring Video file names are now in the form: Ring_542010902_2123_7079275696466310081.mp4 Can you updated your PowerShell script to cater for this new format? Much thanks! I could not get the script above to run, but will post the results on a separate post (to convert older videos using the older format of something like 7079275696466310081.mp4)
•0
29-03-2022 02:26:00
UWorkaround: Use advancedrenamer.com and rename the file with replace method with this setting: Text to be replaced: `(.*)_(.*)_(.*)_(.*)` Replace with:` \3_\4_stamp` Use regular expressions :white_check_mark: Then apply the skript from above.
•0
15-04-2022 05:17:29
- V
And for who is interrested, I've converted the Powershell script to a Python3 version: import datetime def ConvertDingIdToDateTime(dingId): bits = format(dingId, '0>42b') MSB = bits[0:31] dingDateTime = datetime.datetime.fromtimestamp(int(MSB,2)) return dingDateTime
•1
30-04-2021 09:00:21
•
DI don't suppose you have the full script for this? I cannot get it to work for me
•0
03-08-2021 02:59:43
AThanks to @vorigeweek for the Python bit! Here's *a* full script @Dan5ive. It's insanely ugly but I was in a hurry to get something to work. ``` from os import listdir from os.path import isfile, join import datetime import os def ConvertDingIdToDateTime(dingId): bits = format(dingId, '0>42b') MSB = bits[0:31] dingDateTime = datetime.datetime.fromtimestamp(int(MSB,2)) return dingDateTime # Make sure this path contains the videos you want to convert the filenames of my_path = "C:/Ring/" only_files = [f for f in listdir(my_path) if isfile(join(my_path, f))] for f in only_files: # Just in case file name has already been converted if "stamp" in f: old_file_name = my_path + f # Assumes files are in this format: 71155064_7033625730319564493_stamp.mp4 # Removes everything before the first underscore # Removes everything after the second underscore # Converts datetime to string in yyyy-mm-dd_hh_mm_ss format # Prepends path and appends .mp4 extension new_file_name = my_path + ConvertDingIdToDateTime(int(f.split('_', 1)[-1].split('_', 1)[0])).strftime("%Y-%m-%d_%H-%M-%S") + ".mp4" os.rename(old_file_name, new_file_name) ```
•0
27-11-2021 03:26:29
- W
How do I request Ring do the conversion for us non-technical folk (I would think a MAJORITY of users are in this camp) so the videos are named something like: 20210715-201523.mp4 where the video was taken on July 15, 2021 at 8:15:23PM ? AFAIK, Samsung smartphones and some cameras already name their files this way (or very similar).
•1
17-07-2021 08:50:05
•
- D
I've very recently discovered the filename issue. The day I need 80 videos that I can easily navigate the time each was taken, I find its just a string of numbers... I tried using the desktop app (I have an iMac) as I read this way of downloading files changes the filename to include a timestamp. But... you can only download one video at a time and if you have two videos taken within a minute it will only save one as the file name is the same. This is really annoying
•0
03-08-2021 02:49:08
•
Didn't find an answer ?
Log in or create your Ring account to post a question and join in the on the conversation.
Community Resources
©2024 Ring LLC or its affiliates
ecks
Hi Michael, the translation is simple, just convert the 6870141820246961153 number to hexa, use eight MSB bytes, convert to decimal, multiply by 1000 and convert th result from system time to date time. Your downloaded file was recorder on Tue Sep 08 2020 15:39:02 Regards, Michael
4
30-01-2021 06:30:47
•