Low Cost Raspberry Pi IP Camera

Raspberry Pi Camera
Low Cost IP Camera with Raspberry Pi

In this lesson we give you a step by step tutorial on how to create a low cost IP camera from a Raspberry Pi and the Raspberry Pi camera module.  (If you need to get a Raspberry Pi and Camera Module, we recommend this complete starter Kit, which you can order HERE.  If you already have a Raspberry Pi, and just need a camera, you can get the camera module HERE.) We are going to assume you already have your Raspberry Pi up and running, and are able to make a connection to it via Putty or SSH. If you are completely new to the Raspberry Pi, you should probably start with the  first two lessons on THIS PAGE.

This video will take you through the steps one at a time. In addition, the tutorial below has the commands that you can copy and paste. We recommend you both follow the video, and get the steps from the instructions below, so you do not have to manually type the commands. Be very careful . . . you must be precise in following these instructions for things to work.

OK, now assuming you have your Raspberry Pi up and running, and you can connect via Putty or SSH, These are the steps to get your dandy personal IP camera working. You will type or copy and paste these lines one at a time into the Raspberry Pi command line.

STEP 1: Get Your Raspberry Pi Up to Date:

STEP 2: Install Lighttpd Web Server:

STEP 3: Enable Server to Process PHP Scripts

STEP 4: Create a PHP WEB Page:

Now you will want to type or paste this info into the nano window.

STEP 5: Save your nano file with these key strokes:

To be clear, you press the Control key and the letter “O” at the same time. Then press the enter key. Then press the Control and “X” key at the same time.

STEP 6: Restart the Webserver:

STEP 7: Check That the WEB Server is Working:

Go to a browser on a Windows computer on your network, and type:

http://10.1.15.94/

(NOTE: You would use your Pi’s IP address above. The number I use above is the IP address of our Pi. Your number will be different. You can find out your IP address on the pi by typing ifconfig into the terminal window.)

If you configured things correctly, you should get an Apache info page pop up.

Also, you should be able to see your php information page by entering:

http:/10.1.15.94/php.php

Again, you should use your IP address. If you did things correctly you should have a page come up with lots of tables describing php configuration

STEP 8: Reboot Your Computer

STEP 9: Install the crtmpserver

STEP 10: Backup default crtmpserver file

STEP 11: Edit flvplayback.lua file

 Open the file in nano editor:

Now edit your file to these values:

STEP 12: Save and Exit 

To be clear, you press the Control key and the letter “O” at the same time. Then press the enter key. Then press the Control and “X” key at the same time.

STEP 13: Restart crtmpserver

STEP 14: Remove ffmpeg

We need to make sure we have a clean copy of ffmpeg, so safest thing to do is un-install it in case an old version is on your pi.

STEP 15: Intall Latest git-core and ffmpeg software

and then:

and then:

and then:

and then:

and then:

and then:

STEP 16: Now Make and Install the software:

These two commands will take a while. After inputting the commands go and get some coffee.

STEP 17: Install Samba:

 

We will want Samba to easily exchange files to and from windows.

STEP 18: Edit Samba File:

Now you need to add these lines to the smb.conf file. You should add them into the SHARE DEFINITIONS section, after the netlogin part.

After adding this code, my SHARE DEFINITIONS section looks like this:

Now save and exit the nano editor with:

Ctrl O
Enter
Ctrl X

At this point, your Raspberry Pi should show up on your Windows computer network on your windows machine.  On your windows machine, open a folder, click on “network” on the left, and you should see your raspberry pi show up. Now you can move files to and from your Raspberry Pi from Windows.

STEP 19: Install Strobe Software and WEB Page:

We will want to be able to view the live video stream in a browser, so we need to install the Strobe software. These next steps will install and enable the strobe feature.

Now the easiest way to get the strobe software is to download it on a windows computer. You can get the software by going to:

http://sourceforge.net/projects/smp.adobe/files/

and downloading the latest version of strobe media playback.

Now open the zipped folder and drag and drop the folder “for Flash Player 10.1” to your desktop.

Now move the CONTENTS of the unzipped “for Flash Player 10.1” folder onto your Raspberry Pi. You will want to move the CONTENTS of “for Flash Player 10.1” folder into the /home/var/www/html/strobe folder on your Raspberry Pi. If you installed Samba correctly, the Raspberry Pi should show up when you open a folder in Windows and click on “Network”.

Now you have the strobe software installed and you need to create a Strobe WEB page to display your live video.

First, make sure you are in the html folder by typing:

On your raspberry pi, now issue the command:

Now paste this code into your Nano window. You can paste by copying the code below, and then going to your Raspberry Pi command Window, and right mouse clicking.

Now you should save and exit nano with these commands:

To be clear, you press the Control key and the letter “O” at the same time. Then press the enter key. Then press the Control and “X” key at the same time.

STEP 20: Enable Raspbery Pi Camera Module:

At the command line enter:

Scroll down and enable the camera.

STEP 21: Start the Camera:

You are now ready to fire up the camera. You can start the camera by issuing this command in the Raspberry Pi command window.

STEP 22: View the Live Stream

Now to view the live stream just open a browser on a computer on your network and type in the IP address of your pi:

http://10.1.15.94

