Script to merge thousands of 60 seconds (~ 5 MB) video clips into 1

Is there a script to merge thousands of 60 seconds (~5 MB) video clips used by “continuous recording”?
Adding hundreds of video clips into VLC playlist is a lousy workaround. I’d like 1 large video clip so I can fast forward/rewind.

I can’t imagine dealing with thousands of 60 seconds (~5MB) clips on personal roadmap for Network Attached Storage (NAS)

1 Like

I believe FFMPEG can do this, but I haven’t done it myself.

This is too complex for an average user
You must know every files name, which has to be unique. Wyze writes same file name in every folder. In other word, there’s no continuous sequence, so it won’t work.

Is there a simple solution to drag 10 folders (10 days of footage) with 14400 video files (10 days of footage) recorded by Wyze and get 1 video file?

1 Like

Still looking for a program suggested by @mpulsiv.

Did find a temporary work around using ffmpeg and bash

  1. cd to the destination of the file ex: cd /mnt/e/record/20190218/12
  2. then run this ffmpeg command: ffmpeg -f concat -safe 0 -i <(find . -name ‘*.mp4’ -printf “file ‘$PWD/%p’\n”) -c copy output.mp4

this will put a merged file in the directory. You can then just use the up arrow key twice to call back teh cd command and go to the next subdirectory (i.e. hour) ex: cd /mnt/e/record/20190218/13
Then up arrow twice again and re-run the command from step 2.

There must be a way to loop this, but I’m not experienced enough.

If you’re on windows you can get BASH by installing ubuntu in the windows store

So I’m no expert but this is what I use and it works on my Mac.

This will create a single .mkv file for each days worth of footage.
It requires FFMPEG to be installed. To install it I recommend installing homebrew and then using homebrew to install FFMPEG

  1. Copy SD card contents to the mac (I recommend downloads folder)
  2. Open terminal and change directory to the record folder that was on the sd card. If you had saved it in downloads this will be cd Downloads/nameofSDCARD/record
  3. Once the terminal is in the record directory copy and paste the below script

for day in $(ls); do

only executes loop for day folder

ls $day//.mp4 || continue

skip folders already concat

[ -f $day.mkv ] && continue

create txt lists

echo “Compiling $day…”
ls $day//.mp4 > $day.lst

Prepend txt lists

sed -i -e ‘s/^/file /’ $day.lst

Concat each day

ffmpeg -nostats -f concat -i $day.lst -c copy $day.mkv
echo “done”

This will then go through and you will be left with a .mkv for each day. This is usually pretty fast and takes 5 mins to do 5 days worth of footage on my 15" MacBook Pro.

Hope this helps someone.

I am very new to terminal. Could you give me a little more to get started? What exactly is the script?

For example, if I want to concatenate all of the video files in one day, what would my script look like, and how exactly do I run it?

Sorry, I know I’m asking a lot.

any updates to this? can you put it in my script file so we can put it on our mac, and once we have the sdcard files to our computer, we can just click this script and it’ll do its job? Thanks in advance