Do you use the mobile or web app? This can force the camera to revert. You should be able to enable logging and see exactly what is changing it. I wound up setting my substreams to h.264 instead. At 960/480@15 the stream is larger than the main stream for the most part at 2560/1440@15.
This literally cuts my storage in half. I just set it up a few days ago and I think I’m just going to disable the feeds in HA. I’m confused to why I can play h.265 streams on the camera’s web page in Firefox but not in HA because of Firefox.
Hmm, that’s weird…they should work fine in the iOS app (not sure about actionable notifications though) and in Safari. The stream should get passed through to the native player the exact same way for both types of codecs.
Chrome won’t work, as I mentioned above.
Everything works fine when using H.264 but not when using H.265? Have you disabled all kinds of proprietary codec enhancements like H.265+?
Yeah, the compatibility issues across various devices sucks, but there’s not much more we can do. As I mentioned above, a lot of the lack of support is due to the codec wars between Google (and the content providers or codec freeloaders depending on your view eg Netflix) and MPEG-LA (the codec developers or codec extortionists depending on your view).
For my own setup I have all the cameras on H.265 except one which I cast since the cast device doesn’t seem to support H.265 as well as H.264. No issues with the iOS app or Safari.
I’m not sure how you get H.265 streams in Firefox. It’s pretty well documented that the browser doesn’t support H.265. Some camera manufacturers provide web browser plugins to help play camera streams, but I thought they removed support for those types of plugins in Firefox. Is it possible that it’s actually just playing a substream?
My sub steams are D1 480x704 aside from the obvious blurry picture you can just switch the resolution from sub to main stream. It also work fine on chrome.
I grabbed the code from the web page it seems to use h5player for the stream.
I’m sure there is someway to view the codec used in the inspector but I just not sure how to find it. In the debbuger I can see the web app is java and there I find h5.js
I can’t make much of the html you posted, and googling of “h5” and “h5player” was a bit inconclusive. It looks like there may be some Chinese js libraries that use web assembly to decode H.265 video such as https://github.com/tsingsee/EasyPlayer.js .
Unfortunately I don’t have the time now to look into it much further. If you have time, maybe you could dig into it and get us a H.265 solution that works on all platforms =)
You will have to tie the codec to a player which can play HLS streams. Some of those Chinese libraries do that (maybe with ffmpeg in web assembly), but I’m not sure about the licensing on them. Actually I’m not sure HA is allowed to incorporate the codec at all. There seems to be an exemption for costless software but that is only from some of the patent holders - see https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding#Provision_for_costless_software
BTW, hls.js could have gone this route (incorporating ffmpeg in webassembly) but decided against it, possibly for similar reasons - see https://github.com/video-dev/hls.js/issues/2451#issuecomment-592770018
Good luck!
I have a hikvision system too. I don’t think I have the problem of it not keeping the setting, but thought it might be worth noting for yourself or others that there are separate settings for the main stream and secondary stream (i.e. 101 vs 102), and it is possible to have one H.264 and another H.265.
I have “Synology DSM” integration enabled with all my cameras on it. Unfortunately, they just show snapshots, looking pretty and doing nothing because they are streaming in h.265.
Agreed this hopefully will get fixed as cameras are moving toward more compressed stream qualities. I can see my cameras on my cell phones and tablets but not on my PC web browser. very disheartening!!
Indeed it does work on Edge provided you have HEVC extensions installed, but to get it working properly with stream, we need a new release of PyAV that includes this PR I made back in February: Expose codec_tag in codec_context by uvjustin · Pull Request #748 · PyAV-Org/PyAV · GitHub
PyAV hasn’t been updated in quite some time, so if you see a new release please let me know and I will bump the version in HA.
I created a fork of PyAV so we could access the feature needed to get H.265 working in Edge and other chromium builds with H.265 support.
This is in the beta and will be in the 2021.11 release.
Worth mentioning here that I have a Hikvision DS-2CD2455FWD-IW (where do they get these names?!) connected to a Synology Surveillance Station, streaming in H.265+ and, while it does indeed work in Edge, it’s a solid 25 seconds behind real-time. Not complaining, just feeding back.
A similar sort of delay affects my h.264 cameras via Home Assistant (again, same setup to Synology which presents the cameras to HA through the DSM integration) - for the h.264 cameras though, that’s about 7-10 seconds behind real-time.
I overcome this delay using AlexxIT’s WebRTC (HACS integration) for the h.264 cameras when I want to see as near to real-time as possible in HA, but that doesn’t work for the h.265 cameras. Obviously I can use the Synology native Android app if necessary but having a tablet switch to the lovelace card for the camera when motion is detected (and with minimal latency in stream) is the goal.
Still, nice to see h.265 support arriving! Thanks for your work.
Glad the H.265 support works for you.
The latency from H.265+ streams is from the large intervals between i-frames. If you want to reduce latency, use the LL-HLS option that was added in 2021.10 and improved in 2021.11. Stream - Home Assistant (home-assistant.io)
Using the configuration there should help bring your latency down to about 3 seconds even with H.265+.
@uvjustin I have 3 cameras with h265+ streams added with the picture-entity cards. I open the Android HA app. In the view where all 3 are shown below each other, I get bufferIncompatibleCodecsError. But when I click on each of them, the stream loads correctly and an almost live view is shown. Shouldn’t those streams load correctly on the view of 3 cards as well? And not just if I tap on them.