Skip to content
direkPublic
forked from fritz-smh/yi-hack

About

Xiaomi Yi Ants 22CN: Fritz's hack with camera-native ONVIF and RTSP for UniFi Protect

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Latest commit

 

History

32 Commits

Folders and files

Repository files navigation

Yi Ants 22CN: ONVIF and RTSP for UniFi Protect

A fork of fritz-smh/yi-hack with an SD-card add-on, providing ONVIF and a corrected H.264 RTSP stream. All processing runs on the camera. No computer, go2rtc service, or external FFmpeg relay is required.

Release: test4. Documentation updated October 29, 2026. This is an extension to an existing hack, not a replacement firmware image to flash.

The original base-hack instructions are preserved in README.upstream.md. Install and configure the base hack first if it is not already working. The fork adds an optional startup hook: it runs the add-on only when sd/yi-onvif/boot.sh is present. Set your ONVIF password before expecting it to start successfully.

Getting started

Use the installation ZIP, or copy sd/yi-onvif to the SD root. The complete source archive is for building and relinking, not installation on the card.

Tested configuration

Component Tested setup
Camera Xiaomi Yi Ants, serial prefix 22CN; one physical camera tested
Platform Hi3518, ARM926EJ-S / ARMv5TE, little endian, software floating point
System Linux 3.0.8; original uClibc 0.9.32.1
Linux-visible RAM Approximately 35 MB
Prerequisite Working fritz-smh/yi-hack with rtspsvrM
Video H.264, 1280×720, approximately 25 fps
Recorder UniFi Protect 7.3.70

Verified: adoption, video in Protect, two simultaneous players, reconnecting clients, and video after a rapid service restart. The automatic startup hook was installed on the tested camera. A full power-cycle test with this hook remains outstanding. A 22CN serial prefix alone does not establish hardware compatibility.

The binaries are statically linked and do not require replacing the camera's original libraries. Documentation updates preserve the tested runtime files.

Video path

fritz-smh rtspsvrM:554
        | RTSP/H.264 inside the camera
        v
yi_normalize: SPS/PPS handling and AUD insertion; no video decoding
        | FIFO /tmp/yi-normalized.h264
        v
yi_h264_server:28554 ------> UniFi Protect

ONVIF: lighttpd:8080 + onvif_simple_server
Discovery: wsd_simple_server, UDP 3702

The normalizer uses FFmpeg libraries to copy video and correct headers. It does not run x264 or re-encode the image. Header normalization together with RTP repacketization fixed a stream that played in VLC but produced no image in Protect. Plain go2rtc forwarding did not resolve it.

Endpoints

Replace CAMERA_IP with the address of each camera. Every camera needs its own network address.

Service Endpoint
ONVIF http://CAMERA_IP:8080/onvif/device_service
Corrected RTSP rtsp://CAMERA_IP:28554/ch0_0.h264
Original fritz-smh RTSP rtsp://CAMERA_IP:554/ch0_0.h264
ONVIF credentials User admin; password set using setup.sh
Discovery UDP 3702

ONVIF credentials are separate from root credentials and do not protect RTSP. The distributable configuration contains password=CHANGE_ME, never the tested camera's password.

Scope

This release exposes a video-only H.264 profile. Audio, snapshots, PTZ, and motion events are not implemented. It does not add Protect AI features. Other camera models and Protect versions have not been tested, and no formal ONVIF certification is claimed.

Repository layout

Directory Contents
sd/ Original Fritz SD layout plus yi-onvif/; use the base-hack instructions for initial setup
sd/yi-onvif/ Tested camera-only add-on and clean configuration template
onvif/src/ Custom video normalizer, RTSP server, and ARMv5 helpers
onvif/build/ Build/assembly scripts, overlaid onto the complete release source bundle
onvif/patches/ Reviewable changes to ONVIF, lighttpd, and live555
docs/ English installation, operation, troubleshooting, and build guides
tools/ Offline verification, release packaging, and source preparation

Download installable packages and corresponding sources from GitHub Releases. Camera credentials, device backups, experiment logs, and computer relays are excluded from this repository.

Attribution and licenses

Base hack: fritz-smh/yi-hack. ONVIF implementation: roleoroleo/onvif_simple_server. The video path uses live555 2024-10-24 and FFmpeg 7.1.1 libraries. See architecture and licensing; dependency license texts accompany the package.

About

Xiaomi Yi Ants 22CN: Fritz's hack with camera-native ONVIF and RTSP for UniFi Protect

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages