Here is how I set up a live webcam that takes also takes pictures and creates a time-lapse movie from sunriseto sunset.
You will need several things in addition to your internet connected Ubuntu/Mint computer
- The ability to set up port forwarding on your router
- An account at no-ip.com (nice, but not required) so you can type in nice human-friendly names instead of dotted decimal notation.
- A youtube account to upload your video to.
Be sure you have all the required packages..
- sudo apt-get install curl motion mencoder
GoogleCL requires you to authorize it to upload the first time, so just find a small video and upload it like so.
- google youtube post –category News –title "test"google test.avi
Google will open up a browser window/tab and ask you to authorize it, do it, then go back to the command prompt and continue. You can then delete this video.
Create the webcam directory..
- mkdir ~/webcam
Lets set up motion to capture images…
copy the following text and put it in your home directory as motion.con
This is pretty much the standard configuration file with the time-lapse section set up. If you are using a camera other than video0, just change it near the top of the file.
- Set up motion to run on log-in. This will depend on your the Desktop Environment you use.
Copy the following text into a file named ~/webcam/webcam-movie.sh
Now we need a file to determine sunrise/sunset. Copy the following text and put it into ~/webcam/oneam.sh
Issue the command chmod +x ~/webcam/*.sh to make the files executable.
Now you have to set up the script oneam.sh to determine sunrise/sunset and set up jobs to run at the appropriate times.
type crontab -e if this is your first time editing crontab, it will ask for an editor. I just nano because it is easy)
page down and type the following line.. substituting your username for the word user.
* 1 * * * /home/user/webcam/oneam.sh
If you are using nano, hit
-o (the letter) and to save, then -x to exit. If using another editor, save and exit.
- Go to http://www.no-ip.com if you haven’t already and set up an account. If your router doesn't support dynamic DNS, you will need to go to downloads and get the client. What this does is let no-ip.com know what your internet facing ip is so you can type in a easy to remember name instead of a bunch of numbers.
- Set up port forwarding on your router to forward port 8081 to the computer with the webcam.
Assuming everything went well, you should be able to see your camera's output by typing http://
:8081, if you have problems, try it on the computer with the webcam with http://127.0.0.1:8081 to and see if you can see anything. if you can see it like that, but nowhere else, check your firewall and port forwarding settings.
That should about do it. (assuming I didn't forget anything!!) Now you should be able to check your webcam from the coffee shop or whatever and have a nice youtube time lapse at the end of every day.