HOME All Posts My Etsy Follow me on Mastodon for updates

How To Combine Wyze Motion-activated Videos Into One Long Video in Linux


Published July 5th, 2022 by Emily

A package was stolen from my package box recently. I knew it happened sometime between Saturday at noon and Sunday at 10 am. During that time I have 93 one-minute video snippets of my package box (I live on a busy street). Clicking on each one was quite tedious and watching each one in full on the Wyze app would take me over 15 hours, not including the time it takes to queue up the next one.

I decided to figure out how to export all those clips, combine them into one video, and watch it at 4x speed.

Get the videos off your camera

Pull the SD card from your camera. The video files are located in the "record" folder. They are saved as individual clips with the structure /record/date/hour/minute.mp4.

When you copy off just the clips you're interested in make sure to keep them in the same /date/hour/minute.mp4 structure!

Create script to process the clips

I created a script that:

  1. Pulls all the videos out of their nested folder structure and puts them into one folder.
  2. Creates a list of all of those files in numerical order so that they can be concated by ffmpeg later.
# !/usr/bin/python

import os

################################
## PULL FILES INTO ONE FOLDER ##
################################
dir_path = '../Videos'
days = os.listdir(dir_path)
for day in days:
hours = os.listdir(dir_path + "/"+day)
for hour in hours:
minutes = os.listdir(dir_path + "/" + day + "/" + hour)
if minutes != []:
for minute in minutes:
old_name = dir_path + "/" + day + "/" + hour + "/" + minute
new_name = dir_path + "/" + day + hour + minute
os.rename(old_name, new_name)

###########################
## CREATE FILE NAME LIST ##
###########################
videos = os.listdir(dir_path)
for vid in sorted(videos):
if ".mp4" in vid:
print("file" + " '" + dir_path + "/" + vid + "'")

Name this script processfiles.py.

Check that dir_path points to your videos!

Run script

Run the file using:

python3 processfiles.py > mylist.txt

This will create a new file mylist.txt which we will use in the next step.

Use ffmpeg to concat all the videos

If you don't already have ffmpeg, install it with:

sudo apt install ffmpeg

Run ffmpeg with:

ffmpeg -f concat -safe 0 -i mylist.txt -c copy allvids.mkv

Open allvids.mkv in VLC

VLC will allow you to increase the playback speed by going to the Playback menu option and selecting the speed option.

I watched it at about 3-4x speed and found my thief after about 15 minutes.