A modern GUI application for managing and recording from multiple IP security cameras with automatic MAC-to-IP resolution, live monitoring, and automated storage management.
- Multi-camera support: Monitor and record from unlimited cameras simultaneously
- Dynamic IP resolution: Automatically find cameras by MAC address using ARP
- Live preview: See thumbnail previews from each camera while recording
- Camera CRUD: Add, edit, and delete cameras through the UI
- Continuous recording: 30-minute video segments (configurable)
- Multi-threaded: Each camera records independently
- Auto-recovery: Automatic reconnection if a camera goes offline
- Date-organized storage: Videos organized in daily folders (YYYY-MM-DD)
- Automatic cleanup: Deletes recordings older than 3 weeks
- Camera Monitor Tab: Visual grid showing all cameras with live previews and status
- Logs Tab: Real-time logging of all system events
- Recordings Tab: Browse and manage recorded videos
- Control Panel: Start/Stop recording with one click
- Settings Dialog: Configure recording duration, storage location, and network settings
- Thread-safe: Proper threading for concurrent camera operations
- Error handling: Graceful handling of network issues and camera failures
- Status indicators: Real-time status for each camera (Idle, Connecting, Recording, Error)
- Persistent configuration: Camera settings saved in JSON format
- Python 3.7 or higher
- Linux, macOS, or Windows
- Network access to IP cameras
- Root/Admin privileges (for ARP scanning)
pip install opencv-python opencv-contrib-python
pip install pillow
pip install scapysudo apt-get update
sudo apt-get install python3-tk
sudo apt-get install libopencv-dev python3-opencv
sudo apt-get install ffmpegbrew install python-tk
brew install opencv
brew install ffmpeg- Install Python with Tkinter (included in standard Python installer)
- OpenCV and FFmpeg will be installed via pip
- Clone or download the application files:
git clone <repository-url>
cd home-security-ui- Install Python dependencies:
pip install -r requirements.txtOr manually:
pip install opencv-python pillow scapy- Verify Tkinter installation:
python -c "import tkinter; print('Tkinter is installed')"- Configure camera information:
- Edit
camera_information_mac.jsonwith your camera details - See Configuration section below
- Edit
The application uses a JSON file to store camera configurations. Each camera entry should include:
[
{
"Name": "garagecamera",
"mac": "AA:BB:CC:DD:EE:01",
"username": "admin",
"Password": "your_password",
"ip": "192.168.1.168",
"stream": "stream1"
}
]Field Descriptions:
Name: Friendly name for the camera (required)mac: MAC address for dynamic IP resolution (required if IP changes)username: Camera login username (required)Password: Camera login password (required)ip: Static IP address (optional if using MAC)stream: RTSP stream path (typically "stream1" or "stream2")
Your IP cameras must support:
- RTSP protocol for video streaming
- Authentication via username/password
- H.264 codec (recommended for compatibility)
The application constructs RTSP URLs as:
rtsp://username:password@ip_address/stream_path
Common stream paths:
stream1- Main stream (high quality)stream2- Sub stream (lower quality)h264- Some cameras use thislive/ch00_0- Hikvision format
sudo python3 home_security_ui.pypython home_security_ui.py- βΆ Start Recording: Begin recording from all cameras
- βΉ Stop Recording: Stop all recordings
- π Refresh Cameras: Reload camera configuration
- Status indicator: Shows current system state
- Displays a grid of all configured cameras
- Shows live preview thumbnails during recording
- Color-coded status indicators:
- Gray (β Idle): Camera not recording
- Orange (β Connecting...): Attempting to connect
- Green (β Recording): Successfully recording
- Red (β Error): Connection or recording error
- Real-time log of all system events
- Timestamps for all activities
- Error messages and debugging information
- Tree view of all recorded videos organized by date
- Shows camera name, timestamp, and file size
- Open Recordings Folder: Open file browser to recordings
- Refresh List: Update the recordings display
- Settings: Configure recording parameters
- Video duration (default: 30 minutes)
- Recording directory (default: ./recorded_videos2026)
- Network range for IP scanning (default: 192.168.1.0/24)
- Exit: Close the application
- Add Camera: Add a new camera to the system
- Edit Camera: Modify camera settings
- Delete Camera: Remove a camera from the system
home-security-ui/
βββ home_security_ui.py # Main application
βββ camera_information_mac.json # Camera configuration
βββ recorded_videos2026/ # Default recording directory
β βββ 2026-02-03/ # Date-based folders
β β βββ garagecamera_20260203_140530.mp4
β β βββ backyardcamera_20260203_140530.mp4
β β βββ livingroomcamera_20260203_140530.mp4
β βββ 2026-02-04/
βββ README.md # This file
-
Check IP address: Verify camera is reachable
ping 192.168.1.168
-
Test RTSP stream: Use VLC or ffplay
ffplay rtsp://username:password@192.168.1.168/stream1
-
Verify credentials: Ensure username/password are correct
-
Check firewall: Ensure RTSP port (554) is not blocked
- Check network range: Verify the network range in settings matches your network
- Run with proper privileges: ARP scanning requires root/admin access
- Check ARP table:
arp -a
-
Check Python version: Must be 3.7 or higher
python3 --version
-
Verify dependencies:
pip list | grep -E "opencv|pillow|scapy"
-
Check Tkinter:
python3 -c "import tkinter"
- Check disk space: Ensure sufficient storage
- Verify write permissions: Application must have write access to recording directory
- Review logs: Check the Logs tab for error messages
- Test codec: Some systems may need different codecs:
# In code, try changing: fourcc = cv2.VideoWriter_fourcc(*'mp4v') # to: fourcc = cv2.VideoWriter_fourcc(*'H264')
- Reduce camera count: Test with fewer cameras
- Lower resolution: Use sub-stream (stream2) instead of main stream
- Increase hardware resources: More RAM/CPU may be needed
- Check network bandwidth: Ensure sufficient network capacity
Edit in Settings or modify config in code:
"video_duration": 30 * 60, # 30 minutes in secondsModify in code (default is 3 weeks):
three_weeks_ago = now - (3 * 7 * 24 * 60 * 60)For better compression, modify in code:
fourcc = cv2.VideoWriter_fourcc(*'H264') # or 'XVID', 'MJPG'If cameras span multiple subnets, modify find_ip_by_mac:
network_ranges = ["192.168.1.0/24", "192.168.2.0/24"]
for network_range in network_ranges:
# ... scan each range-
Credentials Storage: Passwords are stored in plain text in the JSON file
- Keep configuration file secure
- Consider encrypting the JSON file
- Use strong, unique passwords
-
Network Security:
- Use VLANs to isolate camera network
- Enable HTTPS on cameras if available
- Use strong RTSP passwords
-
File Permissions:
- Restrict access to recording directory
- Regular backup of recordings
- Use sub-streams instead of main streams
- Reduce FPS in camera settings
- Use hardware-accelerated encoding if available
- Consider dedicated recording hardware
- Reduce video duration segments
- Use lower resolution streams
- Disable preview updates or reduce frequency
- Record to SSD instead of HDD
Potential features for future versions:
- Motion detection and alerts
- Remote viewing via web interface
- Cloud backup integration
- Email/SMS notifications
- Encrypted credential storage
- Multiple user accounts
- Mobile app companion
- AI-based event detection
- Export to different video formats
- Playback within the application
This application is provided as-is for personal and educational use.
For issues, questions, or contributions:
- Check the Troubleshooting section above
- Review application logs in the Logs tab
- Ensure all requirements are met
- Test with a single camera first
Built with:
- Python 3.x
- OpenCV for video processing
- Tkinter for GUI
- Scapy for network operations
- PIL for image handling
Note: Always ensure you have proper authorization to record video on your property and comply with local privacy laws.