Turning a Chinese IoT camera into an owl livestream
a day ago
- #jailbreak tweak development
- #IoT reverse-engineering
- #wildlife livestreaming
- The article describes a project to create a livestream of a Great Horned Owl nest using a Chinese IoT camera.
- Spencer, an artist and conservationist, set up an S4 Pro camera from Premium Invention (a rebranded Nice Intelligence Y5 Camera) in a forest.
- The NiView app used with the camera required app downloads and link sharing for viewing, which didn't scale well and drained battery.
- Initial attempts to extract a web viewer or stream file (e.g., .m3u8) via the manufacturer's websites were unsuccessful.
- Using mitmproxy to intercept network traffic revealed encrypted API requests to Tencent Cloud but no direct video stream URLs.
- The NiView app was decrypted from a jailbroken iPhone using bfdecrypt, allowing inspection of its code and resources.
- Debugging with lldb and Hopper identified key classes like NVLivePlayerView and IVVideoRender for video rendering.
- The video feed used a P2P relay via Tencent's servers (list.iotvideo.tencentcs.com), making direct reverse-engineering complex.
- A jailbreak tweak was developed using Theos to hook into IVVideoRender's _renderVideoFrame method, capture YUV frames, convert them to JPEGs, and stream them via a local HTTP server on port 8080.
- The tweak composited images (cropping and downsampling) to show the zoomed view with overlays like timestamps, and sent MJPEG streams to clients.
- A Python script and PHP wrapper were created to cache and rebroadcast the stream from an EC2 server, reducing load on the iPhone.
- Pitfalls included memory leaks in the tweak (fixed with static buffers and autorelease pools), image compositing challenges, and camera battery drain (solved temporarily with an external battery).
- The project highlights the technical hurdles of reverse-engineering proprietary IoT systems and offers a workaround for similar livestreaming needs, suggesting cameras with RTSP support for future projects.