I’m relatively new to OpenHab. I have the server up and running with a few basic binding working (local weather / nest).
I have a CCTV security cam system that is using rtsp only and no other way to view the streams and DVR. Is there a way to get the live stream in my portal? I’m currently running the server on centos and using ffmpeg to grab a frame from the rtsp feed every minuet and post it as a jpg. Though I’d really like to have a live feed. The DVR playback would be nice but not 100% necessary.
Yes for the most part. It can be transcoded in real time with VLC, but that was difficult to manage and taxing my CPU as I add more and more cameras. In the end I wrote a bash script that ran ffmpeg to grab and save a frame from each rtsp stream. Since I keep writing over the same file I just added the static image to my sitemap and it refreshes when I load the page. The process would get stuck sometime so I added a line to kill the ones hanging and log the last time it ran successfully. It runs every minute via a cron job. Here is what I used:
#!/bin/bash #Super awesome ffmpeg script
#Kill all hung processes
kill -9 $(ps aux | grep [f]fmpeg | awk ‘{print $2}’)
#Grab still image from camera 1
yes | /usr/local/bin/ffmpeg -i rtsp://my.ip.address/user=MyUser_password=MyPassword_channel=1_stream=0.sdp -vframes 1 -s 480x300 -f image2 /var/www/html/ch01.jpg &
#Grab still image from camera 2
yes | /usr/local/bin/ffmpeg -i rtsp://my.ip.address/user=MyUser_password=MyPassword_channel=1_stream=0.sdp -vframes 1 -s 480x300 -f image2 /var/www/html/ch01.jpg &
#Print log
echo “This script last run on” $(date) > /var/www/html/get-pics.log
I used a call to ffmpeg in a python script running on my windows machine. To get it to work, I had to add a ‘-an’ parameter to get it to save the file correctly. The -an tells ffmpeg to expect no sound. Here is the call I used, in case it will help someone else: