Raspbery Pi2 Camera Monitor w/Rpisurv

SvenVD

Getting the hang of it
Joined
Mar 5, 2016
Messages
61
Reaction score
31
Just set this up at home and it's amazing. Thank you for putting this together! :)

Is there a way to gracefully exit the display when connected directly via the keyboard?
Update 06/08/2017 there is now a supported and tested way with the latest update: press "q" for about 25 seconds and the screen will stop. On top of that on the command line you can use systemctl commands to manage the screen. Commands like systemctl stop rpisurv and systemctl start rpisurv
 

SvenVD

Getting the hang of it
Joined
Mar 5, 2016
Messages
61
Reaction score
31
Also other new features have been implemented in the latest update:

New features in rpisurv http://rpisurv.net !
  • Rpisurv is now compatible with systemd. You can use the standard systemctl commands to manage rpisurv.
  • New config option autostretch to disable or enable autostretching of streams to make full use of all screen pixels (but breaking aspect ratio of stream). Previously this autostretch was on by default, now it is off by default.
  • If you are connected with a keyboard you can stop rpisurv by pressing "q" for about 25 seconds.
  • Rpisurv now shows a placeholder "connecting" when it is starting up the stream.
  • Rpisurv now shows a placeholder if autostretch is disabled and if screen space is not all used up by connectable camera streams.
 
Last edited:

DarkHelmet

Getting the hang of it
Joined
Feb 26, 2017
Messages
167
Reaction score
66
@SvenVD Thanks for updating.

I have a few cameras in corridor mode (vertical) and have uncommented and set autostretch to False, but they are still being stretched. Any idea what else I can try?

edit: Hmm logs are showing it being detected wrong:
"Drawing placeholder with coordinates: 0, 0 and width: 960 height: 360"

However, when I load the stream in VLC, it is properly showing it as vertical

Here's my config:
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
    camera_streams:
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=3&subtype=1"
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=4&subtype=1"
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=1&subtype=1"
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=5&subtype=1"
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=2&subtype=1"
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=6&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"

    #Autostretching makes sures all of your pixels will be uses to display streams, so you have a maximum surveillance area.
    #But this will probably destroy the aspect ratio of your last stream.
    autostretch: False

    #rpisurv detects the connectable streams on startup,
    #if this option is enabled it will keep the first calculated layout for the lifetime of the rpisurv running even if some cameras go down and come up, instead of redrawing the screen
    #When this option is set to True, rpisurv ignores all cameras configured that were not connectable when rpisurv was started
    keep_first_screen_layout: False

#!!!Normal users do not need to edit this section!!!
advanced:
    ##Enable this option if you want to have a fixed width of all your camera streams,
    ##By default rpisurv autocalculates this value, this can cause streams to get "stretched",
    ##if this value exceeds the available width, rpisurv will fallback to autocalculation
    #fixed_width: 500

    ##Enable this option if you want to have a fixed height for all your camera streams,
    ##By default rpisurv autocalculates this value, this can cause streams to get "stretched",
    ##if this value exceeds the available height, rpisurv will fallback to autocalculation
    #fixed_height: 500

    #Rpisurv sends usage stats to it's statistics server to give the rpisurv community an idea how widespread this software is being used
    #No performance impact is measured when using this option, no sensitive data is being sent. All data is anonymised.
    #By default this is true
    #update_stats: True

    #By default rpisurv checks every 25 seconds if it needs to redraw the screen
    #interval_check_status: 25

    #By default rpisurv will check memory usage, set to False to skip memory usage check
    #memory_usage_check: True

#These are fallbacks if autodection fails;
#Normally you do not need to configure these
fallbacks:
    resolution:
        width: "1920"
        height: "1080"
I've also tried connecting directly to the cameras instead of going through the NVR, but same result. VLC sees proper resolution, rpisurv doesnt.
 
Last edited:

SvenVD

Getting the hang of it
Joined
Mar 5, 2016
Messages
61
Reaction score
31
@SvenVD Thanks for updating.

I have a few cameras in corridor mode (vertical) and have uncommented and set autostretch to False, but they are still being stretched. Any idea what else I can try?

edit: Hmm logs are showing it being detected wrong:
"Drawing placeholder with coordinates: 0, 0 and width: 960 height: 360"

However, when I load the stream in VLC, it is properly showing it as vertical

