RaspberrIPCam – Full HD IP Camera based on Raspberry Pi

[12-Nov-2014 RaspberrIPCam Updated ! Added Configuration web page with embedded playerPlease read again the tutorial to be aware of modifications]

The RaspberrIPCam is an Open Source project that aims to provide a modern and reliable solution for anyone wants to secure it’s home or work and at a very low price compared to what you can find on the market.

I started this project because no other solutions based on Raspivid and vlc streamer convinced me in FPS and because I prefer to master all the chain.

Performances are just great, because it allow streaming a FULL HD (1080p) video stream at 30fps without latency (latency involved is mostly due to the player).

Currently it does the basic task of a CCTV IP Camera : stream over the network a live H.264 encoded video over RTSP protocol which is the standard protocol for video streaming in security applications. It will be improved by a Record Manager, and external trigger handler (PIR Sensor, door sensor, …) and a web sever for configuration.

This article show you how to encapsulate your own Raspberry in a camera housing and build the software to do this.

1- Building the camera

The Raspberry Pi + Camera Sensor Module are integrated into a standard fixed dome camera housing that can be found in eBay or Alibaba.

Image 1

I implemented a simplified version of PoE (Power over Ethernet) by using two twisted pairs to drive GND and +5V to the camera. 1-2 and 3-6 twisted pairs are used for the 100Mbps ethernet connection and the two other twisted pairs are used GND and +5V.


Power supply is provided by a simple 5V/1.5A AC/DC supply. +5V and GND are internaly soldered to C6 capacitor

Image 2

Currently the camera can not be used by night but I plan to make an other one with a NoIR (without InfraRed filter) version of the sensor and place a tiny infrared spot inside.You can find a workaround by placing a halogen spot controled by a PIR sensor.

When closed it looks like a real security cam:

Image 4

 2 – Building and Installing the software

The software is based on Raspivid software (which basically capture and encode to H264 the video) and Live555 RTSP library. Mixed together they provide the foundations of a security IP Camera.

First of all, if you haven’t activated it yet, activate SSH with raspi-config->advanced options->ssh->Enable to get remote access:

$ raspi-config

Then be sure to be up to date:

$ sudo apt-get update
$ sudo apt-get upgrade

Install CMake:

$ sudo apt-get install cmake

Download userland-master, build it and install it:

$ cd /home/pi/
$ git clone git://github.com/raspberrypi/userland.git
$ cd userland
$ ./buildme

Download and install libxml2-dev:

$ sudo apt-get install libxml2-dev

Download live555 RTSP library, modify it, build it:

$ sudo apt-get install lynx
$ cd /home/pi/
$ lynx -source http://www.live555.com/liveMedia/public/live555-latest.tar.gz > live555-latest.tar
$ tar -xvf live555-latest.tar
$ mv live live555
$ cd live555

Modify linux.config :

$ sudo nano config.linux

Add -DALLOW_RTSP_SERVER_PORT_REUSE=1 at the end of the COMPILE_OPTS line. This will allow you to reuse a socket that is in TIME_WAIT state. In other words, it is more convenient when you often start and stop the application and you do not want to wait for the socket to leave TIME_WAIT state (about two minutes)

When modified check modification:

$ cat config.linux

Bash should output this :

$ cat config.linux
C = c
CPP = cpp
OBJ = o
LINK = c++ -o

Then build live555 library (you can take a cup of coffee, it takes a while):

$ sudo ./genMakefiles linux
$ sudo make

Then install Apache:

$ sudo apt-get install apache2 -y
$ sudo apt-get install php5 libapache2-mod-php5 -y

Now download RaspberrIP-Cam, build it and install it:

$ cd /home/pi/
$ git clone git://github.com/SonsOfTone/RaspberrIP-Camera
$ cd RaspberrIP-Camera
$ sudo make
$ sudo chmod 777 start.sh

Copy webpages and config.xml contains in RaspberrIPCam folder to Apache folder:

