roleoroleo / yi-hack-MStar

Custom firmware for Yi 1080p camera based on MStar platform
GNU General Public License v3.0
850 stars 112 forks source link
6fus camera custom firmware hack rtsp yi

Releases Downloads

Custom firmware for Yi camera based on MStar platform

This firmware is based on the work done by TheCrypt0 https://github.com/TheCrypt0/yi-hack-v4 It's a clone made for Yi cameras based on MStar platform.

But you can't choose between TheCrypt0 and MStar: if your cam is based on Hi3518e Chipset then you have to use TheCrypt0, if your cam is based on MStar Infinity Chipset then you have to use MStar.

I have no time to support the project, so feel free to clone/fork this git and modify it as you want.

Table of Contents

Installation

Install Procedure

  1. Check if your cam is supported in the "Supported cameras" section and note the file prefix.
  2. Format an SD Card as FAT32. It's recommended to format the card in the camera using the camera's native format function. If the card is already formatted, remove all the files.
  3. Download the latest release from the Releases page based on the file prefix.
  4. Extract the contents of the archive to the root of your SD card (for example home_y203c and sys_y203c).
  5. Insert the SD Card and reboot the camera.
  6. The yellow light will come ON and flash for roughly 30 seconds, which means the firmware is being flashed successfully. The camera will boot up.
  7. The yellow light will come ON again for the final stage of flashing. This will take up to 2 minutes.
  8. Blue light should come ON indicating that your WiFi connection has been successful (if not disable using app).
  9. Go in the browser and access the web interface of the camera as a website (http://IP-CAM) where IP-CAM is the IP address of your cam and you can find it using the mobile app (Camera Settings --> Network Info --> IP Address). If the mobile app can't be paired, you may look for the IP on your router's portal (see connected devices).
  10. Done.

Online Update Procedure

  1. Go to the "Maintenance" web page
  2. Check if a new release is available
  3. Click "Upgrade Firmware"
  4. Wait for cam reboot

Manual Update Procedure

Check the wiki: https://github.com/roleoroleo/yi-hack-MStar/wiki/Manual-firmware-upgrade

Optional Utilities

Several optional utilities are avaiable, some supporting experimental features like text-to-speech.

Contributing and Bug Reports

See CONTRIBUTING


Features

This custom firmware contains features replicated from the yi-hack-MStar project and similar to the yi-hack-v4 project.

RTSP Server

I wrote a daemon that reads the video stream directly from the kernel driver memory and sends it to an application based on live555. I was inspired by the following topic:

The RTSP server code derives from live555 - http://www.live555.com/ and from the archive rtsp2303_srcbin_20170414-1630.zip posted in the link above.

RTSP audio support (many thanks to @PieVo for adding it)

The datapath of the audio is as follows: Mic -> ADC -> Kernel sound driver -> TinyAlsa lib -> OMX ALSA plugin -> Camera application (rmm)

To maintain audio support for the original Yi application, the audio should be cloned at one of the steps with the following in mind:

Audio support is implemented by replacing the original TinyAlsa library with a version that copies the read audio frames to a pipe. This pipe is read by the RTSP server. The RTSP server uses a patched WAVFileSource to read the audio data from the pipe. (Since it tries to read the WAV header 2x I saw no (quick) other way than to hardcode the PCM format into the WAVFileSource code.)

Additionally:

Performance

The performance of the cam is not so good (CPU, RAM, etc...). If you enable all the services you may have some problems. For example, enabling both rtsp streams is not recommended. Disable cloud is recommended to save resources.

Supported cameras

Currently this project supports only the following cameras:

Camera Firmware File prefix Remarks
Yi 1080p Home 4FUS 4.5.0* y203c -
Yi 1080p Home 6FUS 4.5.0* y203c -
Yi 1080p Home 9FUS 4.5.0* y203c -
Yi 1080p Home BFUS 4.5.0* y203c -
Yi 1080p Dome 6FUS 4.6.0* h201c Thanks to @skylarhays
Yi 1080p Dome BFUS 4.6.0* h201c Thanks to @skylarhays
Yi 1080p Dome 4FCN 4.6.0* h201c -
Yi 1080p Home 4FUS 4.2.0* y25 -
Yi 1080p Home 9FUS 4.2.0* y25 -
XiaoYi Camera Y3 9FCN 4.2.0* y25 -
Yi 1080p Home 6FUS 2.1.0* y23 -
Yi 1080p Home 6FCN unknown y203c -
Yi 1080p Home 4FCN unknown y23 -
YI Dome Camera X 4.0.0* y30 Experimental
YI Home Camera H7 4.4.0* h307 Experimental
ieGeek IE80 8.0.0* h305r Experimental

This firmware completely overwrite the original firmware. So, USE AT YOUR OWN RISK.

Do not try to use a fw on an unlisted model

Do not try to force the fw loading renaming the files

Is my cam supported?

If you want to know if your cam is supported, please check the serial number (first 4 letters) and the firmware version. If both numbers appear in the same row in the table above, your cam is supported. If not, check the other projects related to Yi cams:

Home Assistant integration

Are you using Home Assistant? Do you want to integrate your cam? Try these custom integrations:

You can also use the web services in Home Assistant -- here's one way to do that. (This example requires the nanotts optional utility to be installed on the camera.) Set up a rest_command in your configuration.yaml to call one of the web services.

rest_command:
  camera_announce:
    url: http://[camera address]/cgi-bin/speak.sh?lang={{language}}&voldb={{volume}}
    method: POST
    payload: "{{message}}"

Create an automation and use yaml in the action to send data to the web service.

service: rest_command.camera_announce
data:
  language: en-US
  message: "All your base are belong to us."
  volume: '-8'

Build your own firmware

If you want to build your own firmware, clone this git and compile using a linux machine. Quick explanation:

Dev tips

Unbricking

If your camera doesn't start repeat the hack as described above (with a lower/higher version) . You can use the same procedure even if you have a backup copy of the original partitions. If the bootloader works correctly the camera will restart.


License

GPLv3

Acknowledgments

Special thanks to the following people for the previous projects I started from.

DISCLAIMER

NOBODY BUT YOU IS RESPONSIBLE FOR ANY USE OR DAMAGE THIS SOFTWARE MAY CAUSE. THIS IS INTENDED FOR EDUCATIONAL PURPOSES ONLY. USE AT YOUR OWN RISK.

Donation

If you like this project, you can buy roleo a beer :)

Click here or use the below QR code to donate via PayPal