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:
Remove these adsRemove these ads by Signing Up

Step 1: Getting started

Picture of Getting started
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)
1-40 of 60Next »
labmice11 month ago

This works for me with a logitech webcam connected. How can I put a password on the stream? Thanks

AltGrW labmice118 days ago

you can set .htaccess into this folder, it's a simple login required but works fine

carter54 AltGrW6 hours ago

...'you can set .htaccess into this folder, it's a simple login required but works fine'...

Please elaborate - which folder and where / when do you log in?

carter546 hours ago

Thanks for making such a clear and concise instruction which worked for me first time round. Other web sites have covered this but seemed to have got lost in bewildering complexity. Worked first time for me...thanks. Will try to find the instruction for making the feed visible over the web - securly.

sysnajar made it!2 days ago

Thanks for the super easy instructions. Really well written.


Screen Shot 2558-03-27 at 4.48.00 PM.png
dsaze1 month ago

When I try: 1.) sudo apt-get install motion

everything works perfectly fine except for a single "get" error (error shown in image below).


2) sudo nano /etc/motion/motion.conf (brings up a file with no text within)

3.) sudo service motion start (yields - "motion: unrecognized service")

raspberry pi error.JPG

you need to update your pi, execute the command sudo apt-get update

mk2001 dsaze12 days ago

The file was empty and the service wasnt recognised because the file did not download properly. Check your internet connection.

DhruvMC8 days ago

i made a gr8 wiimote control with i combined it with this ITS AWESOMEEE....

ramgarden made it!5 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!


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

Also doing the exact same thing. I hope...

Hey ramgarden!

Could you give me some details regarding the conf file when you tried it with the Camera Module instead of an USB Camera.

1) what was the videodevice?
eg in this it was videodevice /dev/video0
Did you change it?
2)What was the value for input? (Default is 8)
3) Did you have to make any other changes in the conf file?

I tried over and over to make it work with the motion application but it just doesn't like the RPi camera module. The best one I've found with the camera module is the MJPEG application:

Yes, I had followed this tutorial already and made it work with MJPEG Streamer. But I need it to work with Motion. Since I need to interface multiple cameras - One USB and one RPi Module. Running the same service Motion and uplinking their live streams to two different ports. Is there no way that's possible?

mk200112 days ago

why isnt it working on chrome

for michaelv4: sorry for my late response, i didn't visit this pages for a couple of months.....

Now i have 2 webcam connected and i did some work on the conf files so i have a good frame rate on both cam and a delay of less than a second. I don't know how to make a toturial here, if someone help me on this i will share my job with all of you that are interested.

Hello Walter!

I'm very new to RPi. I just finished interfacing a USB webcam as per the above tutorial and other help I found online.
Also, I managed to do the same with the Raspberry Pi Camera Module but for that, I was not running Motion, but was running another service (Mjpeg-streamer)
(I used this tutorial for reference:

Now I had a few of doubts..

1) Could I run the same "motion" service for the other Camera Module (Not USB), just by changing the Device ID in the conf file or something?
2) Basically I need the live video stream of 3 cameras at once. So if (1) mentioned above is possible, I was planning to connect 2 USB Cameras and 1 RPi Camera Module, and run the Motion Service. Could that serve the purpose? If so, what will the changes be in the conf file? Do I need to create three instances of 'videodevice'? How can I set the ports as 8081, 8082 and 8083 for the three devices?

riminsalass1 month ago

I use a camera sony playstation 2 EYE TOY "Bus 001 Device 005 : ID 054c : 0155 Sony Corp." and I did all the configuration request without result.

GANESHA11 month ago

it cool but i wanna do it in my console .

and i have one more doubt how to differentiate if two camera's are connected to one pi how can i differentiate it

GANESHA11 month ago

it cool but i wanna do it in my console .

and i have one more doubt how to differentiate if two camera's are connected to one pi how can i differentiate it

nb.nb.16541 month ago

when i type sudo service motion start i get
etc/init.d/motion: l: /etc/default/motion: X#: not found

MichaelV42 months ago

Hi plinsky, can you share you work with me?

plinsky3 months ago

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.

Iancoates1 year 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.

JakeB3 bsimpson123 months ago

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

agasthyahs129 months ago

Getting an error !!!!

Unable to open video device....

i am using HP usb webcam pro to get video stream


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!3 months ago


MichaelW6 scott!6 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!3 months 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
ramgarden4 months 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?

AllahA ramgarden3 months ago

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/

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

MICELIA4 months ago

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

kaneb15 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 ??

MattH35 months ago

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

1-40 of 60Next »