Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am working on a Project that involves taking the output from a Webcam which is in either jpg or h.264 format, and outputting it to a foreign server (HTTP / FTP would work, I am open minded). What is the most logical way of doing this.

I would imagine that it would be achieved with (command) | (commandtooutput [params]) [location]. Am I looking at this wrong?

With images, I would prefer to upload them periodically such as once a minute. Eventually I would like to allow for this period to be changed. Does this seem logical / realistic? I presume the most logical way to implement this would be with Python or BASH scripting, having the script read period information before each sync and then have the script adjust accordingly.

To give some background the output is from a Raspberry Pi's raspistill or raspivid program, (it will either be running ArchARM or the usual Raspbian). I decided not to place this question in those forums because I think it applies more any distro of Linux. I believe the only thing that is unique to the Pi in this situation is irrelevant to my question, however if this is an inappropriate place to ask let me know and I will be sure to move / delete the post.

share|improve this question
    
You could looks at how motion works, it can do remote copy of the captures. –  Emmanuel Feb 20 at 18:11
1  
The question is a bit broad, so it might be closed. Also some solution/implementations do depend on whether you want to keep the files on the originating system or delete them after successful upload –  Anthon Feb 20 at 18:14
    
@Anthon I apologize, I simply looking for a way of taking the output from a program which is an image or video and sending it to a remote server. I assume that the best way would be to pipe it [|] to a command that can send files to a a server (ftp) for example. I am not sure what the program is, and I was open to other suggestions. Emmanuel This is a good solution, however I do need to demonstrate uniqueness in my application, so I would prefer to demonstrate things I have create. –  aBitPastOne Feb 20 at 18:22
1  
Not necessarily. I would probably write the images to some directory, and have a job scanning that directory for files to upload (and delete them/mark them as processed). That is more robust if the connection is down for a short time. –  Anthon Feb 20 at 18:25
    
@Anthon Okay. So that's covered I still however need a realistic way to upload it. –  aBitPastOne Feb 20 at 18:44

2 Answers 2

In your case I would decouple the generation of the images and the uploading. You can do this by writing the images to a directory and on a regular basis (daemon, cron job) upload the images. That way you are more robust in case the connection to the server is down for a short period (or the server is rebooting for some reason).

The uploading can be done using rsync or rdiff-backup, if you want to keep the originals on the source side. Both work well over ssh, for which you would need a private/public key (without password) and copy the public key to the server.

If you don't want to keep anything on the client, you probably can just have small script that upload the files using scp (again with using ssh underneath) and removing the files once copied.

Uploading using HTTP and automating FTP is in my experience somewhat more cumbersome, especially if you already have ssh running on the server. For calling scp or rsync or uploading using HTTP you con't need Python. If you have to use FTP you might want to use it's ftplib

share|improve this answer
    
Thank you, when you refer to SSH are you implying that a remote client would be used to activate a script? I would like to make it a daemon based utility, does that still require SSH ? –  aBitPastOne Feb 21 at 21:08
1  
SSH is the transfer protocol that scp uses (and so does rsync over ssh). No remote client activation, either use cron, or have the script be daemon and check every X seconds. –  Anthon Feb 21 at 22:05

I would take a look at the application motion. It Here are 2 videos on youtube that show it being set up and configured.

Motion has facilities for relaying images to a remote server. You can use wput to relay images to a FTP server, for example.

on_picture_save wput −−binary −−remove−source−files \
  ftp://USERNAMEHERE@jonathangraft.com:PASSWORDHERE@MY.SERVERS.EXTERNAL.IP %f

Or you can use scp:

on_picture_save scp -P2222 %f user@server.com:/path/to/motion/files/backup/
share|improve this answer
    
This program will be very helpful, thank you . –  aBitPastOne Feb 21 at 21:07
1  
@user2962219 - I've used it for years. It's extremely powerful. I esp. like the feature of automatically making timelapsed videos from a days worth of images. I then use the on_video_save to push these using an scp command to my NAS. –  slm Feb 21 at 21:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.