Raspbery Pi2 Camera Monitor w/Rpisurv

nayr

IPCT Contributor
Jul 16, 2014
9,229
5,330
Denver, CO
project page: https://github.com/SvenVD/rpisurv

Requirements:
  • Raspberry Pi 2 Model B or newer w/16GB Samsung MicroSD
  • Wired Ethernet, this will suck on wifi trust me
  • RSTP h264 Video Streams (it'll do MJPEG but you'll have to buy a license)
  • Raspbian from: https://www.raspberrypi.org/downloads/raspbian/

Follow the README instructions w/rpisurv and as long as you verify your RSTP Streams with VLC beforehand, you should be able to reboot into a grid display of your choice.

Latency is pretty low actually, just a few seconds.. load is extremely low with 4 D1 substreams at 20fps, full quality, even handles the 1080p main feeds with ease. (load average: 0.10, 0.18, 0.10)

my /etc/rpisurv looks like this with my 4 outdoor dahuas:
Code:
essentials:
    #These are the rtsp streams you want the program to display
    #The streams will be displayed in the order you present them here
    rtsp_urls:
        - "rtsp://user:pass@192.168.42.20:554/cam/realmonitor?channel=1&subtype=1"
        - "rtsp://user:pass@192.168.42.21:554/cam/realmonitor?channel=1&subtype=1"
        - "rtsp://user:pass@192.168.42.22:554/cam/realmonitor?channel=1&subtype=1"
        - "rtsp://user:pass@192.168.42.23:554/cam/realmonitor?channel=1&subtype=1"


    #How many columns you want the program to use, it will autocalculate the amount of row needed based on the resolution of your screen
    nr_of_columns: "2"


#These are fallbacks if autodection fails;
#Normally you do not need to configure these
fallbacks:
    resolution:
        width: "1920"
        height: "1080"

I also gave video 128M of ram by adding this line to /boot/firmware/config.txt
Code:
gpu_mem=128


I had the monitor for free someone gave me, the RPI2 with a 16GB Samsung SD card, 1.5' HDMI to DVI cable, and vesa mounting bracket came in ~$50 total.. if your going to wall mount it you probably wont want a vesa bracket, i am strapped to a shelf.
 

Attachments

  • IMAG0513.jpg
    IMAG0513.jpg
    2.7 MB · Views: 622
  • IMAG0515.jpg
    IMAG0515.jpg
    560.2 KB · Views: 663
Last edited by a moderator:
Hanging out for my PI 3 back order to be fulfilled.
 
SWEET! This is exactly what I want to-do with one of my PI's. Hook it up to a TV and just switch the HDMI input to watch the cameras.
 
  • Like
Reactions: CmdrBond
RPI3 is really not needed for this,

load average: 0.14, 0.12, 0.14
705MB free of 882MB of ram (ive allocated 128M to video)

the few extra Mhz of CPU, WiFi, and Bluetooth will have pretty much no use or benifit to a security display.. I suspect the single core RPI1 could do this task just as well.
 
Last edited by a moderator:
HI
I installed on a RPI2 tonight.
Worked out great with two HIK 2CD3132.
The purpurse I need the Raspberry for, is to display those Super Minicams on my modelrailroad:
http://de.aliexpress.com/item/720P-...ocal-zoom/32358662273.html?detailNewVersion=1
They don't start, even if they display great with VLC Player
Here is the way I call it in the surveillance.yml:
- "rtsp://192.168.1.100:554/live1.264" Username and Password is not necessary.
Any ideas
 
Hi,
I installed on an Raspberry 2 tonight.
It worked out great for zw HIKVISION 2CD3132F.
The purpose I need the software is to display several of those cameras on my modelrailroad:
http://de.aliexpress.com/item/720P-...-1&btsid=7cbd3fe3-83b1-41f1-a713-89eac69e129b

The cam displays fine with VLC Player. In the surveillance.yml I call the cam: - "rtsp://192.168.1.100:554/live1.264" Username and Password are not necessary.

Any ideas?
 
  • Like
Reactions: cutterman
I was thinking of something like this last night. You've sold me now, thanks- time to get to work.
 
I'll be coding up my own implementation of this soon, I dont like the 2x2 Grid for displaying next to my front door so I did a row of cameras at the bottom with the front door cam cropped and centered for most of the screen.. with a 16:10 display the cropping is very tolerable, it crops just as much from the bottom and top to make the width match so image is still correctly centered.