$ cp -rf www/* /var/www/
$ sudo cp -rf config.xml /var/www/
$ sudo rm /var/www/index.html
$ sudo chmod 777 /var/www/config.xml

Start the RaspberrIPCam application:

$ sh start.sh

When starting, the application inform you on what URL you will be able to access the stream, for me: rtsp://

Play this stream using the URL "rtsp://"
Beginning streaming...
Start Streaming from RaspberrIP Camera...

This URL will change according to your raspberry pi IP adress. In my case, the DHCP server gave me the address. Port is always 8554

Now you checked that all works fine, you may want to launch the application at startup:

$ sudo nano /etc/init.d/Startscript

Add these lines in the file to allow RaspberrIPCam to be launched by Apache:

chmod 777 /dev/vchiq
su www-data -c "/home/pi/RaspberrIP-Camera/start.sh &"

Verify the modification :

$ cat /etc/init.d/Startscript

Bash should output this :

$ cat /etc/init.d/Startscript
chmod 777 /dev/vchiq
su www-data -c "/home/pi/RaspberrIP-Camera/start.sh &"

Add Startscript to start sequence :

$ sudo chmod 755 /etc/init.d/Startscript
$ sudo update-rc.d Startscript defaults

Restart the raspberry, RaspberrIP-Camera application will start automatically

The start.sh script is configured to launch RaspberrIPCam with no parameters.

/home/pi/RaspberrIP-Camera/RaspberrIPCam -o - >/dev/null

By default, RaspberrIPCam open config.xml and parse it to grab parameters. You can still add parameters to start command line in start.sh as you did with raspivid (see raspivid documentation) if they are not supported by the config.xml file. If you do not specify anything, parameters found in config.xml are initialized and the others are set to default.

<?xml version="1.0"?>

3- Configuration Web Page : 

You can only do this after doing the entire previous procedure and restarting the camera.

Start your web browser and type you raspberry pi address in URL bar, you will access to the configuration page :



The player only works on Firefox at this time.

A click on Save button will store parameters and restart RaspberrIPCam with new parameters.

This list of parameters will be improved soon

4- View the stream in VLC or Mplayer:

Open VLC, click on Media->Open Network Stream, then enter the URL


Pay attention to set these settings as this in Tools->Preférences->Show Stettings(all)->Input Codecs. This will ensure the lowest latency with VLC.


View the stream in mplayer (works but have more latency than VLC):

mplayer rtsp://


5- Synology Surveillance Station Integration

If you have a Synology NAS, you can configure it to view and record your RaspberrIPCam video stream.

To this this first stop Surveillance Station in Main Menu -> Packet Center

Launch a terminal and log as root on your NAS.

Then navigate to this folder, create a custom .conf file and edit it :

$ cd /volume1/@appstore/SurveillanceStation/device_pack/camera_support
$ touch RaspberrIPCam.conf
$ vi RaspberrIPCam.conf

Then copy paste the following text (you have to press « i » key to insert text before) :

api = custom
channel_list = 1
default_channel = 1
resolutions_h264 = 1280x720
default_resolution_h264 = 1280x720
fps_h264_1280_720 = 30
default_fps_h264_1280_720 = 30
default_image_quality = 5
h264 = rtsp
rtsp_protocol = udp
mjpeg = rtsp

Restart Surveillance Station in Main Menu -> Packet Center

Then Open Surveillance Station and in management menu click « Add->Add Camera » button. Click « Next » button and choose « Complete Setup » option and click « Next » button.

Enter your IP Address, 8554 as port, and select in Brand « RaspberrIPCam ». Leave blank Username and Password.  Click « Next » button :


Choose H.264 Codec. Click « Next » button :


Choose your recording schedule. Click « Next » button :


Choose Live view from camera and UDP transport protocol. Click « Finish » button :


Done !

(Thanks to  RMorrison for comment (see below) and steaminghacker for tutorial)

6- What comes next ?

Currently, the software is really basic. I’ll first add a recording manager to store short videos on trigger (PIR, switch, …) it will make pre and post recording.

The camera will also be updated with a NoIR sensor and an IR spot.

Configuration web pages will handle more parameters and I will add a login page to restrict access.

7- Troubleshooting

– If you see cuts, abnormal latency and low FPS in the viewer, you might have to tweak the shutter parameter (-ss in the start.sh command line) when the light is very low.

– I tested the application with a Netgear WNA1000M and it didn’t  work. I have to investigate why, because the connection seems to be OK. Maybe it’s linked to my router. It’s not mandatory for me as far as camera is power over the ethernet cable.

– Currently the latency that you can feel is due to VLC. I have to test other players to see if they do better

54 réflexions au sujet de « RaspberrIPCam – Full HD IP Camera based on Raspberry Pi »

    • Are you logged as root ?
      Have you enable the camera in raspi-config ?
      Do you get this message at boot with the startscript or when you are logged?
      Just try sudo sh start.sh

    • I had a reply from Synology Support Today.
      They explain me that SS 6.3 doesn’t allow to configure user defined cameras in H.264.
      Their advice is to go back in 6.2. It worked for me with this version and i guess 6.3 does not provide such improvements.
      I’ll try Steaminghacker solution soon, It can be a better solution.

  1. Hi, I think I did everything explained here (I did it on a fresh raspian install), but after the launch strings I get a torrent of terminal rubish wich eventually kills the terminal. VLC connects to the stream but displays nothing.
    Any Idea of what went wrong, or how I can debug my problem further ?

    • The torrent of terminal rubish is normal, because the output from the raspivid is routed to the stantard output.
      In normal case (when the program is launched at startup with startscript) this do not append.
      To avoid this, you can consider launching the program by sending this command instead of the command in start.sh if you start the program manually :
      $/home/pi/RaspberrIP-Camera/RaspberrIPCam -o video.h264 -t 0 -b 5000000 -w 1280 -h 720 -ss 30000 -g 15 -fps 30
      This will route the output stream to a file.
      My program only makes small modifications to the original raspivid and only intercept the H.264 packets. So you can configure it as you do with raspivid.
      It’s exactly the same parameters at this state of development.
      About black stream, as I said in the article, if you are in low light condition, you may consider to modify the shutter time.
      Try this by day and let me know if it work.
      A good way to know if at least the camera is grabbing something is to connect an HDMI display. If this works, it should be an other problem
      If it don’t tell me and we will go deeper in investigation.

      • Thank you, the >/dev/null stopped the terminal output (I should have looked at what is actually happening with the launch options).
        But still nothing @ VLC’s. I tried lowering the shutter speed to 10000, 5000 even removing the option and there’s still no picture in VLC. VLC on Android tells me that he can’t open the stream. The h264 file plays fine (when I output to a file and not null) and the led on the camera module is lit while recording. Synology Surveillance Station 6.3-3364 can’t connect either (with streamhacker dedicated profile). By the way the profile to copy/paste lacks the first char : « [« .

        • I have exactly the same issue, everything seems to work fine, raspivid output on HDMI.
          When I start,
          RTNETLINK answers: File exists
          Play this stream using the URL « rtsp:// »
          Beginning streaming…
          Start Streaming from RaspberrIP Camera…

          Nothing on Vlc,

          Linux raspberry 3.12.28+ #709 PREEMPT Mon Sep 8 15:28:00 BST 2014 armv6l GNU/Linux

          • Can you try to modify these VLC parameters :
            File Chaching, Live Capture caching, Disc Caching Network Caching to 200ms of more instead of 100ms as explained in the article ?

        • Can you try to modify these VLC parameters :
          File Chaching, Live Capture caching, Disc Caching Network Caching to 200ms of more instead of 100ms as explained in the article ?

          • RTNETLINK answers: File exists is because the socket isn’t closed, you can reboot or launch « sudo ifdown eth0 && sudo ifup -v eth0 » to free it.

            I tried with 200ms in VLC with no change, still playing nothingness. In the stream detail in VLC, it recognizes it as H264 MPEG-4 AVC (part10) (h264), but does not decode any video data. I tried with a virgin install of VLC (in a freshly installed VM) and the result is the same

          • Ethernet, through PLC and two gigabyte switches. I tried to connect the Pi directly to the same switch as the client and it works (VLC & SurveillanceStation) !

            So the problem is clearly my network configuration, not the software (I suspect the PLC in the loop). Thank you so much for taking the time to help me debug my installation and sorry if I wasted anybody’s time, I hope my errors will benefit someone else.

    • I am using wifi and it doesn’t work either (image is displayed on HDMI fine but when trying to connect via VLC no stream appears. Seems like it is a UDP multicast / wifi conflict. I assume multicasting over wifi is a bad idea and floods the wifi channel or something.)

      Is there anyway to run this not multicast but to a specific endpoint?

  2. I love the project. Can you talk more about your poe solution. It looks DIY which is what i’m after. Can you point me in the right direction here?

  3. Hi,

    this is exactly what I was looking for.

    Two thinks :
    – Could you give us the link where we ciould buy the dome
    – an auto-tracker system could also be appreciate to follow thiefs that turn around the house (in the bacyard).

    Sincerely thanks.

    • Mine is not available anymore.
      I bought it a year ago but the supplier is not existing anymore
      Take a look in eBay or Alibaba with these keywords :
      « outdoor camera housing »

  4. Good work, I helped install the 5 PiCams at Reading Makerspace and create the web interface for members viewing and an archiving server. If you need help we are happy to give you the benefit of our work. – Mike.

  5. Hello

    Really do appreciate the documenting of this work. Having a little trouble though, when I tried on a fresh install of Rasbian on the Pi, like the other comments, VLC can see the stream (doesn’t complain about the url) but will not open it, whatever parameters I try in VLC. Just wondering if it was possible for you to do a full installation on a virgin Pi to ensure that all required packages are noted?

    Thanks very much

        • Yes i commit two version yesterday and the first one had a little issue with path to config.xml file
          I’m working on finishing web interface.
          Will come soon

          • Thanks, did you tried it on your pi ?
            I tried wifi yesterday, it works but with really small image (320×240) and really big latency.
            At least, That’s prove that something is streaming.
            Maybe it is a tweak in RTSP library.
            I’ll take a look but it not my prority, I prefer to add features and stabilize the software, wifi will come next.
            Maybe are you able to dig on your side. It will definitely help.

  6. Ping : A Full IP Webcam With a Raspberry Pi | Hackaday

  7. Hi, congrats for your project! it’s amazing! I have just a question: it works with an NVR (like DLINK DNR 322L)? The NVR normally works only with « compatible cameras ». How I can adapt your solution in order to have compatibility with NVR?


    • Can you specify the rtsp url, codec, resolution by your own in the NVR configuration ?
      If not, you can try to adapt rtspurl and resolution to fit existing camera.
      RTSP url setting in the web page is coming soon

  8. Hi, I’m Ross Finlayson, the author of the « LIVE555 Streaming Media » software that you use in this project. I’m very pleased to see that you’ve found this software useful. I do, however, have one correction to your instructions for how to get and unpack the « LIVE555 Streaming Media » software. The URL that you gave points to an unofficial, out-of-date version of our software. So, please replace
    % git clone git://github.com/hackeron/live555
    % cd live555
    % lynx -source http://www.live555.com/liveMedia/public/live555-latest.tar.gz > live555-latest.tar.gz
    % tar -xzf live555-latest.tar.gz
    % cd live

    That way, your users will get the latest (and most stable) version of our software.

    • Hi Ross,
      Glad to see a message from the author of live555 !
      I’ll for sure update the article with your guidelines.
      Thanks for your interrest to the project

  9. I cant resolve the error when i prompt
    sudo make

    gcc -I../live555/UsageEnvironment/include -I../live555/groupsock/include -I../live555/liveMedia/include -I../live555/BasicUsageEnvironment/include -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I./ -I/usr/include/libxml2 -c -o RaspiVid.o RaspiVid.c
    RaspiVid.c:59:30: fatal error: libxml/xmlmemory.h: No such file or directory
    compilation terminated.
    Makefile:12: recipe for target ‘all’ failed
    make: *** [all] Error 1

  10. Great software! Runs perfectly. Acceptable latency, and finally megapixel streaming at an affordable price.

    I have two notes on the installation script.

    In my case, this didn’t work:
    $ cp -rf www/* /var/www/
    But this did:
    $ sudo cp -rf www/* /var/www/

    For the Synology configuration, this line:
    should be like this:

    Thanks again for the great solution! Keep up the good work!

  11. Ping : Raspberry PI, RPi Camera and Roomba: a first-person experience of the housecleaning | Rainbowbreeze - Alfredo Morresi website

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *