Instructables
Picture of Raspberry Pi remote webcam
This will allow you to create a remote webcam for your Raspberry Pi so that you can view it from any computer on the local network. For this instructable you will need:

• Raspberry Pi with an Whezzy Raspbian installed and internet connection established
• Webcam (I use PS3 Eye Camera, but it will work with most USB webcams)
• IP address on your local network (this can be found with the command $ ifconfig and should be something like: 192.168.1.105)
 
Remove these adsRemove these ads by Signing Up

Step 1: Getting started

Picture of Getting started
step02.jpg
Run up your Raspberry Pi to the command prompt

Install the webcam server software using the following command:
$ sudo apt-get install motion

This will take a few minutes to download and install but once it has finished and takes you back to the command prompt we are ready to continue.

Step 2: Configure the software

Picture of Configure the software
Next we need to edit some of the config files so that the motion service will start on run up and be available on local network.

First we will edit the motion.conf file by typing:
$ sudo nano /etc/motion/motion.conf

This is quite a large conf file but the points you need to edit are:
DAEMON = OFF (change to ON)
Webcam_localhost = ON (Change to OFF)

Step 3: Set the service up

Picture of Set the service up
Next we need to enable the Daemon (service):
$ sudo nano /etc/default/motion

start_motion_daemon = no (change to yes)
plinskyyesterday

Hi, great tutorial.

I followed your tutorial and now i have a little webcam installed on my PI and it works great. I made also a NAT to see it on the web and used an android app to see it on the go. I'm still experimenting (...not sure about this word, i'm not english) but soon i will post all steps to share with you all my experiment.

Iancoates11 months ago

Hi, good tutorial.

I tried it and the only thing that appears in the browser is a load of random characters. Could you please post all the other settings you have from step 3.

thanks, Ian

Hi Iancotes, I am also getting these issues of the strings of text when port forwarding. I have other port forwards set up (remote desktop etc) but this one doesn't seem to like it. Two fresh installs, one running over WiFi and the other over LAN. Any assistance would be SUPER!

Inside the network this is cracking software.

Hi, this is normally due to some versions needing the webcam image to be contained in an html document and many combinations of browsers e.t.c mean viewing is hard. A fail-safe option is to use VCL media player and selecting, 'play from URL'. Type in eg. http://[yoururl][:portnumber] and you should be good

hope this helped

agasthyahs126 months ago

Getting an error !!!!

Unable to open video device....

i am using HP usb webcam pro to get video stream

picamera.png

you need to reduce quality in the /etc/motion/motion.conf file as webcam's max is

below 352 x 288

I hate to break it to you, but even though you censored your IP in the address bar, it still shows in the bottom left corner...

AllahA scott!14 days ago

rofl

MichaelW6 scott!3 months ago

That's a local IP address(RFC1918) anyways so no one outside of his/her network can access it anyways.

did you get it running??? what was d reason ??

JakeB3 made it!5 days ago

Works great, worth mentioning if something goes wrong along the way

/sudo apt-get remove motion is a good fix, and then going back to step 1 although the /etc/motion/motion.conf preferences stay.

I'm using the play station eye at 640 x 420 and still getting a good 15-20 fps so no complaining!

Anyone wondering about port forwarding its relativly easy although security is almost impossible and password protection is also weak.

Screen Shot 2014-12-23 at 02.07.14.png
ramgarden28 days ago

Has anyone that's gotten this working had it where it stops working after a while? I can SSH in to the pi so I know it's still up and running, and I can use the "top" command to see that "motion" is still running. But when trying to view the video stream it shows the "broken image" icon in place. When I "sudo reboot" the pi it's back to working fine again. Is there something happening in the web server portion of the motion executable that crashes?

Im SSH in works great....if you dont have the right webcam wont work period....tried for a few hours before i got a new cam, worked the first time.

can be many things:

the web browse you use, firefox is your best bet for testing, IE or chrome do not like the mjpeg implementation used in motion.

I regularly run into the issue that the /var/run/motion/ disappears between reboots change the pid line in the configuration file to /var/run/motion.pid

mentionned in the tuto change the local stream parameter to off otherwise you can only see it on the local device

finally you may have a size/framerate combo that requires too large of a bandwidth for your wifi try 640x480 at 2 fps for trouble shooting then increase resolution and or frame rate

Hope this helps

ramgarden made it!2 months ago

I made one of these with the raspberry pi camera module and attached the pi and camera to our Makerbot Replicator2 3D printer so we could remotely watch our prints to check their progress. Thanks for these simple instructions!

20141026_205004.jpg

Im doing the same thing but im mounting it over our rotary engraver!

MICELIA1 month ago

Motion works on localhost but not from the network i've a blank screen.

kaneb12 months ago

it s ok with mozilla firefox.... but the streaming is 3 - 4 seconds dalay ..... is it normal ??? is there an instruction to cut delay ??

MattH32 months ago

I am getting a blank screen with a broken image icon. Is my webcam not supported?

sudosilo9 months ago

What if I have the Raspberry Pi camera in place of a usb camera, I did the above steps and I get "unable to open video device"

RobertV4 sudosilo2 months ago

http://www.raspberrypi.org/forums/viewtopic.php?t=44966&p=379561#p374790

