diff --git a/main.go b/main.go index 0e8cff8..f73dfe1 100644 --- a/main.go +++ b/main.go @@ -88,8 +88,8 @@ func main() { if frameCount >= motionDetectInterval { if detectMotion(img) { // Determine if a new recording needs to start, we may already have one running - if time.Now().After(lastMotionDetectedTime.Add(time.Second * recordLengthAfterMotion)) { // - fileName := fmt.Sprintf("%s/storage-security-%s.avi", syncFolder, time.Now().Format("2006-01-02-15-04-05")) + if time.Now().After(lastMotionDetectedTime.Add(time.Second * recordLengthAfterMotion)) { + fileName := fmt.Sprintf("%s/storage-security-%s.avi", syncFolder, time.Now().Format("2006-01-02-15-04-05")) // My preferred timestamp format is RFC3339, however there are weird filesystems out there that don't like colons in the names of files such as NTFS or FAT32. log.Printf("motion detected, started recording to file named %s", fileName) currentRecording, err = gocv.VideoWriterFile(fileName, "MJPG", 25, img.Cols(), img.Rows(), true) if err != nil {