diff --git a/.gitignore b/.gitignore index 54f07af..0104ba6 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,7 @@ dist-ssr *.ntvs* *.njsproj *.sln -*.sw? \ No newline at end of file +*.sw? + +api/.venv/ +api/__pycache__/ diff --git a/mediamtx/docker-compose.yml b/mediamtx/docker-compose.yml new file mode 100644 index 0000000..916556b --- /dev/null +++ b/mediamtx/docker-compose.yml @@ -0,0 +1,13 @@ +services: + mediamtx: + image: bluenviron/mediamtx:1-ffmpeg + container_name: mediamtx + ports: + - 9997:9997/tcp + - 8554:8554/tcp + - 8889:8889/tcp + - 8189:8189/udp + volumes: + - ./mediamtx.yml:/mediamtx.yml + - ./recordings:/recordings + restart: unless-stopped diff --git a/mediamtx/mediamtx.yml b/mediamtx/mediamtx.yml new file mode 100644 index 0000000..853972e --- /dev/null +++ b/mediamtx/mediamtx.yml @@ -0,0 +1,87 @@ +############################################ +# GENERAL +############################################ +logLevel: info + +############################################ +# Bật tắt API +############################################ +api: true +apiAddress: :9997 + +############################################ +# RTSP +############################################ +rtsp: true +rtspAddress: :8554 +rtspTransports: [tcp] # tối ưu cho IP camera + +############################################ +# HLS +############################################ +hls: false +hlsAddress: :8888 +hlsVariant: lowLatency +hlsSegmentDuration: 1s +hlsPartDuration: 200ms + +############################################ +# WEBRTC +############################################ +webrtc: true +webrtcAddress: :8889 +webrtcLocalUDPAddress: :8189 +webrtcAdditionalHosts: + - 192.168.88.3 + +############################################ +# PLAYBACK (optional - có thể bật sau) +############################################ +playback: false + +############################################ +# PATH DEFAULTS (QUAN TRỌNG NHẤT) +############################################ +pathDefaults: + + ########################################## + # SOURCE + ########################################## + sourceOnDemand: false + + ########################################## + # RTSP SOURCE SETTINGS + ########################################## + rtspTransport: tcp + + ########################################## + # RECORDING (NEW STRUCTURE) + ########################################## + record: true + recordPath: /recordings/%path/%Y-%m-%d_%H-%M-%S-%f + recordFormat: fmp4 + recordPartDuration: 1s + recordSegmentDuration: 5m + recordDeleteAfter: 0s # 0s là không tự động xóa, đặt thời gian xóa nếu ổ cứng có giới hạn + +############################################ +# CAMERA PATHS +############################################ + +paths: + + cam1: + source: rtsp://admin:password@192.168.88.126:554/h264_stream + + cam2: + source: rtsp://admin:password@192.168.88.127:554/h264_stream + + cam3: + source: rtsp://admin:password@192.168.88.76:554/h264_stream + + cam4: + source: rtsp://admin:password@192.168.88.179:554/h264_stream + + # Nếu có cam thứ 5 thì thêm tương tự + # cam5: + # source: rtsp://...