8
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?
1Why run an FTP server in EC2, when you can use S3 and the AWS CLI client for file uploads at a fraction of the cost? – trognanders – 2016-08-28T00:35:09.237
I have one of the free ones afaik. If the one you mention would be better for the task I'd use one though? – Gizmo_the_Great – 2016-08-28T07:51:58.077
Copying files to ftp with winscp is like 5 lines, see their website. – jiggunjer – 2016-08-28T11:32:24.663
And it is for Windows. We're talking Linux here. – Gizmo_the_Great – 2016-08-28T13:08:10.897
@Gizmo_the_Great It is certainly what I would use. – trognanders – 2016-08-28T21:52:46.933