I’ve got several Hikvision h264 IP security cameras on my LAN. I can view them using an RTSP stream. They work fine on: Kodi on Windows, VLC on Mac and various Camera viewing Apps on iOS and Android, however they regularly have problems (*) on my OSMC based RPi3 and Vero 4k. I always thought it was a lack of grunt on the RPi3 causing the issue, but now I’m on Vero 4k’s I don’t think that can be the case anymore and I wonder if it’s a codec limitation on Linux/OSMC based Kodi versions?
(*) problems are generally half the screen taking 15sec+ to draw. Sometimes the bottom half shows a blurry green and bright coloured mess (sometimes all green) - it does seem to be from the camera as you can see people moving around and then walking into the top, clear, part of the picture. Sometimes the image doesn’t correct itself at all and sometimes (very occasionally) it works perfectly. Other issues include; the feed stopping randomly (no error message, just the image locks up) fixed by stopping/playing again.
Occasionally VLC on my Mac will show a similar corruption, but when it does it only lasts for less than 2 seconds when I start playing the feed. The feeds work perfectly on a Windows Kodi install.
I’ve tried disabling Hardware decoding on the Vero and I’ve changed every setting I can think of on the IP Camera. They are currently running a 4Mbps, 1080p, 20FPS with an IFrame at every 20 frames.
I don’t have any non-OSMC Linux Kodi installs to allow me to rule in/out whether it’s an OSMC issue or a base Kodi issue.
Before I start taking pictures of the screen, capturing debug logs and grabbing the codec info, is there anything obvious I’m missing? Has anyone noticed this problem before? Is there anything else (other than the logs, etc that I’ve just mentioned) that could help diagnose the problem?
On VLC I experience the same problem with my Hikvision. It takes a few seconds for the picture to look correct. I believe this is because it takes some time for their to be enough previous frames to build a proper image.
If you disable hardware acceleration and it’s still not playing correctly in software; then this isn’t a Kodi / ffmpeg issue. I haven’t tried to play back my cameras via Kodi before, but might give it a go.
I created the play files by naming them CameraName.strm the only line in the file is the URL:
rtsp://username:password@x.x.x.x/Streaming/Channels/101
Interestingly one of the cameras I have never seems to have a problem. They are all identical spec, identical firmware and identical settings.
I suspect the Hikvision NVR I’m using may be part of the problem. On one occasion a while back on the RPi3 I was observing a camera, the image went increasingly grainy and after a while the picture was clearly a very grainy/garbled picture from one of the other cameras. I’ve never experienced anything like that on any of the other platforms I’ve used to view the stream, but I can’t see how Kodi could have done that on its own! I wonder if the H264 feed passthrough on the NVR isn’t very pure and FFMPEG isn’t as tolerant as other players.
Unfortunately the NVR puts the cameras in their own subnet and managed them itself so I can’t easily retrieve the stream direct from the camera to rule that out.
BTW: I’ve been seriously impressed with the responsiveness and quality of the support I’ve received from you/your team. I hope “sam_nazarko” is an account used by everyone at OSMC, because if it isn’t you must be doing 20hr+ 7 days a week!
It’s possible there’s some tinkering occurring with the NVR.
ffmepg is used by a lot of popular media players; such as VLC. I also see problems with VLC so it’s certainly possible that there’s something in the stream that ffmpeg does not like. I find that seeking causes the picture to break up quite often.
As an aside, I’m looking at ditching the traditional NVR and using Zoneminder. I’m not sure how well it will work though (seems to need a lot of resources)
Before I purchased the NVR I looked into a few software NVR solutions. I ran iSpy for a while with a couple of D-Link cameras, but the constant hardrive writing was thrashing my NAS too much for comfort. One of the really popular pieces of software seemed to be Blue Iris, but all the indications I found were that you would need a pretty grunty machine to run multiple HD cameras (esp. with motion detection). By the time I priced up all the hardware, a switch with PoE and the software I figured I would be better off with buying an NVR appliance off AliExpress. I got quite a bargain on a high-end Hikvision 16 channel NVR. It was probably about half the cost of the PC/switch hardware (although NZ can be very expensive for hardware). It integrated seamlessly with my Hikvision cameras and saved the ongoing maintenance & electricity costs of a PC based solution. Until now I’ve been very happy with the decision, but the playback issue is somewhat of a pain and I’m sure the NVR has its part to play in it. There’s also undeniably something appealing about a software based solution that can be customised!
If I’ve found the right release notes, it sounds like Kodi might be quite far behind the latest stable release of ffmpeg (v2.8.5 vs v3.3.3)? I see the v18 beta has v3.1.6 so fingers crossed that’ll help in the future.
Might be worth spinning up a VM and testingZoneMinder and Shinobi and comparing them. I can forward you the IP when they’re up and you can take a look.
I have a Xeon E5-2620v4 in the home server; so software NVR should work. Hopefully it won’t require crazy amounts of memory.
I currently use ZoneMinder in an Ubuntu 16.04 VM supporting two cameras and 4 rtsp video streams. It works well enough but is a bit of a CPU/memory hog. It’s been a while since I set everything up but I recall that I found streaming MJPEG images was preferable to streaming H264 since, although the former uses more network resource and (I think) more shared memory, the latter really burns up the CPU when converting H264 into individual JPEG images. It’s a crazy and inefficient way to do things - and they’re working on fixing it - but for now that’s how it works. But it does work, so I’m still using it and have no major issues, though if/when I increase the camera count, I’d seriously consider moving to a small NVR. Finding one with half-decent firmware that’s supported with updates (shock!) might not be so easy…
I looked at Shinobi a while back but felt it was still a bit immature at the time. I just checked out the site and it’s come on a bit since then, so perhaps I’ll give it a try.
I installed Shinobi last weekend. It’s not bad, but it seems that there’s a lot of external modules needed for a lot of functionality that other software NVRs include out of the box.
I’ve moved to ZoneMinder and that seems to be the best option for me. I haven’t been able to preview from the web interface; but I think that the PPA for Ubuntu 16.04 has problems with cgi-bin and how it configures Apache.
For anyone who finds this post in the future and is having a similar issue, I resolved the streaming corruption issue by getting the stream directly from the camera, rather than through the Hikvision NVR (DS-7716NI).
I tried the August 2017 update with ffmpeg v3.1.9 but still the corruption remained. Linux Kodi seems to be the only platform with this problem, all my other devices were quite happy, so I can’t explain why it’s a problem, but I’ve got a workaround so on with life!
For anyone in a similar situation, here’s how to access the cameras when they are on the private NVR network:
Enable Virtual Host (in Advanced Networking config) on the NVR so you can get to each camera’s web config page.
Add a route on your router for 192.168.254.0/24 via whatever the usual IP address is you use to access your NVR.
Logon to each camera (see System > “Camera Management” on the NVR for the URL) and:
** Add 192.168.254.1 as a default gateway IP address.
** Create a viewer user with only “Live View” privileges.
Create a text file in a Kodi video source for each camera called CameraName.strm. The file should contain the line:
Sorry to reply to an old thread but this is the closest thing I’ve found to a possible solution for this, but I need some bit of help to get it working.
Add a route on your router for 192.168.254.0/24 via whatever the usual IP address is you use to access your NVR.
I have a static route set up where
network/host IP = 192.168.254.0
netmask = 255.255.255.0
gateway = IP address of my NVR
I’ve done all of the steps including setting the default gateway IP for my camera to 192.168.254.1 but I can’t access the stream via
Can you get to the camera’s web UI? http://192.168.254.?
(that’ll confirm the IP routing is working)
Hikvision have tightened their security on the cameras, basic auth is off by default now (which stop rtsp://user:password@ type URL’s). You will need to turn that on in the web UI (if you haven’t already).
The direct path to the camera does not work on VLC, but the path through the NVR does.
Hmm, I can only get to it via <NVR_IP>:<port_for_specific_camera>, but not directly (connection timed out). So does that mean I’ve set up the static route incorrectly for my router?
It’s enabled via the NVR settings (System → Security → Security Service)