EZVIZ / Hik-Connect cloud P2P source (HEVC + audio, no port-forwarding)
The ask: would you take an EZVIZ / Hik-Connect cloud P2P source? It's built and verified live against a real NVR, ready to send as a small stacked series. Two calls I'd want from you before I open it upstream:
- Scheme name:
ezviz:orhikconnect:as the primary? (both are aliased) - Target
dev, laid out like an existing source?
Live Garage Outside channel in the browser (HEVC source transcoded to H.264, with the G.711 audio track):
The code is already up as draft PRs on my fork if you'd rather read it than take my word for it:
- pedropaulovc/go2rtc#1 — data-plane source: the
pkg/ezvizskeleton, codec probe, NAL handoff. - pedropaulovc/go2rtc#2 — P2P transport: login → P2P_SETUP → hole-punch → SRT → HEVC. Stacked on pedropaulovc/go2rtc#1.
- pedropaulovc/go2rtc#6 — discovery: the account device/stream wizard. Stacked on pedropaulovc/go2rtc#2.
- pedropaulovc/go2rtc#8 — playback: a
start/endwindow on the URL streams recordings (MPEG-PS) instead of live. Stacked on pedropaulovc/go2rtc#6.
Why
There's no cloud source for Hikvision/EZVIZ in go2rtc today. isapi: is
backchannel audio only, and the README itself flags Hikvision's "proprietary
streaming technologies." If a camera only reaches the Hik-Connect cloud, with no
LAN, RTSP, or port-forwarding, there's no way in. People keep asking for it:
#351, #2244, #2257.
What it does
I reverse-engineered the Hik-Connect P2P streaming protocol end to end and wrote
it as a pkg/ezviz/ source (aliased hikconnect:). It runs credentials-only,
no hardcoded keys: login → P2P_SETUP → UDP hole-punch → SRT → HEVC. The relay and
VTM fallbacks aren't needed for this path.
Verified live against a real NVR:
- Video: 4K HEVC main stream plus a 640×480 sub, sustained and real-time.
- Audio: the interleaved G.711 A-law track comes out as a second track (PCMA/8000), kept in sync with video off a shared real-time clock.
- Discovery: an "EZVIZ / Hik-Connect" wizard on the Add page logs into the
account and lists every device and channel at
mainandsubas ready-to-add sources. Same listing read-only atGET /api/ezviz.
It's modeled on pkg/tutk and pkg/wyze, because the shape is identical: cloud
lookup, hole-punch, reorder buffer, decrypt, emit NALs. Frames hand off as whole
H.265 access units through the RAW path (PayloadTypeRAW + WriteRTP), so
pkg/h265 does the rest. It builds, vets, and runs race-clean, with unit tests
for the V3 binary codec (byte-checked against openssl) and the Hik-RTP de-framer.
Protocol summary
- Auth/config:
POST /api/p2p/configurationsreturns a per-session, salt-indexedP2PServerKey(8 rotating keys, never hardcoded). Login is the standard Hik-Connect REST flow. - Setup: V3 binary protocol (TLV, custom CRC-8, AES-128-CBC).
P2P_SETUP(0x0B02) → device hole-punch (0x0C00/0x0C01) →PLAY_REQUEST(0x0C02). - Transport: the device's proprietary one-way SRT dialect over UDP. The client only parses and ACKs (no SRT library). Control (0x807f) and video (0x8060/0x8050) use separate ACK sequence spaces; route them independently or the device flow-control stalls.
- Media: strip Hik-RTP (12B) and sub (13B) headers, reassemble RFC 7798 FUs (type 49) into Annex-B HEVC. Audio shares the framing, marked by a sub-header byte, carrying raw G.711 A-law. Playback recordings come as MPEG-PS instead.
- Crypto: AES-128-CBC and custom CRC-8 for the V3 protocol, HMAC-SHA256 for
the KMS-derived inner key. All Go stdlib plus
x/crypto.
Why would you do a total workaround when you can use API keys that you can generate via HikConnect. Those keys can then be used to generate bearerToken which is authentication for all OpenApi HC requests, as well web player by ezviz.
Player: https://github.com/Ezviz-OpenBiz/EZUIKit-JavaScript-npm
Documentation: https://www.scribd.com/document/755038880/Hik-Connect-for-Teams-OpenAPI-Developer-Guide-V6-2-1-20240606
You really dont need to overthink this, as there is official way to go with.
Cheers,
@trempetic92 thanks a lot for looking into this! I scoured the internet for a Hik-Connect supported way to access my CCTV cameras outside iVMS before resorting to reverse engineering. I am actually using the consumer version of Hik-Connect, not Hik-Connect for Teams, and I don't have a developer account with them to generate API keys.
If I understood correctly, the EZViz alternative you suggested costs ~$600+/yr plus $0.40/GB egress above 3 channels / 10 devices / 120 days. My alternative is free and uses P2P so no video traffic goes through Hik-Connect's service.
I am hoping that the PRs I linked above would help people who want to hookup their Hikvision cameras to Frida or Home Assistant for free. Let me know if I missed anything. Thanks!
HikConnectTeams is just TeamCreated inside HC account. After team is created, API KEys can be generated for free.
Ezviz url i sent is just a webplayer. Since HikConnect under the hood uses ezviz:// protocol stream url to play it. ezviz player is made to play it directly.
Usage in my custom app: https://i.imgur.com/QHl7rJT.jpeg
I swear I am trying but I can't find the option to create a team inside the Hik-connect app, both iOS or Android. Do you have a doc page I can look at?
Ok thats weird. It should be under services, create a team. Try log in via web browser to hik connect, it should suggest you first time to create a team
So how do you make it work?
So how do you make it work?
Tbh, i would delete device from account, delete an account permanently and create again. It seems you are not being offered to have team mode :/, but you should have.
Once Team mode is created you can generate tokens for OpenAPI.
The thing about recreating login like this(done it myself as well) is not stable. If they change anything it will stop working.
If you need help, I'm available to support in DM.
Cheers