Here's my config:
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
    camera_streams:
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=3&subtype=1"
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=4&subtype=1"
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=1&subtype=1"
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=5&subtype=1"
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=2&subtype=1"
        - rtsp_url: "rtsp://user:pass@192.168.1.100:554/cam/realmonitor?channel=6&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"

    #Autostretching makes sures all of your pixels will be uses to display streams, so you have a maximum surveillance area.
    #But this will probably destroy the aspect ratio of your last stream.
    autostretch: False

    #rpisurv detects the connectable streams on startup,
    #if this option is enabled it will keep the first calculated layout for the lifetime of the rpisurv running even if some cameras go down and come up, instead of redrawing the screen
    #When this option is set to True, rpisurv ignores all cameras configured that were not connectable when rpisurv was started
    keep_first_screen_layout: False

#!!!Normal users do not need to edit this section!!!
advanced:
    ##Enable this option if you want to have a fixed width of all your camera streams,
    ##By default rpisurv autocalculates this value, this can cause streams to get "stretched",
    ##if this value exceeds the available width, rpisurv will fallback to autocalculation
    #fixed_width: 500

    ##Enable this option if you want to have a fixed height for all your camera streams,
    ##By default rpisurv autocalculates this value, this can cause streams to get "stretched",
    ##if this value exceeds the available height, rpisurv will fallback to autocalculation
    #fixed_height: 500

    #Rpisurv sends usage stats to it's statistics server to give the rpisurv community an idea how widespread this software is being used
    #No performance impact is measured when using this option, no sensitive data is being sent. All data is anonymised.
    #By default this is true
    #update_stats: True

    #By default rpisurv checks every 25 seconds if it needs to redraw the screen
    #interval_check_status: 25

    #By default rpisurv will check memory usage, set to False to skip memory usage check
    #memory_usage_check: True

#These are fallbacks if autodection fails;
#Normally you do not need to configure these
fallbacks:
    resolution:
        width: "1920"
        height: "1080"
I've also tried connecting directly to the cameras instead of going through the NVR, but same result. VLC sees proper resolution, rpisurv doesnt.

edit2: and when i try to load 6 720p streams, rpi HDMI output seems to just die. gpu memory set at 512mb

Autostretch config option only toggles last stream being stretch accross the screen if last row has missing squares. By default all other streams coordinates will be calculated to some "average" to fill the screen. In your case I suggest to play with the advanced setting of fixed width/height and nr_of_columns
 

DarkHelmet

Getting the hang of it
Joined
Feb 26, 2017
Messages
167
Reaction score
66
Autostretch config option only toggles last stream being stretch accross the screen if last row has missing squares. By default all other streams coordinates will be calculated to some "average" to fill the screen. In your case I suggest to play with the advanced setting of fixed width/height and nr_of_columns
oh i see. Alright thanks for the info!
 
Joined
Oct 2, 2017
Messages
1
Reaction score
1
Location
Alberta, Canada
oh i see. Alright thanks for the info!
Code:
cd /usr/local/bin/rpisurv
sudo nano worker.py
look for (and edit):
Code:
command_line='/usr/bin/omxplayer....
Here's mine (I fixed the aspect ratio thing for personal reasons)
Code:
command_line='/usr/bin/omxplayer --live --aidx -1 -p -o hdmi --aspect-mode letterbox' + ' ' + omxplayer_extra_options + ' ' +  rtsp_url + ' --win ' + '"' + " ".join(map(str,coordinates)) + '"'
 

DarkHelmet

Getting the hang of it
Joined
Feb 26, 2017
Messages
167
Reaction score
66
Code:
cd /usr/local/bin/rpisurv
sudo nano worker.py
look for (and edit):
Code:
command_line='/usr/bin/omxplayer....
Here's mine (I fixed the aspect ratio thing for personal reasons)
Code:
command_line='/usr/bin/omxplayer --live --aidx -1 -p -o hdmi --aspect-mode letterbox' + ' ' + omxplayer_extra_options + ' ' +  rtsp_url + ' --win ' + '"' + " ".join(map(str,coordinates)) + '"'
will give that a try!
 
Joined
Mar 14, 2017
Messages
26
Reaction score
4
I just installed rpisurv on a new pi3 and can't get it to run. My RSTP feeds do work in VLC and OMXplayer.

This is my config I only changed 1 line.
essentials:
#These are the rtsp streams you want the program to display
#The streams will be displayed in the order you present them here
camera_streams:
#Dlink dcs-5222l example
#- rtsp_url: "rtsp://<user>:<password>@<ip or dnsname>:<port>/play1.sdp"
#Enable this option if you want the rtsp stream to stream over tcp instead of udp, this may solve a "smearing" effect on some setup$
#Note that you need a version of omxplayer older then 14 March 2016 for this option to work
rtsp_over_tcp: true
#Foscam-fi9821w example
#- rtsp_url: "rtsp://<user>:<password>@<ip or dnsname>:<port>/videoMain"
#Dahua IPC-HDW4200S example or IPC-HDW4300S
- rtsp_url: "rtsp://admin:mad:192.168.78.153:554//h264Preview_01_sub"

