So here's the situation. I'm trying to build a watching program for my linux box with an inbuilt webcam, that starts recording when motion is detected, and uploads the recording to my domain. Motion detection and recording is not a problem. The issue is uploading the recording to my server in realtime.
Consider the following scenario:
As this is meant to be a security device, that is meant to "catch trespassers", the potential exists for the laptop doing the recording to get shutdown and stolen also. As such, I'll need the recording to be uploading live while recording. I've seen this answer to a similar question about live uploading tcpdumps here:
Using curl, you can upload from STDIN to a file via FTP this way:
tcpdump -w - | curl -u FTPUSER:FTPPASS ftp://ftpserver/where/ever/dump.pcap -T -
where tcpdump outputs raw packets (compare this question) and curl appends (overwrites? not sure) this input. I'm not completely sure if this works, but it might be worth a try.(Timestamping the file curl creates is left as an exercise.)
My worry is that, should the ftp connection get severed, the video would become corrupt instead of just being truncated, but still viewable. I have read about a method of mounting the ftp folder to the filesystem, which I could possibly write the output recording to and (hopefully) have it upload whilst recording. Could anyone provide some guidance on this?
Cheers.