(Use your ip address. The one above is my IP address.

This has been a long project, but I hope well worth it. If you follow the instructions EXACTLY, it should work. Enjoy!

181 thoughts on “Low Cost Raspberry Pi IP Camera”

  1. Thank u very much sir as I always wanted to make a wireless video by pi 3. This tutorial is helping me a lot

    1. There is more than one way to do this. I have not tried the tutorial you link to so can not comment on it. I like the technique presented in my tutorial because it gives lots of flexibility in configuring the camera. It is not the only way to do it, but is a nice way that works.

      1. Oh, I thought I was sure that the Rpi Web Cam Interface lived streamed to a browser, because it asked you weather or not you wanted to use Apache, Nginx, or Lighttpd.

        I’m probably wrong since I haven’t touched my Raspi for a few weeks (I’m trying to introduce it on my blog).

        Looking forward to your video, that would help me!

        1. No way for me to know what is going on with your system. Debug it . . . lots of people are using samba on rpi3 . . . dig into it and figure out the problem

    2. Hi JSM, thanks for sharing this!

      I had been unable to get this to work, my guess is because of deprecated function calls as I got these messages on step 16, making the ffmpeg software. As I would have had to figure out how to test

      – crtmpserver
      – strobe
      – ffmpeg

      I instead followed your link above and was able to get the RPi Cam Control to work, it was a very simple install and got this working on a RPi 0 w, and its now my bird feeder camera. I would share the link but have not secured my RPi enough to post it publicly, so I password protected the page. I need to learn how to configure it to be safe enough to open up for public without having people take over my camera or RPi… 🙂

    3. I had problems already at Step 2

      Thank you JSM.

      Loved your link. Everything was there Plug&Play with many features.

      THANK YOU!

      Works perfectly!

  2. sir I am using RbPi 3 and also have RbPi official camera version 2 i.e. 8mp camera. So is the code going to work with these configurations?

    1. Ed, it is great to hear that. It took Jack and I two weeks to make the video. We kept getting in the middle and making a mistake. It is a little tricky to do it perfectly. It is always good to hear someone is actually doing these projects. Makes us want to keep going.

      1. I Have only recently started to view your tutorials and must say that I really enjoy your style of teaching/delivery. In particular, you include your coding mistakes, then find and correct them, which is an excellent method and assists us with less experience. I have subscribed and very much look forward to future content.

        Many thanks and happy new year from Milton Keynes in the UK!

  3. Everything was working great until I reached Stpe 15, trying to clone from github…
    Step 15:
    pi@raspberrypi:/usr/src $ sudo mkdir ffmpeg
    pi@raspberrypi:/usr/src $ sudo chown whoami:users ffmpeg
    pi@raspberrypi:/usr/src $ sudo git clone git://source/ffmpeg.org/ffmpeg.git ffmpeg
    Cloning into ‘ffmpeg’…
    fatal: unable to connect to source:
    source[0: 198.105.244.228]: errno=Connection timed out
    source[1: 198.105.254.228]: errno=Connection timed out

    1. Sounds like a connectivity issue. Make sure you have good connection to internet, and try again. This should work.

  4. There is a delay because i gather funding to get the camera. But i tried and just finished it and got it working successfully without any error. Thanks again sir.

  5. sorry sir actually i did not understand that before.By the way what causes the delay? mine is almost 16 seconds of delay having 640X480

  6. hello again…
    I fixed all of my earlier problems, and actuall got the video to working (after working thru a bad power supply and a fried camera).

    Now, when I open the url in a browser on the PC, the page that comes up reads “Alternate content”, which is at the bottom of the html script from above. I assume it is an error condition in the other block of the html script…

    Thanks

    Tom

    1. It sounds like you have a problem with the strobe WEB page. If there is an error, alternate content will come up.

  7. I got to step 22, but when I open a browser window with my pi IP, it never starts, and when I stop and start the video, it never stops buffering

  8. sir one more question that is how to stop the camera because it come in the middle of the pi connected display

  9. I love your Raspberry Pi tutorials! When I saw this one, I placed an order for a camera straightaway. Unfortunately, I also bought a Pi Zero W, a case for it, a Pi Zero Essentials kit, a Flirc USB for using any remote control, a USB to micro USB OTG Converter Shim… The list goes on. You are a VERY bad influence!

    I really appreciate the time and effort that you put in 🙂

  10. Thank you very much for the tutorial. Fantastic job!!

    I am having a small issue and hopefully it’s and easy fix?
    When I reboot the Pi the video fails to restart. For an outside IP webcam that’s not good. I re-load the raspivid setting and everything starts working again.

    I admit I’m very new at all this.
    Thank you in advance.
    Sincerely,

    1. The Raspivid is a command that starts the camera. You can to run the command to start the camera. So, you will either have to start it when you boot the pi, or you will need to write some sort of script that runs it at boot up.

      1. “or you will need to write some sort of script that runs it at boot up.”

        For us newbies, is there an easy way to do this? i.e. How do you write a script that will run when the pi is powered one?
        Thank you!

  11. PI DISCONNECTS WHEN I SHUTDOWN MY WINDOWS COMPUTER.

    It works great as long as my windows macine is on. when I shut down windows the camera goes off. I would like the Pi to be independant of the main frame computer.

    I dont know if this is normal or not.

    Thanks for the great tutorials.

    Cal

  12. Hello, quick (hopefully) question. I don’t have an official pi cam… I am using a logitech usb webcam. what modifications would i need to do to get it running? Thanks

    1. That would really be a totally different project, since this one is really based on the Raspivid camera and library. I would really suggest finding a way to get the pi camera.

  13. Hi,
    I get the stream on a PC but when I want to access with a MacBook Iget a page that only contains the text “Alternative content”.
    What may be the reason?
    Kind regards

    1. That my friend is because the stream is a “flash”, and mac products do not like flash. You need to figure out how to get mac to view flash.

      1. Hello admin,

        I too get the same error , but I use Linux, both Chrome and Firefox. Do u think switching to windows internet explorer ought to solve the problem ??

        Regards ,

        ARK

  14. Hello, thanks for this amazing tutorial.
    I’ve followed exactly what it say, i’ve also watched the youtube video at the same time. Unfortunatly at the very last (Step 22) when i type my ip in google chrome, i can access to the page, but a meassage appears : we are unable to connect to the network. we apologize for the inconvenience and TypeError – Error#1009.

    Anyone gets the same ?

    Thanks.

    1. Make sure you can ping the Raspberry pi from your PC. Ping the Raspberry Pi IP address and make sure you can see it. Your PC has to be on the same network as the Raspberry PI

      1. I can ping my Raspberry Pi from my PC, and yes both are on the same network.

        Pressing F12 on google chroms, i got these errors:

        “http://192.168.0.13/fcs/ident2” 404 (Not Found)
        “http://192.168.0.13/open/1” 404 (Not Found)
        “http://192.168.0.13:1935/fcs/ident2 “net::ERR_CONNECTION_REFUSED
        “http://192.168.0.13:443/fcs/ident2 “net::ERR_CONNECTION_REFUSED
        “http://192.168.0.13:443/open/1 “net::ERR_CONNECTION_REFUSED
        “https://192.168.0.13:1935/open/1 “net::ERR_CONNECTION_REFUSED
        “https://192.168.0.13/open/1 “net::ERR_CONNECTION_REFUSED
        “http://192.168.0.13:1935/open/1” net::ERR_CONNECTION_REFUSED

        Any thougth about that ?

        Thanks.

        1. On step 7 after installing the WEB server were you able to see the apache page? If so, then you should see the strobe page if you are still working in that same folder. First thing is to verify you can see a simple html page that is in that folder by typing http://your ip address/your_test_page.html.

          That is to say, create a test html page, put it in that folder and verify you can see it in a browser.

          1. Yes i was able to see that page “http://192.168.0.13/php.php” and i am also able to see a new html page called test.html using “http://192.168.0.13/test.html”.

            I have shutdown my Raspberry Pi before step 21 to plug in my camera, maybe that ‘s something to do with that? I don’t know.

            If i reboot my Pi, do i have to restart the Webserver ? And crtmpserver ?

            Thanks.

            – See more at: http://www.toptechboy.com/tutorial/low-cost-raspberry-pi-ip-camera/#comment-34562

            Sorry i’ve posted as new comment, i copy paste on the reply instead.

          2. I’ve plug my Raspberry Pi on my TV with hdmi cable, when i write this line : raspivid -t -0 -w 1080 -h 720 -awb auto -fps 30 -rot 90 -b 1200000 -o – |ffmpeg -loglevel quiet -i – -vcodec copy -an -f flv -metadata streamName=myStream tcp://0.0.0.0:6666&

            and press enter, i can see a window pop up on my TV screen, and i can see what the camera is filming, but the thing is, the window shutdown itself 5 sec after.

            Any idea ?

            Thanks.

  15. Yes i was able to see that page “http://192.168.0.13/php.php” and i am also able to see a new html page called test.html using “http://192.168.0.13/test.html”.

    I have shutdown my Raspberry Pi before step 21 to plug in my camera, maybe that ‘s something to do with that? I don’t know.

    If i reboot my Pi, do i have to restart the Webserver ? And crtmpserver ?

    Thanks.

  16. Great tutorial!! Got it working on my first attempt 🙂

    How do you stop the damn thing without rebooting, shutting down or stamping on it?

    1. Well, you can reboot it, shut it down or stomp on it. Also might try blow torch or hammer. If you are looking for a shutdown switch, there is not one.

      1. Actually, run this command: “ps -aux | less” and then find the process ID of the raspivid. After that you can just run “kill -9 YOUR PROCESS ID”

  17. I wasted a whole afternoon on this and then realized it is based on flash. Of all the asinine technologies to do a tutorial with, you chose flash? this is garbage, complete and utter garbage. Might as well have had people code in fortran

  18. Hi,
    With this perfect tutorial (the explanation of the different steps is exemplary!) I got it working after having corrected an error of mine.
    It is nice to see the video in a browser, but it’s volatile.
    What is lacking to record the video stream?
    The best, in combination with a motion detection, or on demand, that starts the video in order to economize space on the recording medium.

    So, how to add motion detection and recording.

    Kind regards
    FJ

    1. You can record the video and stream it if on the raspivid command you output to a linux “pipe” with one destination being ffmpeg, and the other being a file on the pi.

  19. I went through all the lesson and did the last command and camera comes on for a few seconds. Then I get a message saying Exit 1. So the camera turns off why won’t it stay on? By the way I am doing this on latest version of Jessie and on a Zero W. Should have used Jessie Lite instead?

    Thank you

    1. I think I used normal Jessie, not light. Really not sure . . . this is a long lesson and anything not done exactly correctly could cause the camera to crash. If it does not find ffmpeg, or if ffmpeg is not installed correctly, that could crash the camera.

  20. Really good tutorial guys, I’m amazed I got as close as I did. The web server was easy, samba took a little effort (Mac Mini) but I’m really glad I have that working now.
    Now for the ffmpeg problem, I get this error when I use the raspivid command.
    “-bash: ffmpeg: command not found”
    The ffmpeg took so long I fell asleep and when I reconnected to the pi the seemed ok but my newbie guess is pi is looking in the wrong place for ffmpeg.
    Is there a path entry in the ffmpeg configuration?

    I’ve been searching forums for a few hours, I’ll post a solution if I’m lucky.

    New Pi Zero W and the 5mp pi camera with fast sd card

    1. This is a hard project as everything has to be exact. Also, remember the strobe player is flash, and will not play on your mac unless you install some sort of flash player. If you are having troubles, I suggest start all the way over with a fresh pi card. Hard to jump back into the middle and make it work.

      1. 2nd time was the charm, everything worked, I went to bed with a sense of accomplishment.
        Then
        I woke up and turned on the camera this morning and nothing! re-seated all connectors twice, tried a pi 3 with the other cable and still no camera to be found, I actually used a cheaper arducam version of the 5mp pi camera and seems to have only worked once.
        I’ve seen most of your tutorials and have heard your opinion on cheap hardware, I’m more of a believer now than before. At least I know I can burn a copy of the sd card and not go through the lengthy process again anytime soon.

        1. This does sound like a hardware issue. Like the old saying, there is nothing more expensive than a cheap [you fill in the blank].

          I have a hydroponic greenhouse that uses lots of pumps, which periodically go out. I got tired of expensive pumps so bought 3 cheap ones. One lasted 2 weeks, one lasted 1 day, and one was dead on arrival. Went back to quality, more expensive pumps.

          1. Learned 2 lessons on this. If you get an MMAL error that says to check your connection, start with visual AND continuity check of the cameras ribbon cable. My arducam came with two ribbons. The pi zero ribbon is tapered at one end. Looking at the cable closely with a loupe was not good enough. The module worked on my pi 3 with the bigger cable. When I checked the continuity of the zero cable, I found a break in the last two traces on the small (pi) end. Even though they looked good, there was a crack right on the edge where the friction tape was attached. I had to twist the cable to see it separate. Apparently when I picked up the camera to remove the protective tape from the lens it cracked slightly. Looking forward to the new official pi zero case. It will come with a short cable and a place to attach the camera board on the inside.
            Once again, Great tutorial.
            This project is for a live trail cam in Northern New York State. With a little luck we’ll prove the Panthers are moving back into the area. A solar charger, two yagis and we’ll be good to go.

  21. Thanks, Teach! I’ve used this on the Zero W (Little slow) and it works great, now installing on Pi 3 to stream to Youtube.
    Where do I send the stipend? 🙂

    1. Great to hear this project is working. It is a little tedious, but as you see, if you follow it exactly, you will get a working stream.
      Good Job!

  22. Made one mistake this time programming Pi 3. I copied the folder “for flash player 10.1” rather than the contents of the folder and got the message “Alternate Content” when I went to the web page. I realized then that I should have copied the contents not just the folder. Wonder if others made this same mistake?
    Thanks again Teach!

    1. That is a pretty common mistake. And why I try and emphasize you must follow instructions EXACTLY. Glad you got it figured out.

    2. I had the same problem. I’m running windows 10. Next to the IP address is a circle with an “i” inside of it (signifying “information”).

      I clicked on it and Always allowed Flash from this page.

      That seemed to fix it. Good Luck!

  23. I promise I won’t haunt you after this, maybe.
    I used the following code to stream to Youtube from my Pi 3 and it is extremely slow: The code? Any ideas? Thanks. Phil

    raspivid -o – -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i – -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/(mycode)

    1. I am not much of an expert on ffmpeg nor youtube live streaming, so am not going to be any help on this one. If you figure it out, please post what you find.

  24. Thank you guy so much! This is an awesome project! I live in a rural part of the country and using drop cameras or webcams uses data. We have to pay for internet per gig, which makes drop cameras no good and ip cameras $$. I used a few pi cameras and set them up in the barn, NOW i can keep an eye on the animals without data suck! SWEET!!

    thank you!

  25. When I run the very last command to start the video stream:
    – The stream shows up on the rasp desktop (on my hdmi monitor) for 5 seconds and then closes.
    Any advise appreciated.

    Thank you for the tutorial and continued guidance!
    Scot

    1. if I change the portion of the line regarding time out from “-t -0” to “-t 0” the screen doesn’t time out but I still get “Alternative content” when trying to view http://192.168.230.186” .

      Additional guidance would be appreciated.

      1. OK, make sure you are using a browser with flash enabled. Flash does not play on an iphone, or in a browser that you have blocked flash.

      2. if I enable logging to the console of ffmpeg I get the following error:
        Connection to tcp://0.0.0.0:6666 failed: Connection refused
        tcp://0.0.0.0:6666: Connection refused

        note: I’ve also tried putting my pi’s address in the command instead of the 0.0.0.0 and it doesn’t change anything.

        Please advise.

        1. NO dont change that line, should be just as I show in that command. Also see my earlier comment about flash

          1. Thank you for the reply.
            To be clear you are saying that:
            1) it’s perfectly fine that the camera shows on my raspi desktop for 5 seconds and then closes?
            and
            2) it’s perfectly fine that if I allow showing the logging in the command line that it shows that the connection is refused?

            Just making sure before I try to figure out what else it could be.

            btw: thank you for the quick reply!

          2. Scot, you have too many threads going here. In another thread I thought you said you had the camera fired up without an error, and were just getting alternative content. If your error is alternative content, then the issue is probably you are using a browser that does not support flash. Please only comment on this one thread.

          3. I see your comment about to many threads.. my apologies. Not malicious, just ignorant. Is this better?
            Current problem is as follows (can’t delete identical comment from outside of this thread):
            some progress I enabled flash and now I get a black box that says “We are unable to connect to the network. We apologize for the inconvenience.”

  26. some progress 🙂
    I enabled flash and now I get a black box that says “We are unable to connect to the network. We apologize for the inconvenience.”

  27. after doing all these steps successfullu Im unable to see the live streaming on my chrome browser..
    https:///php.php is showing php info
    https:/// is showing php info showing a blankpage..
    please help me..

  28. I would love for this to work, but i do the update, upgrade the “sudo apt-get install lighttpd lighttpd-doc etc:” and it all works fine and installs. I then do the “sudo lightly-enable-mod fastcgi-php” and i get “sudo: lightly-enable-mod: command not found”
    I have done the preceeding steps twice and i still get this fault. I am using a Raspi 3 and don’t know if this might be an issue?

  29. hello sir,
    after doing all these steps successfully, I am unable to see the live streaming.
    only the blank page is appearing
    while the php.php page is showing php info.
    plz help
    .

  30. sir, I am unable to see Apache info page popup as well.

    kindly Help me to get through this. I am new to Linux and Raspberry Pi

  31. Mr. McWhorter and Jack
    After a few missteps, I managed to get it to work – Thanks! I wonder why you chose to install git to get the ffmpeg source, or Samba for the StrobeMediaPlayback files, instead of just downloading them onto your computer and using scp to put them onto the pi (which worked for me). My pi camera is streaming to Firefox on my Mac, which works after I upgraded to Shockwave flash 25.0 r0 and told Firefox to always activate. To restart the camera each time I want it, I wrote a 1-line perl script that relieves me from having to type step 21 over and over.

    Again, Many thanks. for your efforts on this project.

    1. I am sure there are lots of ways to do it, we just show one way that works. Might even be better ways to do it, but wanted something clear that would work for the novice.

  32. Unfortnately I get lots and lots of warnings at step 16 to do with libavcodec “array bondaries etc.”
    + deprecated function calls.

    I’m trying on a pi zero W and Raspbian with Pixel.
    I dont think Ill try any more after two attempts. Very time consuming only to see all these warnings flash by.

  33. After my first try the php.php site looks right and I got the pi folder on the network of my mac computer the ip-address site in my browser it just says: alternative content. Step 21 also works on the raspberry pi screen.

    Any advice. Does the strobe software work on a mac?

    1. Hello..Same issue/message…I tried installed on both a Raspberry Pi 3 and Raspberry Zero W…Using the lastest RASPBIAN STRETCH WITH DESKTOP September 2017, Raspividd starts up the camera displaying, but Obviously there is something wrong with whatever the index.html file is trying to access. Don’t find any type errors. How can I verify that the contents of index.html is setting up or accessing whatever it is trying to access or setup? How can I tell if the camera video stream is actually accessable by the Webserver? Thanks.

      1. Problem found…I’m running windows 10. Next to the IP address is a circle with an “i” inside of it (signifying “information”).

        I clicked on it and Always allowed Flash from this page.

        That seemed to fix it.

        Thanks Flip ….AUGUST 3, 2017 AT 8:55 PM… I owe you one

        1. thanks so much and to all the folks who have the same way to search solutions as I do, ALTERNATIVE CONTENT ALTERNATE CONTENT YOUR SOLUTION IS HERE
          (because I did Ctrl + F “alter…”)

      2. Make sure you are viewing in a flash enabled browser. The video stream is flash, so you must be in a browser that can render flash.

  34. Love the tutorial! Got everything working, and now am adding a twist to it. I have a 3.5″ TFT attached to my Pi, and I’m trying to display the preview feed to it. But I can’t seem to find a switch that forces the frame buffer to /dev/fb1. I have the desktop and pretty much everything else defaulting to the TFT, the camera feed always goes to HDMI. Any thoughts?

    Thanks

  35. Love your tutorials! Very professional. I have a RPi 3 and a RPi camera rev. 2.0. Everything seemed to go well until I got to the last line of Step 15 “sudo ./configure” To my dismay this yielded “sudo: ./configure: command not found” At first I thought this must be a RPi3 thing but then I read in these comments that you had performed this process with a RPi3 so now I am at a loss as to what to do.. The GUI shows the ffmpeg folder to be present but empty. Do you have any suggestions?

  36. Im really liking all of your tutorials. Lots of help for beginners! Now my question is how would I go about getting my pi to automatically run the raspivid command when my pi boots like you did in the previous tutorial with tightvnc?

    Thank you,
    Kyle

    1. Also it seems like the image needs to be flipped 90 degrees. How would I do that so i don’t have to mount my pi sideways?

      1. Kyle,
        There is a .rotate command described in “Getting Started With Picamera” on the Raspberry Pi web site.
        Glen

  37. Everything’s work’s fine in my local network BUT when I go to other place witch another network and type IP address http://192.168.—.— video is not loading and after a while “server is not responding” message appears. Is this only work on local network?

    1. Yes, you have to be on the same network, or you have to give your pi a public IP address. Think of it this way . . . you have to be able to ping your pi, and you can only do that if you are on the same network, or if you have a public IP address.

  38. Got it working! What you have done for us newbies is FANTASTIC! Thank you.
    Plan for my use is to put a pi zero w in an HO model train car to be pushed around our portable modular layout at public exhibitions. Several items where I need help from you or others MUCH more advanced:
    1) Flash seems to be a deal breaker. Would love to allow visitors to call up the moving camera on their iPhones
    2) Wold love discussion on how to make my pi zero w have a “public IP address” so we are not bound to a particular network
    3) Would like info on creating and auto running a boot file that starts the camera when power is applied.
    Not too much to ask, right??? 😉
    Oh, and then there is that nasty little hardware problem to solve: eliminating the battery by powering the pi from the 16V AC tracks…(Marklin European Trains). 😉
    THANK YOU AGAIN for getting me this far!

  39. Have tried your tutorial twice. Pi shows up in Homegroup once and in the network once. Cannot copy files to Strobe directory either time. Get error “You need permission… etc”. Rebooting either or both machines doesn’t help. Using Win 10 on a Dell laptop. Any ideas??

    1. Really not something I can diagnose long distance. You need to research how to copy files from PC to Linux/Raspberry Pi. There are lots of places that is covered in detail. Should be straightforward to get going, but not something I can figure out from here.

  40. I got it all up and working although I have to re-run steps 20-21 after I reboot it every time is there a way to make it just auto start with no input? I would like to setup and plug-in with out having to worry about SSH in the case it gets unplugged.

    1. I have just done this myself. If you edit /etc/rc.local and add the camera command from step 21 just before the Exit command then the camera will automatically initiate on boot. Make sure that the “&” is on the end when you add the command, otherwise it wont boot and will just loop.

      Hope it works for you

  41. Hi,
    I completed the training as you told. And I created a virtual port for access to cam from an other network. but when i trying to connect to webpage i received the belowed error: “we are unable to connect to the network. we apologize for the inconvenience”. Could you please help me about that issue? (flash player is active now on browser)

  42. I followed the steps and it works, though I’m not sure that your approach teaches us anything other than to make sure that we type correctly. There is no motivation at even a superficial level of how the various hardware and software pieces actually work together. As a tutorial on the importance of careful typing, it is great.
    A couple of things you left out:

    Proper installation and orientation of cam cable, particularly for the PI zero. This is an important first step. Even a reference to your or 3rd party video instructions would be helpful.

    How do I stop the video streaming? Do I need to run the raspivid command every time I boot the PI? If so, suggest putting it in a script.

  43. When I use the camera in network everything is fine, but when I port forward and use it the video shows a black screen.

    1. hi jamie,
      I have the same problem as you. But still i couldn’t find any solution. If got any solution please tell to me also.

  44. This was outstanding. Works perfect with my Pi Zero W.

    I wanted to use this camera in my car when I pick up fares with a popular rideshare app as an extra measure of security. I sometimes pick up drunk people. So far no problem, but I want to protect myself and my car.

    How do I get this setup to continuously record and over write the oldest data when it needs room to either the remaining space on the sd card or an external USB flash drive?

  45. Thanks for doing this, I appreciate the effort.
    All the Samba stuff seems to be working, I can access the Pi from my Windows PC, and I get a media player type window when I put the Pi’s IP address in the browser.
    But the raspivid command is giving me a few errors:

    mmal: camera component couldn’t be enabled
    mmal: Failed to create camera component
    mmal: Failed to run camera app. Please check for firmware updates

    The camera worked before when I tried another method, so I don’t think it’s hardware or firmware.
    Any ideas?

    Thanks again!

    1. Oops, I missed the first error message. It says:

      mmal: mmal_vc_component_enable: failed to enable component: ENOSPC

      That might help. lol

  46. I cannot get my windows machine to see the Samba share. I did everything in that section (and before it) and nothing comes up in the windows network window. What is the most common problem and what would you suggest?

    1. Two SD cards, two freshly built installs, no joy as far as samba. There has to be more to this. They must have changed something since your wonderful tutorial. This happens a lot. Anyone have ANY ideas?

      1. There are so many versions of things on both the RPi side and the windows side, there is no way I can keep up with all variations. The issue is not really related to the IP camera project specifically, so try searching on “Samba problems with Windows version . . .”. Samba is very standard software, so you should be able to trace this down.

      2. Near the top of the /etc/samba/smb.conf file, look for two lines like this:

        workgroup = MSHOME
        wins support = yes

        You find your workgroup name from control panel/system
        Make sure that wins support is set yo yes.

  47. I agree. It ended up being that Microsoft enhanced their security restrictions for networks. I enabled wins support = yes then if you reboot and then go to the win machine and type in the IP address with two backslashes \\192.x.x.x the share will be found, then you can map network drive to the drive letter of your choice. I do some of this myself and its very hard to keep up with changes that you have no control over. 3 days of working on this and finally the solution. Thanks for all you do!

  48. GREAT job guys! I never get out of these things without something going south. I looked for other tutorials on how to make Python and HTML talk so I can add buttons on the web page and control two servos . One for Pan and one for Tilt. I would LIKE to use the Pi’s GPIO but am not opposed to using a Nano. This seems like a perfect lesson and a great challenge for the students. What is out there on the internet already is incomplete and errors behind the scenes. (Inspect) Thanks again!

  49. same problem as scot:

    local host shows video for 5 sek and then shuts down.
    Removing the -loglevel quiet from ffmpeg shows the error message:
    [tcp @ 0x3727e50] Connection to tcp://0.0.0.0:6666 failed: Connection refused
    tcp://0.0.0.0:6666: Connection refused

    Now I’m not sure why the connection is refused, maybe a newer version of the linux distribution.
    Uname -a gets me:
    Linux raspberrypi 4.9.41+ #1023 Tue Aug 8 15:47:12 BST 2017 armv6l GNU/Linux

    Any help is appreciated 🙂

    1. [SOLVED]
      Problem was the crtmpserver not listening on the given ip:port. After checking with ‘crtmpserver status’ the output showed the daemon thread to be “active (exited)” when instead it should be “active (running)”.

      When you are like me, you have tried different tutorials for this same problem. One of those suggesting to install a package named ‘motion’. This unfortunately causes the crtmpserver to always start in a “active (exited)” state. Just a simple removal of this package solved the problem for me (# sudo apt-get remove motion). After a restart the RaspberryPie showed the crtmpserver to be “active (running)” and the webpage worked as intended.

  50. when I used last step I got error as follows ,can anyone please help me to solve this :

    mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
    mmal: camera component couldn’t be enabled
    mmal: main: Failed to create camera component
    mmal: Failed to run camera app. Please check for firmware updates

    Thank You!

  51. Mine seems to be working fine after i reformatted and redo it all over again.
    The problem that i encountered before i reformat is that ( I deactivated my camera Directly from the raspi config while the camera was running), causing the camera led to light up for like 5seconds then auto off.
    CONCLUSION, DO NOT TURN OFF YOUR CAMERA FROM RASPI CONFIG, JUST CLOSE THE CONSOLE WILL DO

    1. Once you have your camera operating, you can terminate it by killing the process from the command line using “ps” to identify the process, and “kill” to terminate the process. Here is what it looks like on mine…
      pi@Rpi1B:~ $ ps
      PID TTY TIME CMD
      5582 pts/0 00:00:01 bash
      6045 pts/0 00:00:01 raspivid
      6046 pts/0 00:00:03 ffmpeg
      6094 pts/0 00:00:00 ps

      You can see that the raspivid process is PID 6045. To terminate it from the command line, type…
      pi@Rpi1B:~ $ kill 6045

      Use your own PID identifying number.

      Cheers

  52. When i use my ip address to open the website, it opens then shows “Right click to run adobe flash player” and then immediately vanishes

      1. You have to enable flash on your browser. This is a flash video, so you need to go to your browser settings and enable flash.

  53. Any ideas why I can’t view the video stream in Chromium viewer on a seperate Pi Zero running Rasbian?

    Neither can I view it on my phone.

    Can view it on my chromebook(once i’d allowed flash) and on a windows machine?

    Any ideas would be good, I am bored of looking at “alternative content”

  54. Hi,
    I followed you tutorial,, except the step samba installation+configuration as i use linux only and don’t want samba on my system. The git clone hangs at 99% for ever…so i took the zip file and “./ configure/make/sudo make install”ed it to the pi zero w. It took long but worked without problem.
    When i try to access the stream i get a tab ” my spy cam” but on the page only one line saying “alternative content”
    do i need to change firewall rules. The pi has raspbian stretch the pc-laptop debian jessie. Maybe linux doesn’t like flash? I thought with google-chromes internal flashplayer it could work but chrome freezes everything. i can not even get to the clickbox disable hardware-accelaration (is ther away to change config when it doesn’t run?) …what else could i try?

    1. after removing motion the program on the pi shows its running but still only “alternative content”

  55. by some reason after i createt a hotglue/plexi/raspi-box-case for my zero w+camera module i can stream with cvlc and vlc locally. so things are on the way. the whole thing is supposed to live-video from the inside of a three-aces rotating (gyroscop-like) counter-art installation. in earliers tests with not live/ just digital camera…the cam would switch off at high speeds/high g-forces. lets see if the zero with its year 2002 cpu can do it realtime…

  56. how do i need to configure a linux system to receive the flv stream?
    i have installed shockwave-flash, program runs on the pi but still only “alternative content”. stream via (c)vlc does work.

  57. Bonjour (I’m writing you from “Nice France”),
    I’m following your “Lesson 38” and I’m confused on “Step 15” by the term “sudo chown ‘whoami’:users ffmpeg”.
    What is or who is “whomai”?
    I am lost.
    Sorry if my English is up to date, but I have been living in France for over 50 years.
    Best regards,
    Jacques.
    P.S. your web site is really great. Thank you!

  58. Success!
    Step 16, “make” took about 12 or so hours, overnight. Mine is an original Rpi B that I have had for a few years. Wanted to view accumulated snowfall in the mountains eventually. Your method seems to be the best solution I have found. By the way, I found it necessary to use Firefox as my web browser on my Ubuntu machine.. Chrome no longer includes what is required for flash.
    Thank you both for the excellent instructions and video.

  59. success for me..! with little problem with enabling flash in browser…Thanks for nice tutorial…

    as i had little doubt …how can i keep this in boot time ,instead of typing the command every time …As i tried but in own way but i got black screen on the browser…any idea …..!

  60. I just tried to follow this tutorial and my attempt fails on STEP 2 (installing the web server). I’m getting a message saying “Package php5-common is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source”

    Is there a solution for this? Thanks for your help

  61. Hello Sir,
    I have followed all the steps successfully. I am getting a web server running in my rpi. but when I start raspivid the final command I am getting the following errors:

    I have google all the possible ways to solve this error and tried basic steps like:
    – update
    – upgrade
    -firmware upgrade
    – disabling and enabling camera through raspi-config
    – checking the ribbon with multimeter and camera as well.
    – and connecting the camera properly with rpi.
    Sp please help me in solving this error

    So please help me in solving this error

    mmal: mmal_vc_component_create: failed to create component ‘vc.ril.camera’ (1:ENOMEM)
    mmal: mmal_component_create_core: could not create component ‘vc.ril.camera’ (1)
    mmal: Failed to create camera component
    mmal: main: Failed to create camera component
    mmal: Camera is not detected. Please check carefully the camera module is installed correctly

  62. Hello admin,

    I followed each step, but after executing the last command and checking in the ip address no video is shown. It shows alternative content.
    Yes, flash is enabled on my browser.

  63. Sir please replay
    on web browser no stream is show. only Alternative content is written on web page. please sir help me.And also upload more camera project.

      1. Same in mine I have enabled the flash content but still facing the same issue. I have also updated chrome but no luck

  64. Thanks for the tutorial works very good!

    Few changes since you made the tutorial, php5 has been replaced with php in the first steps. And when connecting to your pi using windows to access the folders, connect with \\ip_address. And of course the browser to view the stream needs to support flash or it will show “Alternative content”.

    But beyond those small things it was very easy :).

  65. In the index.html, under StrobeMediaPlayback configuration,
    is this line correct as written, or am I supposed to change the window.location.hostname?

    src: “rtmp://” + window.location.hostname + “/flvplayback/myStream”,

  66. Tutorial is great.
    Two things to improve : –
    1. FLASH Player dependency . Because you can’t view the feed in Newer versions of Chrome and in Mobile Browsers also.
    2. It does not work with USB Webcams.

    If anyone has alternative solution, kindly share.

  67. I get the following and a black screen as many have reported above, any idea how to rectify this? I have enabled flash and use Win10:

    mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
    mmal: camera component couldn’t be enabled
    mmal: main: Failed to create camera component
    mmal: Failed to run camera app. Please check for firmware updates

  68. Its OK I just re-booted everything and the problem resolved itself, very impressed with the results.

  69. Hi Paul, I am a newbie to the RPi, have followed your GPIO tutorials and am pretty much addicted to toptechboy. I need your help her Sir, please.
    I cannot get past step 2: I get these errors:
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package php5 is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    Package php5-common is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    Package php5-cgi is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘php5-common’ has no installation candidate
    E: Package ‘php5-cgi’ has no installation candidate
    E: Package ‘php5’ has no installation candidate

    Would appreciate your help, I need to move forward.
    Thanks

    1. This is Chris , no need to use my full name ( Christopher Pereira )
      Just an update on the above, it starts to gen errors from here: php5-common php5-cgi php5 zip
      E: Package ‘php5-common’ has no installation candidate

  70. So which ports do I have to forward to be able to use it from outside of the local network?
    I forwarded port 80 and 1935 (the RTMP Port), I forwarded them to different ports on the outside, but I also changed it in the HTML so the browser doesn’t try to connect to a dead port. That however doesn’t seem to work. Are there any ports I have overseen?

  71. Special Thanks to toptechboy for such kind of amzing project.

    But, i cannot save my video……how can i save the video..

  72. Hi,

    this is yuvaraj. i am try to video streaming using raspberry pi camera module in web server. successfully video stream was done as per lesson 38.

    I would like to run lesson 27 (PWM) with lesson 38(IP address based Raspberry pi camera). could you help anyone how to do this.

    I am waiting for your reply.

    Regards,

    Yuvaraj N

  73. Hi Sir, First I would like to say I am so thankful to you May God bless you.
    I am using Raspbery pi Zero W with the Raspbery pi Camera, Am I able to run the same process for the camera ?

  74. I hope this message find you well 🙂
    I got my answer by while going through the comments but I could not find the space required to install all packages.
    currently I am using 8GB SD Card after I install OpenCV, python and Other programs I left with 2GB space Is That enough to install RPi-Cam-Web-Interface , I would love to hear soon.

  75. I get this any idea:-
    step 2
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package php5 is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    Package php5-common is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    Package php5-cgi is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘php5-common’ has no installation candidate
    E: Package ‘php5-cgi’ has no installation candidate
    E: Package ‘php5’ has no installation candidate

    1. it is obsolet now, try this instead:

      sudo apt-get install lighttpd lighttpd-doc php-common php-cgi php zip

  76. Hi
    sorry to bother you again I have managed to get as far a step 7 all look the same as you got but there is no web server! and I did dont know linux well to fix can u help

  77. Hi
    I’m new on RPI and Linux aswell. I tried this guide yesterday and came all the way to the end but couldn’t get a picture/movie on the website. Started over today and payed more attention. When I did the upgrade in the beginning it didn’t passed the upgrade and I ran it again but now also with the command sudo apt-get dist-upgrade which was probably why I managed the get it running on the second try. Thanks for this guides.

    1. Yes, this is a pretty tough one. It requires everything to be just perfect. Glad you got it working.

  78. Hi
    This is great and I have got it working but when I try it on my mobile it goes to “alternative content” is there a way to add a mobile version somehow?

Comments are closed.