Dokumentasi Teknis

Rancangan Teknis End-to-End

Sistem CCTV + OCR/QR Auto-Recording yang realistis dan scalable untuk 50 meja packaging dengan integrasi lengkap dari hardware hingga aplikasi admin.

Real-time Processing
OCR/QR Detection
Scalable Architecture
CCTV
OCR
Server

1️⃣ Gambaran Arsitektur Besar

CCTV System Overview

Alur Kerja Utama

CCTV Stream RTSP

Stream video real-time dari setiap meja packaging

Service OCR/QR Detector

Deteksi otomatis QR code dan nomor resi

Trigger Event

Pemicu otomatis saat QR/Resi terdeteksi

Auto Record 30 Detik

Perekaman otomatis selama 30 detik

Compress & Rename

Kompresi dan penamaan file sesuai nomor resi

Upload ke Storage

Upload file video ke server penyimpanan

Admin Panel Access

Akses melalui panel admin untuk pencarian dan playback

2️⃣ Komponen yang Harus Dipersiapkan

A. Hardware (Meja Packaging)

Wajib:
  • IP Camera RTSP (bukan USB)
  • • Resolusi min 1080p
  • • 25–30 FPS
  • • Support RTSP stream
  • Lighting konsisten (lampu putih, anti bayangan)
  • Posisi kamera top-down / angled fokus ke resi
Rekomendasi Kamera:
  • Hikvision / Dahua / Uniview
  • ONVIF + RTSP support
Catatan penting:
OCR & QR lebih ditentukan oleh pencahayaan & sudut kamera daripada merek kamera.

B. Network & Infrastruktur

  • LAN Gigabit (50 CCTV = traffic besar)
  • Switch PoE untuk CCTV
  • VLAN khusus CCTV (opsional tapi ideal)
  • Static IP per kamera

3️⃣ Integrasi CCTV (Bagian Paling Krusial)

🔹 Cara Akses CCTV

Semua CCTV diakses via RTSP URL, contoh:

rtsp://user:password@192.168.1.20:554/Streaming/Channels/101

🔹 Mekanisme Kerja (Detail Teknis)

1. Stream Reader

Gunakan:

  • FFmpeg
  • atau GStreamer
  • atau OpenCV VideoCapture (RTSP)
Best practice:
Gunakan FFmpeg untuk stabilitas multi-camera.
2. OCR & QR Detection (Real-time)
Kebutuhan Teknologi
QR Code OpenCV + ZBar
OCR Resi Tesseract OCR
Akurasi tinggi YOLOv8 + PaddleOCR
Edge AI NVIDIA Jetson (opsional)
Workflow:
  • Capture frame setiap 0.5–1 detik
  • Crop area resi (ROI)
  • Jalankan QR detector
  • Jika QR terbaca → trigger event
3. Auto Record 30 Detik

Saat QR terdeteksi:

ffmpeg -rtsp_transport tcp -i rtsp://cam \
-t 30 \
-vcodec libx264 -preset fast -crf 26 \
-acodec aac \
resi123456.mp4
Penjelasan:
  • -t 30 → record 30 detik
  • -crf 24–28 → kompresi (good quality)
  • Output size ± 5–15 MB / video
4. Penamaan File
{no_resi}_{timestamp}.mp4

Contoh:

JNE123456789_2025-12-13_14-05-22.mp4

4️⃣ Backend & Server

A. Bahasa & Framework (Rekomendasi)

Core Processing (CCTV & OCR)
  • Python
    • OpenCV
    • PaddleOCR / Tesseract
    • FFmpeg
  • Async (multiprocessing / asyncio)
Backend API
  • Laravel (cocok dengan ekosistem)
  • atau Node.js (NestJS)
Kenapa dipisah?
  • OCR & video = CPU/GPU heavy
  • API & admin panel = I/O heavy

B. Arsitektur Microservice (Ideal)

[ CCTV ]
   ↓ RTSP
[ OCR Service (Python) ]
   ↓ Event
[ Video Recorder Service ]
   ↓
[ Object Storage ]
   ↓
[ Backend API ]
   ↓
[ Admin Web ]

5️⃣ Database Design (Sederhana tapi Efektif)

Tabel packages

Field Tipe
idbigint
resivarchar (indexed)
camera_idint
recorded_atdatetime
video_pathtext
file_size_mbdecimal
statusenum
created_attimestamp

Tabel cameras

Field Tipe
idint
namevarchar
rtsp_urltext
meja_noint
activeboolean

6️⃣ Storage Video (Sangat Penting)

Opsi Penyimpanan

Skala Solusi
Kecil Local HDD + RAID
Menengah MinIO (S3 compatible)
Besar AWS S3 / GCP
Rekomendasi:
MinIO di server lokal (murah + scalable)

7️⃣ Aplikasi Admin (Fitur Wajib)

Role Admin

  • Search resi
  • List hasil
  • Play video (HTML5 video)
  • Info:
    • Kamera
    • Waktu
    • Durasi
    • File size

Tech Stack

  • Laravel + Blade / React
  • Video streaming via signed URL
  • Pagination & indexing (resi)

8️⃣ Server Specification (Estimasi 50 CCTV)

Minimum (Tanpa GPU)

  • CPU: 16 Core
  • RAM: 32–64 GB
  • Storage:
    • Video: ≥10 TB
  • Network: Gigabit

Ideal (Dengan AI)

  • GPU: NVIDIA T4 / RTX 3060
  • OCR & detection jauh lebih cepat
Rule kasar:
1 CPU core ≈ 2–3 CCTV stream OCR ringan

9️⃣ Tantangan & Mitigasi

Solusi untuk Masalah Umum

Masalah Solusi
OCR salah baca ROI + lighting
Beban server Queue & async
Duplicate scan Cache resi (TTL)
Storage penuh Auto delete > X hari
CCTV down Health check

🔟 Ringkasan Singkat

Yang HARUS disiapkan:

  • IP Camera RTSP (50 unit)
  • Server kuat (CPU/GPU)
  • Python OCR + FFmpeg
  • Laravel Admin Panel
  • Object Storage (MinIO)
  • Network stabil & lighting bagus