just have to write up the math, its very simple.. the more cameras you add at the bottom the less of your main camera will be cropped.. alot of Crimes lately have involved a sales person at the front door distracting the owner while someone breaks in through the back.. so I dont really need a big image of my perimeter cameras, just enough to make sure nobody is sneaking up on my 6

Right now its all done by this simple script, but it wont restart dead feeds or adapt to more cameras/resolution so hence the need to write my own app.. luckily my cameras are solid as a rock so this cheap script has been doing perfectly fine so far.

Code:
#!/bin/bash
omxplayer -p --live --timeout 60 -o hdmi 'rtsp://user:pass@192.168.42.20:554/cam/realmonitor?channel=1&subtype=0' --win '0 0 1680 735' --aspect-mode fill &
omxplayer --live --timeout 60 -o hdmi 'rtsp://user:pass@192.168.42.21:554/cam/realmonitor?channel=1&subtype=1' --win '0 735 560 1050' &
omxplayer --live --timeout 60 -o hdmi 'rtsp://user:pass@192.168.42.22:554/cam/realmonitor?channel=1&subtype=1' --win '560 735 1120 1050' &
omxplayer --live --timeout 60 -o hdmi 'rtsp://user:pass@192.168.42.23:554/cam/realmonitor?channel=1&subtype=1' --win '1120 735 1680 1050' &

I have a 1680x1050 16:10 display so what I did was divide the width by my number of cameras (1680/3=560), then calculate height for that width in a 16:9 format and subtract that from the total height (1050-315=735).. then I knew the sizes and positions for each camera.

Ive also been able to play videos with transparencies over the top of all or some of my cameras, so I might be able to setup some OSD info over top.. I got a countdown video when my security system is arming or about to alarm and it looks really neat playing over my cameras at 50% transparent.

I have another camera coming for ALPR so I plan on adding a 4th one to the bottom row, and who knows perhaps a 5th one.. so before I get those setup I intend on having my app published.
 

Attachments

  • IMAG0517.jpg
    IMAG0517.jpg
    887.8 KB · Views: 289
Last edited by a moderator:
  • Like
Reactions: Dometrius and j4co
Looks great @nayr. Did you have something that is putting the monitor to sleep during times of the day or for instance when you arm your system? Or are you still relying on the power button for that? I want to do this with my Pi and monitor in the kitchen but want it to go to sleep on its own at a specified time of night and back on again in the am.
 
Last edited by a moderator:
the tvservice -o command fails when you have more than 3 streams loaded, aparently the bus can only handle 4 connections so when you have more than 3 feeds you cant get any of the HDMI commands to work...

I think I need to modify the omxplayer code, I got started on it but then this morning my PI was not showing any cameras.. upon reboot it started tossing fucking DMA errors on the uSD, fucking knockoff SD cards.. oh well amazon has replacement already in the mail and I'll do a full test on it before burning Raspbian back onto it.

Glad I posted my script up here, because its the only place I stashed it hah
 
My bad! I didn't think it would take your system down like that. Maybe I can try to get the streams from my BI server to the Pi so it is only one stream and gives me the option to use the tvservice call?
 
lol, you didnt do anything heh.. if BI will combine the streams into one full screen grid that would certainly help you out..

I have some relay boards lying around here, worst case I'll make a custom monitor cable that I can switch on/off with one of the RPi's GPIO.

here is details on the issue: https://github.com/raspberrypi/firmware/issues/441

you can play more than 4 videos, so I dont think OMXPlayer requires a connection to the video bus because it throws the same error but still plays video fine.. I think it bypasses it with the framebuffer, so if I can rework the code so it dont try to initialize the gfx bus directly then it should not interfere with tv-service or trying to overlay transparent PNG's on the monitor once you reach 4 streams
 
I still would like to use it and 4 cam is enough for me.
My problem is, that I'm using am cheap Aliexpress Cam ( I'm nötig allowed to post the link) here and become as returnvalue "Decode Problem" Any Ideas?
 
is it h264 feed or mjpeg?
 
If you Install/Run VLC and go to File -> Open Network, will it play the same stream url your providing to your RPi?
 
I have a VLC Player on my PC and start there the stream rtsp://192.168.1.100:554/live1/265
Same on the RPi with omxplayer will not work.
 
well VLC will prompt for credentials and OMXPlayer wont, try putting your login in the URI like: rtsp://username:password@192.168.1.100:554/live1/265