Back to all posts

Phone Security Camera — old Android into a 24/7 stream

A streaming-infra project: RTMP ingest, HLS playback, deployed to the cloud.

Phone Security Camera — old Android into a 24/7 stream
Tech stack
MediaMTXDockerRTMPHLSRailwayngrokPowerShell

A self-hosted way to turn any old Android phone into a password-protected, internet-accessible 24/7 security camera. Built on MediaMTX in Docker, ingesting RTMP and serving HLS, with two deployment paths: Railway (no PC) or ngrok (local).

The problem

Commercial IP cameras are expensive and lock you into a vendor cloud. I wanted to reuse hardware everyone already owns — an old phone — and get a permanent, authenticated stream URL I could open from anywhere.

Approach

The phone streams via Larix Broadcaster or IP Webcam over RTMP into a MediaMTX server, which republishes it as HLS for playback in any browser. I containerized MediaMTX with Docker and automated the local tunnel path with PowerShell scripts.

Engineering decisions

Two deployment paths for different needs: Railway hosts the Docker image with ports 1935 (RTMP) and 8888 (HLS) exposed and credentials in mediamtx.yml — a permanent URL, no PC required. The ngrok path is free but needs a PC running. Authentication and stream stability (battery, autostart, screen pinning) were first-class concerns.

What I learned

This was my hands-on dive into streaming infrastructure and DevOps: RTMP vs HLS trade-offs, containerizing a media server, exposing ports safely, and the unglamorous reliability work — keeping a 24/7 stream alive on consumer hardware.