An AI-powered surveillance analysis platform that transforms long CCTV footage into a structured, searchable timeline of events. Instead of manually reviewing hours of video, investigators receive AI-generated insights, summaries, and event detection in minutes.
Built using OpenCV, Gemini Vision API, FastAPI, and Streamlit.
Modern cities generate massive amounts of CCTV footage every day.
Investigators and security teams often face challenges such as:
- β± Manually watching 6β10 hours of footage
- π Difficulty identifying critical moments in long recordings
- π Trouble determining accident causes
- π΅οΈ Slow investigation due to lack of structured evidence
- π No easy way to search events inside videos
For example:
After a road accident, police may need to review 8+ hours of CCTV footage just to find the exact moment and cause.
This process is time-consuming, inefficient, and prone to human error.
The AI CCTV Intelligence System automatically analyzes CCTV footage and converts it into a timeline of meaningful events using AI.
Instead of watching hours of footage, users can:
- View a timeline of detected events
- Search events using natural language
- Quickly understand what happened and when
It acts like an AI investigator for surveillance footage.
This system can significantly assist law enforcement, security teams, and investigators.
- Detect vehicles, people, and unusual movements
- Identify the exact moment an accident occurred
- Provide visual evidence timeline
- Detect suspicious activity
- Track movement patterns
- Quickly find important moments
Instead of watching 8 hours of video, investigators can review:
AI Generated Timeline
---------------------
08:12 AM β White car enters parking area
08:14 AM β Two individuals exit vehicle
08:16 AM β Suspicious movement near gate
08:18 AM β Motorcycle collision detected
This reduces investigation time from hours β minutes.
Upload CCTV footage in formats such as:
.mp4.mov.avi
Using OpenCV, the system extracts frames efficiently for analysis.
Powered by Gemini 2.5 Flash Vision, the system detects:
- π€ People
- π Vehicles
- π¦ Objects
- β Suspicious movements
- π¨ Possible incidents
AI merges detections and creates a clean chronological event timeline.
Example output:
[
{
"time": "00:02:13",
"event": "Person enters parking lot"
},
{
"time": "00:04:55",
"event": "Two vehicles collide"
}
]Users can search events like:
"Show when the accident happened"
"Find when a car entered"
"Suspicious activity near the gate"
The system instantly finds relevant moments.
A Streamlit UI dashboard allows users to:
- Upload videos
- Track processing progress
- View summaries
- Filter events
- Search the timeline
CCTV Video
β
βΌ
Frame Extraction (OpenCV)
β
βΌ
AI Vision Analysis (Gemini)
β
βΌ
Event Detection
β
βΌ
Timeline Builder
β
βΌ
Search Engine + Dashboard
| Technology | Purpose |
|---|---|
| Python | Core development |
| OpenCV | Frame extraction |
| Gemini Vision API | AI video analysis |
| FastAPI | Backend API |
| Streamlit | Interactive frontend |
| JSON Timeline Engine | Event structuring |
AI_CCTV_Intelligence_System/
β
βββ backend/
β βββ api/
β β βββ api_server.py
β β
β βββ ai_analysis/
β β βββ gemini_analyzer.py
β β
β βββ search_engine/
β β βββ search_engine.py
β β
β βββ timeline_engine/
β β βββ timeline_builder.py
β β
β βββ video_processing/
β βββ frame_extractor.py
β βββ video_loader.py
β
βββ frontend/
β βββ frontend_app.py
β
βββ data/
β βββ processed/
β βββ uploads/
β
βββ .env.example
βββ requirements.txt
βββ README.md
Make sure you have:
Python 3.9+
pip
virtualenv (recommended)
pip install -r requirements.txtCreate a .env file in the root directory.
GEMINI_API_KEY=your_actual_api_key_here
uvicorn backend.api.api_server:app --reloadServer will run at:
http://localhost:8000
Open another terminal:
streamlit run frontend/frontend_app.pyStreamlit will open at:
http://localhost:8501
1οΈβ£ Open the Streamlit Dashboard
2οΈβ£ Upload a CCTV video
3οΈβ£ Click Upload and Analyze
4οΈβ£ Wait for AI processing
5οΈβ£ View:
- π Video summary
- π Event timeline
- π Search results
This system can be used in:
- π Police investigation
- π Smart city surveillance
- π’ Corporate security monitoring
- π¦ Traffic accident analysis
- π Crime detection
Possible next upgrades:
- Real-time CCTV monitoring
- Vehicle number plate recognition
- Face recognition integration
- Multi-camera tracking
- Crime detection alerts
- AI-generated incident reports
Security teams shouldnβt waste hours watching silent video footage.
This project aims to transform CCTV systems from passive recorders into intelligent investigative tools.
Give it a β on GitHub and help make AI-powered surveillance analysis smarter.