Compare commits

..

2 Commits

Author SHA1 Message Date
abb61f9f88 YACWC 2025-07-14 12:52:32 -04:00
cc5f670374 bump 2025-07-14 12:52:30 -04:00
2 changed files with 69 additions and 3 deletions

6
.gitignore vendored
View File

@@ -139,9 +139,9 @@ venv.bak/
# mkdocs documentation
/site
.mp4
.m4v
.mkv
*.mp4
*.m4v
*.mkv
# mypy
.mypy_cache/
.dmypy.json

View File

@@ -0,0 +1,66 @@
frigate_root = '/home/thebears/Videos/frigate/recordings'
output_vid_path = '/home/thebears/Source/frigate_video_create/video.mp4'
valid_cameras = {'nestcam3pb4'}
import os, sys
paths_add = list()
for dir_path, sub_dirs, files in os.walk(frigate_root):
camera = os.path.split(dir_path)[-1]
if camera in valid_cameras:
for f in files:
paths_add.append(os.path.join(dir_path, f))
# %%
import datetime as dt
import pytz
gmt = pytz.timezone('GMT')
est = pytz.timezone('US/Eastern')
dt_videos = dict()
for c_file in paths_add:
split_c_file = c_file.split('/')
c_date = split_c_file[-4]
c_hour = split_c_file[-3]
c_min_sec = split_c_file[-1]
date_str = c_date + " " + c_hour +"." + c_min_sec.replace('.mp4','') + ' GMT'
dc = dt.datetime.strptime(date_str, '%Y-%m-%d %H.%M.%S %Z')
c_datetime = gmt.localize(dc).astimezone(est)
dt_videos[c_datetime] = c_file
# %%
skp = 100
import cv2
video_out = cv2.VideoWriter(output_vid_path, cv2.VideoWriter_fourcc(*'mpeg'),30,[3840, 2160])
paths_write = list()
for i, x in enumerate(sorted(dt_videos)):
if ((i%100) != 0):
continue
vid_path = dt_videos[x]
paths_write.append(vid_path)
from tqdm import tqdm
idx = 0
for vid_path in tqdm(paths_write):
cap = cv2.VideoCapture(vid_path)
_, fr = cap.read()
cap.release()
video_out.write(fr)
idx +=1
video_out.release()