Raspberry Pi Camera to SecuritySpy

Below is a guest post by one of our users, Wayne Jacobsen, who is using a Raspberry Pi computer to turn a USB webcam into an IP cam that can stream video to SecuritySpy, in order to expand his Mac video surveillance system. Wayne is an Art Glass artist  – you can see some of Wayne’s work on Pinterest. Wayne has contributed the following description of his setup:

The Raspberry Pi can make a nice security camera in a SecuritySpy system with surprisingly little effort. I wanted a way of seeing what temperatures my kilns were, especially when they were cool enough to open and take the glass out. I had a Raspberry Pi (RPi) equipped with USB WiFi dongle and an old Logitech QuickCam Pro 9000 webcam sitting around from my old PC days. A little research on the web led me to many ways to use the RPi with the webcam and I used the instructions on this page as the basis of my setup. Someone has done all the software development work for us in a program call Motion.

Following the step-by-step instructions at the above page yielded perfect results, first time. Just go to another computer and enter the IP address of the RPi and the port used by Motion into a web browser and you see streaming video. To get this working in SecuritySpy, open the Video Device Settings window, add a new network device and choose Manual Configuration for the device type. Enter the RPi’s IP address, the HTTP port number used by Motion, and any username/password you have set up in Motion. Click the OK button and up it comes. Once the RPi is configured to run Motion, the powered USB adapter, HDMI screen, mouse and keyboard can all be unplugged from the RPi.

You can download my config file for Motion in order to help your own setup. Here are a few of my photos and screenshots to demonstrate my setup:


