I am wanting to record video of part of my house with a webcam while I am away for a few days to try and ensure any burgalers are photographed and the photo uploaded to my server before they even realise it.
I have setup a webcam to stream footage using mjpg_streamer. That works and is streaming OK.
It is possible to take a still capture from the stream whenever you want called 'FileName.jpg' :
wget http://127.0.0.1:8080/?action=snapshot -O FileName.jpg
I have an Amazon FTP server with Amazon Web Services and FTP access using sFTP. I am connected using Firefox's FireFTP plugin currently, so that works. The idea is to leave the computer running with the connection live.
I'd like to script the taking of a picture from the stream say every 1 minute and have the picture uploaded to my server via the live FTP connection, and either have the original file deleted off my PC so that the next one will save O or append a number to the end of each file and then FTP it up. e.g FileName1.jpeg, Filename2.jpeg.
I've Googled for hours and although there's loads of posts about scripting an FTP upload, I can't find any about a constant stream of uploading...i.e. "Watch this folder, upload the content every 1 minute and then a minute later upload whatever new content is in it".
I guess I need a bash script that will :
- keep a counter so that each newly created file gets a different name
- Send that filename to the "wget http://127.0.0.1:8080/?action=snapshot -O FileNameXX.jpg" every 30 seconds or 1 minute
- Upload the FileNameXX.jpg to the FTP server
But I have no idea how to do that! Can anyone direct me? Or does anyone know of a way to do with FileZilla or something (which cant watch a folder AFAIK : https://forum.filezilla-project.org/viewtopic.php?t=41609?