1

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.

4
  • If you are doing streaming, why don't you use a protocol that's designed for streaming like RTP, instead of trying to use a protocol like FTP that's made for transfers of files of fixed size? There's plenty of Linux programs that support streaming, both on the sending and receiving side.
    – dirkt
    Jun 21, 2017 at 15:00
  • @dirkt Ah thank you! I was unaware of RTP I will investigate. I have a simple online with godaddy I was intending to use. Do you know if I could configure the server to accept RTP?
    – Lahcahnoe
    Jun 21, 2017 at 15:17
  • That entirely depends on what your godaddy host offers, which I know nothing about. But if you can install arbitrary programs, you should be fine. See e.g. here how to accept an RTP stream, and store into files - that would be the server side.
    – dirkt
    Jun 21, 2017 at 16:49
  • @dirkt thanks for the help, will investigate further
    – Lahcahnoe
    Jun 21, 2017 at 19:32

0

You must log in to answer this question.

Browse other questions tagged .