25 thoughts on “Raspberry Pi Camera to SecuritySpy

  1. John

    This is very cool, but I don’t think it takes advantage of the built-in hardware for processing video on the Pi. The Pi has an accompanying camera that plugs into a dedicated camera connection directly into the SoC, allowing for 1080p30 h264 capture with low CPU usage.

    It’s possible to stream the h264 stream over wired Ethernet to VLC, but I’d had no success getting it into SecuritySpy. Is there any interest in this? It would make a fantastic <$100 camera. There's even an IR camera option.

    1. bensoftware Post author

      Hi John,

      Thanks for the info, I wasn’t aware of this. If it works with VLC then it should work with SecuritySpy. There must be some RTSP URL associated with the stream, for example rtsp://camera-ip-address/stream.h264 – i.e. the URL you enter in VLC to view the stream. Set up a new network device in SecuritySpy, set the device type to Manual, and choose RTSP as the format. Enter the last bit of the URL (in the above example this would be stream.h264) as the Request. These settings should bring the stream into SecuritySpy – can you confirm?

      1. John

        So I used the command line here: http://www.mybigideas.co.uk/RPi/RPiCamera/

        The RTSP option did work in SecuritySpy 3.3. I got a 1080p camera working that does >20fps for <$80. The first stream I tried was about 15mbps.

        I would love to add trivial password authentication, but haven't dug too deep yet.

        I also haven't gotten any audio options working. Is there a good way to stream audio separately and then merge in SecuritySpy?

        1. bensoftware Post author

          Hi John, this is great, thanks for testing and reporting back.

          With RTSP input into SecuritySpy, there is currently no way to add a separate audio stream; the audio data must be part of the RTSP session. This is standard for RTSP: one session contains both a video and audio component, rather than having separate connections/streams for each. Please report back if you manage to get this working!

    2. Paul

      I’ve had some success with the camera and Security Spy using a slightly different approach which gives me 1920×1080@30fps with about 15-20% CPU load on a RPI Model B. This method relies on the bcm2835_v4l2 module being loaded (a V4L2 interface for the camera) and has the advantage of using VLC directly without the need of a pipe. There seems to be less latency this way and so far has been up and running for about a week with no problems. (c)vlc has excellent documentation and there appears to be support for a password for RTSP (–sout-rtsp-pwd) although I haven’t used that. Below is what I’m using on a fairly standard Raspbian install:

      cvlc v4l2:///dev/video0 –v4l2-width 1920 –v4l2-height 1080 –v4l2-chroma h264 –v4l2-fps 30 —-sout ‘#rtp{sdp=rtsp://:8554/}’

      1. David Nielsen

        Would it be possible to get ssh command list to replicate your setup? I have installed the camera and motion, but hesitate with my beginner’s knowledge of terminal commands to go much further without being held by the hand.

  2. Rick

    I’d definitely be interested to know if this works with the RPi camera, this would make a very good setup for me if it does, as I have 4 RPi’s around the house that I could just attach a camera to and then feed it all to SecuritySpy.

  3. IP network cameras

    It is great to know that Webcam can also be treated as a IP Camera with some tricks. Thanks fot this post.

  4. Jason

    Hello BenSoftware!
    I’ve read the above posts concerning the Pi and an H264 feed to Security Spy stating all works well utilizing the RESULTS field for the URL specifics. Well, not for me :o(
    After much ado I was able to get a stream from the pi that works very well.
    Via VLC on any other computer or tablet etc, I can open my stream from the Pi, however when I ask Security Spy to do it, it keeps a status of “No Video”. I’m using the HLS stream found here –>(http://www.mybigideas.co.uk/RPi/RPiCamera/).
    My Network stream URL is: http://[PiIP]/stream/stream.m3u8.
    -New Video Device
    -Manual Configuration
    -Address = [PiIP]
    -Format = RTSP-over-HTTP (video and audio)
    -Request = stream/stream.m3u8

    Have any thoughts?

    1. bensoftware Post author

      Hi Jason – a m3u8 link is for Apple’s “HTTP Live Streaming” protocol, which is not supported by SecuritySpy. Network cameras instead use RTSP, which is what SecuritySpy supports. Do you know if the software you’re running on the pi can send an RTSP stream, and if so what is the URL for that?

  5. Jason

    I’m digging your response time. Worth the $$ for this excellent piece of software. Yes I can spit out a RTSP from the Pi with a different command line. Let me tinker with it and I’ll post my results.
    Again, thank you.

    1. bensoftware Post author

      Hi Jason – sorry but WebRTC is not supported by SecuritySpy, in fact this is the first time anyone has mentioned this protocol to us!

      I found this blog post about RTSP Streaming H264 from the pi – maybe it will help?

      1. Jason

        Okay, your proposal looks good, however it may be a little above my Pi-bility to accomplish, though it’s not off the table yet. Meanwhile I digressed to a MJPEG stream from the pi using UV4l and still cannot coerce Security Spy to pull the feed.
        I can open a browser (chrome even) to http://[PiIp]:9000/stream/video.mjpeg and see my feed just fine after running uv4l –auto-video_nr –driver raspicam –encoding mjpeg –server-option ‘–port=9000’ –driver raspicam –rotation 180 –width 352 –height 288 on the PI.
        I then setup a manual device with the PiIp in the address, HTTP port at 9000, Format=HTTP(video only) and Request=stream/video.mjpeg. No go.
        Am I missing something here?
        Thank you again for any assistance,

        1. bensoftware Post author

          Hi Jason, a MJPEG stream over HTTP should certainly work, and it sounds like you’ve configured this correctly in SecuritySpy. Check the log file (it’s within the SecuritySpy folder in your Documents folder) for clues as to why it’s not working. If you continue to have problems with this, email us, including the log file and a screenshot of the Video Device Settings window showing how the device is set up, and we’ll take a look.

          1. bensoftware Post author

            Great! Thanks for posting your solution, I’m sure this will be useful for others wanting to stream H.264 RTSP video from their Raspberry Pi camera to SecuritySpy running on a Mac.

  6. Jason

    More on this..I found it is easiest to install the uv4l drivers, tools and server. THAT’S ALL!
    The error received by SS when attempting to connect to the camera is that of “chunked data not supported”. Luckily the UV4l has a server option to turn this off. It’s not spelled correctly, but it works.
    So go here:
    Install UV4l, uv4l-ctl tools, and the uv4l server.
    Next modify /etc/uv4l/uv4l-raspicam.conf
    -adjust your encoding, resolution and fps.
    encoding = mjpeg
    width = 800
    height = 600
    framerate = 15
    profile = high
    #bitrate = 50000000
    quantisation-parameter = 20
    intra-period = 5
    inline-headers = yes
    -add the following(at the bottom):
    server-option = ––chuncked-transfer-encoding=no

    Point SS to ‘manually’ to your URL (ex.http://PiIp:port/stream/video.mjpeg (or video.h264 depending on your encoding)
    UV4l is all you need, no VLC no RTSP server etc.
    I’m getting a solid 15fps with max 25.6 CPU utilization when streaming no more than 3% when idle.

    1. Paul

      There’s a small typo in the last parameter:
      server-option = –chuncked-transfer-encoding=no
      needs 2 –– instead of 1 –
      server-option = ––chuncked-transfer-encoding=no

      1. Ben Software Post author

        Thanks for the correction Paul – it seems the forum software (WordPress) is changing –– to – for some reason, so I’ve fixed this in the above post too.

    2. Thomas Breymann

      I tried to set up my Raspberry-Pi camera this way. I can see video in a browser window with very little daly. My Problem is getting it working in SS. Seems wirt the uv4l server flag “server-option = ––chuncked-transfer-encoding=no” has no effect at all.
      I get the error from SS:
      “Error communicating with the network device “Network camera” 3.4.8,70287,809 The network device sends chunked data, which is not supported”.
      The command “sudo service uv4l_raspicam status -l” shows:

      ● uv4l_raspicam.service – LSB: Userspace Camera Driver
      Loaded: loaded (/etc/init.d/uv4l_raspicam)
      Active: active (running) since Tue 2016-03-08 13:48:10 UTC; 1h 56min ago
      Process: 1746 ExecStop=/etc/init.d/uv4l_raspicam stop (code=exited, status=0/SUCCESS)
      Process: 2219 ExecStart=/etc/init.d/uv4l_raspicam start (code=exited, status=0/SUCCESS)
      CGroup: /system.slice/uv4l_raspicam.service
      └─2230 /usr/bin/uv4l -k –sched-fifo –mem-lock –config-file=/etc/uv4l/uv4l-raspicam.conf –driver raspicam –driver-config-file=/etc/uv4l/uv4l-raspicam.conf –server-option=–editab…

      Mar 08 13:48:10 raspberrypi uv4l_raspicam[2219]: [core] Trying driver ‘raspicam’ from built-in drivers…
      Mar 08 13:48:10 raspberrypi uv4l_raspicam[2219]: [core] Driver ‘raspicam’ not found
      Mar 08 13:48:10 raspberrypi uv4l_raspicam[2219]: [core] Trying driver ‘raspicam’ from external plug-in’s…
      Mar 08 13:48:10 raspberrypi uv4l_raspicam[2219]: [driver] Dual Raspicam Video4Linux2 Driver v1.9.34 built Feb 11 2016
      Mar 08 13:48:10 raspberrypi uv4l_raspicam[2219]: [driver] Selected format: 640×480, encoding: mjpeg, JPEG Video Capture
      Mar 08 13:48:10 raspberrypi uv4l_raspicam[2219]: [driver] Framerate max. 30 fps
      Mar 08 13:48:10 raspberrypi uv4l_raspicam[2219]: [driver] ROI: 0, 0, 1, 1
      Mar 08 13:48:10 raspberrypi uv4l_raspicam[2219]: [core] Device detected!
      Mar 08 13:48:10 raspberrypi systemd[1]: Started LSB: Userspace Camera Driver.
      Mar 08 13:48:10 raspberrypi uv4l_raspicam[2219]: [core] Registering device node /dev/video0

      Any advise would be greatly appreciated.

      1. Ben Software Post author

        Hi Thomas, I’m not quite sure why this wouldn’t work for you. One think I notice, and that Jason pointed out above, is that “chunked” is spelled wrong in that flag name. If you change it to “server-option = ––chunked-transfer-encoding=no”, does this work? You may also have to restart the Pi for this to take effect.

  7. claf

    Many thanks, Jason, your post helped me get a Pi3 and Noir camera going! Interesting, I could only see the camera if mjpeg were set on the UV4L software. When I switched over to H264, I had errors. Will keep tinkering.


Leave a Reply

Your email address will not be published. Required fields are marked *