Linux Security Camera Alternative: OpenRTSP
by intox
OpenRTSP doesn’t get much exposure because it’s just a (single file I think) library within the live555 library set. The scope of OpenRTSP is basically just to handle RTSP streams. Opens / streams / receives / records them.
More or less everything you need to record the stream from a stationary camera is included, and that’s all I need or care about. Zoneminder is big and difficult to configure, but includes more complicated operations and a web-browser interface… I don’t need all that.
Here’s the “scripts” I wrote / use to handle it:
startopenrtsp.sh:
#!/bin/sh
openRTSP -P SECONDS_BEFORE_FILE_TURNOVER -v rtsp://user:password@IPADDRESS:PORT/STREAMLOCATION &
stopopenrtsp.sh
#!/bin/sh
pkill -1 openRTSP
Easy peasy. The stop command is necessary because it terminates OpenRTSP in a safe way so the video recorded is written properly. Here’s the script I have in /etc/cron.daily/ to handle storage:
#!/bin/sh
do_it(){
cd /some/location/Stream/
/bin/bash stopopenrtsp.sh
/bin/mv /some/location/video-* staging/
for file in /some/location/Stream/staging/*; do
/bin/mv -n -- "$file" "$file.$(date +%Y%m%d)"
done
/bin/mv /some/location/Stream/staging/video-* /some/location/Stream/old/
/usr/bin/find /some/location/Stream/old/ -mtime +7 -exec /usr/bin/rm {} \;
/bin/bash startopenrtsp.sh
}
do_it
The script, since it’s in cron, needs to include full paths to unix tools and needs to be in a function so directory changes work. It’s mostly self explanatory. If you want to change the number of days that video is stored in “old” before being deleted, change -mtime +7 to -mtime + whatever amount of days you want stuff stored. If you don’t want anything deleted automatically, just remove that line.
I’ve done minimal testing and so far this works for me. Pretty sure there aren’t errors. You need directories for the actual Stream, a staging directory, and an “old” directory for this script.
Here’s the docs: https://www.live555.com/openRTSP/
Also, if you have VLC, you can open up a stream to watch it live via:
Media -> Open Network Stream
And type in something like:
rtsp://user:pass@IPADDRESS:PORT/streamLocation
Depending on your specific camera.
Comments
By: Glenda (Sat Jul 25 15:35:37 EDT 2015)
eBy: Glenda (Sun Jul 26 16:58:54 EDT 2015)
eBy: absent (Mon Aug 10 23:58:45 EDT 2015)
sir you appear to be testing comment functionality in my post >:|lol
By: Glenda (Tue Aug 11 00:22:15 EDT 2015)
i like jacking offtell my mom to fuck off i dont wanna shower
By: absent (Tue Aug 11 00:25:13 EDT 2015)
kek.clean urself you dirty fuk it's good for the soul
Anyway I included a cron script above.
Does this shit alert you when there's a comment wtf
By: Glenda (Tue Aug 11 00:27:46 EDT 2015)
What about... wait, is this just storing a shitload of JPEGs? Or some less efficient video format? Why not encode them as VP9 or something? Why not uhfuck
some shit like that
also "deduplication" or motion detection and not recording stuff that's not moving or something
By: absent (Thu Aug 13 21:58:05 EDT 2015)
"Motion": http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome is already a thing. I could use a different format, it's using the default output from the stream, which is this: https://en.wikipedia.org/wiki/H.264/MPEG-4_AVCI wonder if I could do compression or something.
I just wanted something to work quickly because I don't have loads of time to dump into this, but I'll probably keep working on it in the future.
By: Glenda (Sat Jul 25 14:00:15 EDT 2015)
moshi moshi anon desuPretty good. Fuck bloated shit.