#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"

#Autostretching makes sures all of your pixels will be uses to display streams, so you have a maximum surveillance area.
#But this will probably destroy the aspect ratio of your last stream.
#autostretch: False

#rpisurv detects the connectable streams on startup,
#if this option is enabled it will keep the first calculated layout for the lifetime of the rpisurv running even if some cameras go down $
#When this option is set to True, rpisurv ignores all cameras configured that were not connectable when rpisurv was started
keep_first_screen_layout: False

If i run python surveillance.py this is the output
pi@raspberrypi:/usr/local/bin/rpisurv $ python surveillance.py
Traceback (most recent call last):
File "surveillance.py", line 10, in <module>
from config import cfg
File "/usr/local/bin/rpisurv/config.py", line 4, in <module>
cfg = yaml.load(ymlfile)
File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 71, in load
return loader.get_single_data()
File "/usr/lib/python2.7/dist-packages/yaml/constructor.py", line 37, in get_single_data
node = self.get_single_node()
File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 55, in compose_document
node = self.compose_node(None, None)
File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 133, in compose_mapping_node
item_value = self.compose_node(node, item_key)
File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 127, in compose_mapping_node
while not self.check_event(MappingEndEvent):
File "/usr/lib/python2.7/dist-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
File "/usr/lib/python2.7/dist-packages/yaml/parser.py", line 439, in parse_block_mapping_key
"expected <block end>, but found %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a block mapping
in "conf/surveillance.yml", line 4, column 5
expected <block end>, but found '<block sequence start>'
in "conf/surveillance.yml", line 13, column 9
 

SvenVD

Getting the hang of it
Joined
Mar 5, 2016
Messages
61
Reaction score
31
The issue is in configuration. You probably missed some indents, also do not use "tabs" in the config file
 
Joined
Mar 14, 2017
Messages
26
Reaction score
4
The issue is in configuration. You probably missed some indents, also do not use "tabs" in the config file
Okay i did rerun run ./install.sh to "start over" with the config file I'll just blow out the Sd card and start over all together.
 

badapples

n3wb
Joined
Jan 16, 2018
Messages
1
Reaction score
0
omxplayer can handle an old mjpeg stream from one of my old foscams...

I can't find documentation for rpisurv to add this type of stream to the config file in /etc/rpisurv. Surely as this is a wrapper, it would work? It doesn't work when trying to add it to an rtsp_url: line, but is there another keyword I should be using for this http stream?

Thanks for the great work.
 

Dometrius

n3wb
Joined
Dec 24, 2017
Messages
23
Reaction score
5
Great write up. My wife asked me the other day "is there a way we can view the cameras on the TV in our bedroom?" (the NVR is connected to the TV in our living room). I thought about it and said I could probably make it happen with a raspberry pi (before seeing this thread). But the way I was thinking of accomplishing it is a bit different so I am glad I found this thread first. Could one not just use the web browser on the pi to view the NVR web page and solve this without the need for RPiSurv?
 

Silas

Pulling my weight
Joined
Jan 6, 2017
Messages
328
Reaction score
121
Location
Down Under
Great write up. My wife asked me the other day "is there a way we can view the cameras on the TV in our bedroom?" (the NVR is connected to the TV in our living room). I thought about it and said I could probably make it happen with a raspberry pi (before seeing this thread). But the way I was thinking of accomplishing it is a bit different so I am glad I found this thread first. Could one not just use the web browser on the pi to view the NVR web page and solve this without the need for RPiSurv?
Yes but it would not be direct to the image, you need to log in, hence the pi or even an android tv box with ivms or tinycam
 

Slider

n3wb
Joined
Aug 11, 2015
Messages
13
Reaction score
8
@SvenVD , I've installed Rpisurv but it won't start:

