AI helped:
Vico → Home Assistant via Genymotion — Complete tutorial
Summary: run Vico’s Android app inside Genymotion, capture the emulator window with ffmpeg, publish to a local mediaMTX (RTSP) server, and add the stream to Home Assistant.
Prerequisites
- Linux host with X11 session (x11grab). If using Wayland, switch to X11 or use an alternate capture method.
- Genymotion installed and a virtual device (e.g., Pixel 5, Android 11 / API 30).
- ffmpeg, wmctrl, docker (for mediaMTX), and optionally docker-compose installed.
- Basic Home Assistant access.
Step 1 — Share camera via guest account
- In the Vico app on your phone, create/add a guest account and share the camera with that guest.
Step 2 — Set up Genymotion and install Vico
- Install Genymotion on your Linux machine and create a virtual device (Pixel 5, Android 11 / API 30 recommended).
- Install ARM translation (e.g., Genymotion ARM translation / libhoudini) to allow ARM APKs.
- Install the Vico APK (Aurora Store or VicoHome for PC). Grant necessary permissions (storage, notifications, camera if asked).
- Log into the guest account in the Vico app and confirm live view and alerts work. Reboot the virtual device occasionally if the app becomes unstable.
Step 3 — Run mediaMTX (RTSP server)
- Quick test (ephemeral):
docker run --rm -it --network=host bluenviron/mediamtx:latest
- For persistence, use docker-compose with a config file (examples below in the systemd/docker-compose section).
mediaMTX will listen on port 8554 by default when using host networking.
Step 4 — Capture Genymotion window and stream to mediaMTX
- Find the Genymotion window id:
wmctrl -l | grep -i genymotion
Note the hex window id (e.g., 0x00c0001b).
- Start ffmpeg to capture that window and push RTSP (replace window_id and host as needed):
/usr/bin/ffmpeg -f x11grab -framerate 30 -window_id 0x00c0001b -i :0.0 -c:v libx264 -preset veryfast -b:v 2000k -g 60 -f rtsp rtsp://localhost:8554/geny
- Adjust
-b:v (bitrate), -framerate, and -preset for CPU/quality tradeoffs.
- If mediaMTX runs on another host, replace
localhost with that host IP.
- To capture audio, add the appropriate audio input and mapping.
Step 5 — Open/forward port 8554 (if accessing from other machines)
sudo ufw allow 8554/tcp
sudo iptables -A INPUT -p tcp --dport 8554 -j ACCEPT
- Router: forward external TCP port 8554 → host LAN IP port 8554.
Step 6 — Add RTSP stream to Home Assistant
rtsp://<host>:8554/geny
Replace <host> with the IP/hostname of the mediaMTX host (e.g., 192.168.1.50).
Add as a generic camera or via integrations that accept RTSP. Verify the stream in HA dashboards and in VLC.
Persistence: docker-compose + systemd examples
- docker-compose.yml (save to /opt/mediamtx/docker-compose.yml)
version: "3.8"
services:
mediamtx:
image: bluenviron/mediamtx:latest
container_name: mediamtx
restart: unless-stopped
network_mode: "host"
volumes:
- /opt/mediamtx/config.yml:/etc/mediamtx/config.yml:ro
- /opt/mediamtx/data:/var/lib/mediamtx
environment:
- TZ=UTC
Example minimal /opt/mediamtx/config.yml
log:
level: info
rtsp:
protocols: [tcp]
paths:
/geny:
source: rtsp://127.0.0.1:8554/geny
Start:
mkdir -p /opt/mediamtx
# place files
docker compose -f /opt/mediamtx/docker-compose.yml up -d
- systemd unit for ffmpeg (save as /etc/systemd/system/geny-ffmpeg.service)
[Unit]
Description=FFmpeg Genymotion screen capture -> mediaMTX
After=network.target
Wants=docker.service
[Service]
Type=simple
User=YOUR_USER
Environment=DISPLAY=:0
ExecStart=/usr/bin/ffmpeg -f x11grab -framerate 30 -window_id 0x00c0001b -i :0.0 -c:v libx264 -preset veryfast -b:v 2000k -g 60 -f rtsp rtsp://127.0.0.1:8554/geny
Restart=always
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
- Replace
YOUR_USER and window_id, and adjust DISPLAY if needed.
Enable and start:
sudo systemctl daemon-reload
sudo systemctl enable --now geny-ffmpeg.service
- Optional systemd for docker-compose (save as /etc/systemd/system/mediamtx-docker.service)
[Unit]
Description=mediamtx docker-compose
After=network.target docker.service
Requires=docker.service
[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/opt/mediamtx
ExecStart=/usr/bin/docker compose -f /opt/mediamtx/docker-compose.yml up -d
ExecStop=/usr/bin/docker compose -f /opt/mediamtx/docker-compose.yml down
TimeoutStartSec=120
[Install]
WantedBy=multi-user.target
Enable and start:
sudo systemctl daemon-reload
sudo systemctl enable --now mediamtx-docker.service
Tuning, reliability, and tips
- ffmpeg tuning: libx264 with
-preset veryfast/fast and -b:v 1500–3000k; set GOP (-g) to ~framerate×2.
- If the Genymotion window id changes on restart, use a fixed capture region (
x11grab with +X,Y and -video_size) or a small script to discover the window id and restart ffmpeg.
- Run ffmpeg as the X session user; if running system-wide, set
XAUTHORITY to the session owner’s cookie.
- Enable mediaMTX authentication in
config.yml if exposing the stream beyond your LAN.
- For motion detection use (Frigate, etc.), point the detector at the RTSP feed or use Vico alerts inside the emulator.
- GPU acceleration: enable if available (reduce CPU).
- Reboot the Genymotion virtual device occasionally if the Vico app degrades.
Legal / safety note
Confirm your usage complies with Vico’s terms of service and local laws. Secure RTSP endpoints and credentials if accessible outside your LAN.
Checklist (quick)
- ARM translation (libhoudini) installed
- Genymotion running under X11
- Vico APK installed and guest account logged in
- wmctrl used to get window_id
- mediaMTX running and port 8554 reachable
- ffmpeg streaming to rtsp://:8554/geny
- Stream added to Home Assistant
- Persistence (systemd/docker-compose) configured