Stream your Android phone's camera to any device over WiFi with real-time controls.
Turn your old Android phone into a wireless IP camera! This project creates a web-based camera streaming server that runs entirely in Termux, allowing you to view and control your phone's camera from any browser on your local network.
- ๐ Web-Based Interface - View and control from any device (PC, tablet, another phone)
- ๐ฑ Browser Capture Mode - High FPS streaming (20-30 FPS) using the phone's native camera API
- ๐ท Termux Capture Mode - Fallback mode using
termux-camera-photo(lower FPS but always works) - โก Real-Time Settings - Change quality, resolution, zoom, rotation, and mirror on the fly
- ๐ Dark/Light Theme - Easy on the eyes, day or night
- ๐ฅ Recording - Save streams as MJPEG files
- ๐ธ Snapshots & Burst - Capture still images with one click
- โจ๏ธ Keyboard Shortcuts - Space for snapshot, F for fullscreen
- ๐ฆ Download ZIP - Download all recordings at once
- ๐ฑ Mobile Responsive - Works great on phones and desktops
- Install Termux from F-Droid (NOT Google Play - that version is outdated)
- Install Termux:API from F-Droid
# Update packages
pkg update && pkg upgrade -y
# Install required packages
pkg install python termux-api -y
# Install Python dependencies
pip install Pillow
# Clone the repository
git clone https://github.com/HoomanJCode/Termux_WebCameraStream.git
cd Termux_WebCameraStream
# Run the server
python server.py-
Start the server on your phone:
python server.py
-
Option A: High FPS Browser Mode (Recommended)
- On your phone's browser, open:
http://localhost:8080/capture - Grant camera permission when prompted
- On your PC browser, open:
http://[PHONE_IP]:8080 - Switch capture mode to "Browser Camera" in the sidebar
- Enjoy 20-30 FPS streaming!
- On your phone's browser, open:
-
Option B: Termux Mode (Fallback)
- Just open
http://[PHONE_IP]:8080on any device - Uses
termux-camera-photo(~1 FPS but no browser needed on phone)
- Just open
# In Termux:
ifconfig wlan0 | grep 'inet ' | awk '{print $2}'| Control | Description |
|---|---|
| Capture Mode | Switch between Browser (fast) and Termux (compatible) |
| Resolution | 320x240 to 1280x720 (higher = more detail, slower) |
| Quality | JPEG compression 10-100% (lower = faster, higher = better) |
| Zoom | Digital zoom 1.0x - 5.0x |
| Rotation | 0ยฐ, 90ยฐ, 180ยฐ, 270ยฐ |
| Mirror H/V | Flip image horizontally/vertically |
| Flash | Toggle flashlight (Termux mode only) |
| Button | Action |
|---|---|
| ๐ท Snapshot | Save current frame as JPEG |
| ๐ธ Burst (5) | Take 5 rapid snapshots |
| โบ Record | Start recording MJPEG video |
| โน Stop | Stop recording and save |
| ๐ก Flash | Toggle LED flash |
| โถ Fullscreen | Enter fullscreen mode |
| ๐ Theme | Switch dark/light theme |
| ๐ฆ Download ZIP | Download all recordings |
| Key | Action |
|---|---|
Space |
Take snapshot |
F |
Toggle fullscreen |
Termux_WebCameraStream/
โโโ server.py # Main HTTP server with WebSocket support
โโโ camera.py # Termux camera capture module
โโโ settings.py # JSON-based settings management
โโโ static/
โ โโโ index.html # Main web interface (PC viewer)
โ โโโ capture.html # Phone camera capture page
โ โโโ style.css # Dark/light theme styles
โ โโโ script.js # Client-side logic & API calls
โโโ camera_settings.json # Persistent settings file
โโโ recordings/ # Saved MJPEG recordings
python server.py -p 8080 # Custom port (default: 8080)
python server.py -s myconf.json # Custom settings fileSettings are stored in camera_settings.json and can be edited manually:
{
"camera_id": 0,
"width": 640,
"height": 480,
"quality": 80,
"rotation": 0,
"zoom": 1.0,
"mirror_h": false,
"mirror_v": false,
"show_timestamp": false,
"show_grid": false,
"motion_detection": false,
"motion_threshold": 30
}Status: Open - Help Wanted!
When changing the quality setting in Browser mode, the video stream sometimes shows a black screen or flickers. This issue is being actively investigated.
What we know:
- Only occurs in Browser capture mode
- Triggered by quality setting changes
- May be related to canvas rendering or JPEG encoding timing
- The stream recovers after a few seconds
If you can help fix this:
- Check
static/capture.html- thecaptureFrame()function - The issue may be in how
toBlob()ortoDataURL()handles quality changes - Could be a race condition between canvas updates and WebSocket sending
- PRs are welcome! Please test on multiple Android versions
Workaround: Avoid changing quality while streaming, or refresh the /capture page after changing settings.
This project was created through vibe coding with DeepSeek - an AI-assisted development process. We welcome contributions from humans and AIs alike!
-
Report bugs - Open an issue with:
- Android version
- Termux version
- Steps to reproduce
- Console logs (F12 in browser)
-
Fix the black screen bug - See Known Issues above
-
Add features - Ideas welcome:
- Audio streaming
- PTZ controls
- Motion detection alerts
- Multiple camera support
- RTSP/RTMP output
- Docker support
- Home Assistant integration
-
Improve documentation - Better install guides, troubleshooting, etc.
# Fork and clone
git clone https://github.com/HoomanJCode/Termux_WebCameraStream.git
cd Termux_WebCameraStream
# Create a test environment
python -m venv venv
source venv/bin/activate # On Termux, just use system python
pip install Pillow
# Run in debug mode
python server.py- View your camera stream
- Change camera settings
- Take snapshots and recordings
Do NOT expose this server to the internet. Only use it on trusted local networks. The server binds to 0.0.0.0 by default, meaning it's accessible to all devices on your WiFi.
- Respect privacy laws in your jurisdiction
- Do not use for surveillance without consent
- You are responsible for how you use this software
- This project is provided AS IS without warranty
- Tested on Android 10-14 with Termux from F-Droid
- Browser capture requires a modern browser (Chrome/Firefox)
- Termux capture mode requires
termux-camera-photofrom Termux:API - Not all Android devices support all camera features
- Baby monitor - Keep an eye on your little one
- Pet cam - Watch your pets while away
- Security camera - Monitor your room/garage
- 3D printer monitor - Check your prints remotely
- Timelapse photography - Record long processes
- Webcam for PC - Use your phone as a high-quality webcam
- IoT integration - Stream to Home Assistant, Node-RED, etc.
MIT License - See LICENSE file for details.
- DeepSeek AI - Primary development assistant (vibe coding ๐ค)
- Termux Team - Amazing terminal emulator for Android
- Pillow - Python imaging library
- All contributors - Those who help fix bugs and add features
If this project helps you, please โญ star it on GitHub! It helps others find it and motivates further development.
Made with โค๏ธ and โ in Termux, powered by DeepSeek AI
"Vibe coding is real, and it's spectacular" - Someone, probably