● rpisurv.service - Rpisurv Raspberry Pi Surveillance
Loaded: loaded (/etc/systemd/system/rpisurv.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-02-17 14:18:04 CET; 1min 6s ago
Process: 435 ExecStart=/usr/bin/rpisurv (code=exited, status=1/FAILURE)
Main PID: 435 (code=exited, status=1/FAILURE)

Feb 17 14:18:04 LibreNMS systemd[1]: rpisurv.service: Unit entered failed state.
Feb 17 14:18:04 LibreNMS systemd[1]: rpisurv.service: Failed with result 'exit-code'.
Feb 17 14:18:04 LibreNMS systemd[1]: rpisurv.service: Service hold-off time over, scheduling restart.
Feb 17 14:18:04 LibreNMS systemd[1]: Stopped Rpisurv Raspberry Pi Surveillance.
Feb 17 14:18:04 LibreNMS systemd[1]: rpisurv.service: Start request repeated too quickly.
Feb 17 14:18:04 LibreNMS systemd[1]: Failed to start Rpisurv Raspberry Pi Surveillance.
Feb 17 14:18:04 LibreNMS systemd[1]: rpisurv.service: Unit entered failed state.
Feb 17 14:18:04 LibreNMS systemd[1]: rpisurv.service: Failed with result 'exit-code'.


I also get errors If I try to update:

Err:1 Index of /raspbian stretch/main armhf libvorbis0a armhf 1.3.5-4
404 Not Found [IP: 93.93.128.193 80]
Err:2 Index of /raspbian stretch/main armhf libvorbisenc2 armhf 1.3.5-4
404 Not Found [IP: 93.93.128.193 80]
Err:3 Index of /raspbian stretch/main armhf libvorbisfile3 armhf 1.3.5-4
404 Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/libv/libvorbis/libvorbis0a_1.3.5-4_armhf.deb 404 Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/libv/libvorbis/libvorbisenc2_1.3.5-4_armhf.deb 404 Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/libv/libvorbis/libvorbisfile3_1.3.5-4_armhf.deb 404 Not Found [IP: 93.93.128.193 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
sending incremental file list
./
conf/surveillance.yml


Any ideas?
 
Last edited:

Slider

n3wb
Joined
Aug 11, 2015
Messages
13
Reaction score
8
After running sudo apt-get update and running sudo ./install.sh a lot more got installed. But it still won't start:

pi@LibreNMS:~ $ sudo systemctl status rpisurv
● rpisurv.service - Rpisurv Raspberry Pi Surveillance
Loaded: loaded (/etc/systemd/system/rpisurv.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-02-17 18:40:02 CET; 15s ago
Process: 980 ExecStart=/usr/bin/rpisurv (code=exited, status=1/FAILURE)
Main PID: 980 (code=exited, status=1/FAILURE)

Feb 17 18:40:02 LibreNMS systemd[1]: rpisurv.service: Main process exited, code=exited, status=1/FAILURE
Feb 17 18:40:02 LibreNMS systemd[1]: rpisurv.service: Unit entered failed state.
Feb 17 18:40:02 LibreNMS systemd[1]: rpisurv.service: Failed with result 'exit-code'.
Feb 17 18:40:02 LibreNMS systemd[1]: rpisurv.service: Service hold-off time over, scheduling restart.
Feb 17 18:40:02 LibreNMS systemd[1]: Stopped Rpisurv Raspberry Pi Surveillance.
Feb 17 18:40:02 LibreNMS systemd[1]: rpisurv.service: Start request repeated too quickly.
Feb 17 18:40:02 LibreNMS systemd[1]: Failed to start Rpisurv Raspberry Pi Surveillance.
Feb 17 18:40:02 LibreNMS systemd[1]: rpisurv.service: Unit entered failed state.
Feb 17 18:40:02 LibreNMS systemd[1]: rpisurv.service: Failed with result 'exit-code'.


Permission issue?

EDIT:
Fixed it. I was using the primary streams. When I switched to the secondary streams they started working. (with TCP enabled)
 
Last edited:

SvenVD

Getting the hang of it
Joined
Mar 5, 2016
Messages
61
Reaction score
31
New major version 2.0 of rpisurv is released as a beta version. A lot of extra features have been added, with the most notable that you can now cycle between screens of camera streams automatically or via the keyboard.
Full list of changes: SvenVD/rpisurv. Beta testers are welcome.
 

blake

Getting comfortable
Joined
Mar 14, 2014
Messages
1,072
Reaction score
161
Location
Texas
Yes but it would not be direct to the image, you need to log in, hence the pi or even an android tv box with ivms or tinycam
If you're able, you can use a hdmi ethernet splitter and run cat cable from splitter to bedroom tv, plug into hdmi port on bedroom TV and be done.
 

smole

Young grasshopper
Joined
Dec 5, 2017
Messages
92
Reaction score
18
Hi,

i've installed Raspbian and Rpisurv but can't get it to work, updated python too.

I get this:

2018/09/29 15:34:34 - l_default - DEBUG - autodetected resolution of['1824', '984']
2018/09/29 15:34:34 - l_default - DEBUG - nr_of_columns = 2
2018/09/29 15:34:34 - l_default - DEBUG - interval_check_status = 25
2018/09/29 15:34:34 - l_default - DEBUG - camera_streams config option exist, using this one

I have an OK RTSP stream, tested it in OMXPlayer.

What can the problem be?
 
Last edited:
Top