misq372 months ago

motion files not found 404 not found

sat481 (author) 4 months ago

Sorry i have not answered any questions on my instructable for a while, but I have a new job that take me away a lot. If you are having problems accessing the feed then try dropping the resolution to 352x288 and see if that works.

Some browsers do not support Motion JPEGS so will not work with this project. It should work fine in Firefox and I think Chrome.

sat481 (author) 4 months ago

Sorry i have not answered any questions on my instructable for a while, but I have a new job that take me away a lot. If you are having problems accessing the feed then try dropping the resolution to 352x288 and see if that works.

Some browsers do not support Motion JPEGS so will not work with this project. It should work fine in Firefox and I think Chrome.

paulohen4 months ago

Thank you for your tutorial.

kohee7 months ago

Very well written and easy to understand and follow from a noob point-of-view. I've got everything loaded but I can't access the camera from my LAN. The video does start to load from my iPhone, but then it disappears. It doesn't even load on my desktop. I've updated and upgraded the OS and I've double checked all of the instructions. Any ideas? Thanks in advance.

maboy kohee6 months ago

Check the frame rate, resolution, etc. in the configuration file, like when you go in to edit the daemon settings. I have a bit of an issue with the frames not loading entirely, which I was able to minimize by lowering the resolution. If your browser still cant load the frames fast enough or properly, I'm sure you could export the frames to a video file.

Great..I did it . It worked in firefox only for me but not on IE and chrome any solution please????

will this procedure work for Raspberry pi with arch linux installed on it?

5t0rm9 months ago

I tried it but I cannot access the server from any computer in my house for some reason

Ho Lee Shiet9 months ago

I successfully got the remote webcam working by following your tutorial but the resolution and framerate is quite crappy when I open it in VLC player. How to fix it?

gheciobanu11 months ago

Great tutorial, i did it and it works!

but will it work on another internet conection? or will it only work on my home network?

sat481 (author)  gheciobanu11 months ago

Hi gheciobanu,

Many thanks for trying my instructable and glad it is all working. At the moment it will only work on your home network. To make it work via the internet is simple and I was was going to do another instructable on that, but the problem is that you need to set up port forwarding on your router and everyone is different.

The basics are you find out your internet IP (go to http://www.whatismyip.com/ and it will tell you). Set up Port Forwarding on your router so that port 8081 is forwarded to your Pi and then access it by changing the IP to your internet IP rather than the Pis.

Regards,

Sat

sat481 (author) 11 months ago

Hi Ian,

I have done a bit of
research and it appears that your webcam should work but there has been some
reports of problems:



Microsoft

LifeCam

VX-3000



raspbian/wheezy





There
do appear to be some issues with image quality and getting partial frames and
such, with fswebcam

this information is
from: http://elinux.org/RPi_USB_Webcams .
I have had a problem with my DSLR when using it with the Pi, it is fine running
from command line but as soon as I start the GUI (startx) it fails to connect. The
problem you’re having might I be something similar but I suspect you are using
it from command line anyhow, so this would not matter. There could be many
things and without access to your kit I can only make the following
suggestions:

  1. Uninstall motion and re-install it
    to see if this makes a difference.
  2. Try a fresh install of Raspbian in case
    you have installed something that may be interfering.
  3. Ensure your power supply is
    providing enough current, I don’t think this is the problem because you
    would have issues with your Pi shutting itself down.
  4. See if you can try a different
    webcam (maybe try and borrow one from a friend or neighbour for 5
    minutes).

I hope one of these
things helps.

Regards,

Sat

Iancoates11 months ago

Hi, I'd updated the Raspian OS and no change. I've got a Microsoft Lifecam VX3000. I'd hope a decent make would be compatible.

What do you think?

sat481 (author) 11 months ago

Hi Ian,

Sorry that you could not get this to work, do you have the make and model of your webcam and I will see if I can find out if it is compatible with motion. In the mean time the only other thing i can think off is if you do an update of the Raspbian with the commands:

$ sudo apt-get update

$ sudo apt-get upgrade

You will need to ensure that you have an active internet connection when you use these commands.

Regards,

Sat

Iancoates11 months ago
hi, 8080 didn't seem to work, when I start the programme up the light on my Microsoft webcam goes on for a couple of seconds. But all my pi browser gives, whether the camera is plugged in or not is: -BoundaryString Content-type: image/jpeg Content-Length: 4064 ÿØÿà JFIF    ÿÛC       (     1#% (:3=<9387@H\N@DWE78PmQW_bghg>Mqypdx\egcÿÛC       /  /cB8Bccccccc etc. I'm stumped :(
sat481 (author) 11 months ago

Hi Ian,

I have tried resetting the remote webcam up on a fresh install of wheezy and as long as you only change the bits mentioned it should work fine. check you have the correct IP address, the only thing I can think that may cause the problem is if the webcam is not compatible but from what I have read then the majority should be fine. The whole file from step 3 is massive but another quick test you can do is try going into port: 8080 which is the config port. So you need to type your IP:8080 in the address bar (for me this is set to 192.168.1.105:8080). See if you can access this and if so check the configuration from there. Hope this helps.

Sat

joey5611 months ago
I would like one!!!!!! Shame!!!!!!
Pls follow me