Hi,
I like to integrate the rtsp stream from my Foscam cameras into pimatic. Unfortunately the cameras don’t support mjpeg. Currently I’m using iframes which are filled by the snapshot of the cams. It is okay, but I like more to have a moving picture.
The Foscam pluging does not work for me. The ipcamera plugin doesn’t support rstp.
Maybe there is some other way. Someone an idea?
-
RTSP stream in Pimatic. Is this somehow possible
-
@OrTiN I have corrected a typo in your post - the protocol is called >> RTSP <<.
If you search the forum for this this acronym you will get multiple hits."It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
Ah okay sorry thx for correction.
-
There doesn’t exist a good guide on how to do this, but I have this with two methods now. I think the first one could be used with iFrame, the second one possibly couldn’t, because the browser needs to know the format beforehand with HLS.
The first method uses ffmpeg and ffserver (part of ffmpeg). It consumes the RTSP stream and turns it into WEBM format stream, which is forwarded to specified url. The IP-camera plugin uses snapshots, so it isn’t able to show moving picture as far as I know, but with iFraming the url that ffserver makes, it should be possible to show moving picture.
And of course, you can start and stop the stream with buttons in pimatic that run shell-execute rules.The second method includes using a separate HTML page (mine is a extension GUI of Pimatic itself), and putting the specified ffserver url in <video> tags. This works with both Webm and HLS formats (with HLS you need to use a jquery player that supports HLS, like VideoJS-HLS). I transcoded RTSP to HLS with NimbleStreamer (free, but the configuration tool is free only for 15 days)
I can put out my ffconfig.conf file and the starting command for ffmpeg for you if you want them
.
To install ffmpeg, you may need to update your sources on your distro. Here’s how you can do that.It is now available for Jessy as a backport: https://packages.debian.org/jessie-backports/ffmpeg Add something like this to /etc/apt/sources.list (with your preferred mirror): deb http://ftp.uk.debian.org/debian jessie-backports main Then apt-get update apt-get install ffmpeg
ffserver.conf for WEBM stream
HTTPPort 8090 # Port to bind the server to HTTPBindAddress 0.0.0.0 MaxHTTPConnections 2000 MaxClients 1000 MaxBandwidth 10000 # Maximum bandwidth per client # set this high enough to exceed stream bitrate CustomLog - <Feed feed.ffm> File /tmp/feed.ffm FileMaxSize 1M ACL allow localhost ACL allow 127.0.0.1 ACL allow 192.168.1.0 192.168.255.255 </Feed> <Stream feed.webm> Format webm Feed feed.ffm NoAudio VideoCodec libvpx VideoFrameRate 10 VideoBitRate 1024 VideoSize 480x270 VideoBufferSize 1024 AVOptionVideo flags +global_header StartSendOnKey NoDefaults </Stream> <Stream status.html> # Server status URL Format status # Only allow local people to get the status ACL allow localhost </Stream> <Redirect index.html> # Just an URL redirect for index # Redirect index.html to the appropriate site URL url/ </Redirect>
starting command for webm stream with RTSP as source, check url and directory from your own camera
sudo ffmpeg -i rtsp://user:pass@ipaddresstocamera/videoSub -map 0 http://linuxmachinesipaddress:8090/feed.ffm
After this, the stream should start and should be openable from browser, using address http://linuxmachinesipaddress:8090/feed.webm (not .ffm)
If you get errors concerning IP addresses, add ACL allow <linuxmachines ip address> to the ffserver.conf -file
-
RTSP and H264: This is really a tricky topic.
I also tried to integrate cam-live views on the pimatic GUI and made a setup using an iframe-device (pimatic-iframe plugin) for the streams. But after a while pimatic crashes because memory usage is really high. Depending on the # of cams and the picture rate. From my experience you can handle max. 2 cams with a max framerate of 5pics/sec.As i didn’t to manage running this on a stable base (and not using the above mentioned additional stream-component with ffmpeg etc.) i switched to ioBroker as an additional frontend to generate a specific GUI with all this stuff and installed it on a seperate Pi3+larger touchdisplay-mounted in a frame on the wall as central console.
An other option would be to use VNC as a streaming-server (on pimatic or seperate machine) which converts the RTSP stream to a normal HTTP stream.
Nevertheless you need a ‘frontend’ -> browser who can handle this input if you include pure RTSP stream. From my research only an older firefox SRE with an installed VNC-plugin give this opportunity, as newer firefox versions blocks this kind of plugins since V46. or so…
Nevertheless f you like to try: here’s my ‘working’ config (ip-adress, username:password and cam-specific url) to be adopted.
{"class": "iframeDevice", "id": "cam_iframe_1", "name": "Cam Flur", "url": "rtsp://username:password@ip-adress:554/ipcam_h264.sdp", "width": 340, "height": 240, "border": 1, "scrolling": "no", "scale": 1, "reload": 0, "enforceReload": false },
-
Hey guys,
thx for your tips. Will try it tonight.@kitsunen: Would be nice to get you config file as template. This is really new for me an will help!
@fennsen: I want to use it exactly for two cams and 5 pic/s is okay too. I tried already to use iframe with rtsp, but I was not able to make it running. I will try once more.The idea to use vlc seems to be a really got way. My cams works on VLC perfectly. Must check how to config VLC on pimatic.