Sistema completo para monitoreo y gestion de flotas de vehiculos con: - Backend FastAPI con PostgreSQL/TimescaleDB - Frontend React con TypeScript y TailwindCSS - App movil React Native con Expo - Soporte para dispositivos GPS, Meshtastic y celulares - Video streaming en vivo con MediaMTX - Geocercas, alertas, viajes y reportes - Autenticacion JWT y WebSockets en tiempo real Documentacion completa y guias de usuario incluidas.
238 lines
5.9 KiB
YAML
238 lines
5.9 KiB
YAML
# ============================================
|
|
# MediaMTX - Configuracion para Sistema de Flotillas
|
|
# ============================================
|
|
# Documentacion: https://github.com/bluenviron/mediamtx
|
|
#
|
|
# MediaMTX es un servidor de streaming multimedia que soporta:
|
|
# - RTSP (recibir streams de camaras IP)
|
|
# - WebRTC (streaming en navegadores)
|
|
# - HLS (streaming adaptativo)
|
|
# - RTMP (compatibilidad con OBS, etc.)
|
|
# ============================================
|
|
|
|
# ========================================
|
|
# Configuracion General
|
|
# ========================================
|
|
|
|
# Nivel de log: debug, info, warn, error
|
|
logLevel: info
|
|
|
|
# Destino de logs
|
|
logDestinations: [stdout]
|
|
|
|
# Archivo de log (si se habilita file en logDestinations)
|
|
# logFile: /var/log/mediamtx/mediamtx.log
|
|
|
|
# Timeout de lectura/escritura
|
|
readTimeout: 10s
|
|
writeTimeout: 10s
|
|
|
|
# Timeout de lectura para UDP
|
|
readBufferCount: 512
|
|
|
|
# ========================================
|
|
# API REST
|
|
# ========================================
|
|
|
|
api: yes
|
|
apiAddress: 127.0.0.1:9997
|
|
|
|
# Metricas para Prometheus
|
|
metrics: yes
|
|
metricsAddress: 127.0.0.1:9998
|
|
|
|
# ========================================
|
|
# RTSP Server
|
|
# ========================================
|
|
# Recibe streams de camaras IP
|
|
|
|
rtsp: yes
|
|
protocols: [udp, multicast, tcp]
|
|
|
|
# Puertos RTSP
|
|
rtspAddress: :8554
|
|
|
|
# Rango de puertos UDP para RTP
|
|
rtpAddress: :8000
|
|
rtcpAddress: :8001
|
|
|
|
# Multicast (opcional)
|
|
multicastIPRange: 224.1.0.0/16
|
|
multicastRTPPort: 8002
|
|
multicastRTCPPort: 8003
|
|
|
|
# ========================================
|
|
# RTMP Server
|
|
# ========================================
|
|
# Compatibilidad con OBS, FFmpeg, etc.
|
|
|
|
rtmp: yes
|
|
rtmpAddress: :1935
|
|
|
|
# Encriptacion RTMPS (requiere certificados)
|
|
rtmpEncryption: "no"
|
|
# rtmpServerKey: server.key
|
|
# rtmpServerCert: server.crt
|
|
|
|
# ========================================
|
|
# HLS Server
|
|
# ========================================
|
|
# Streaming adaptativo para navegadores antiguos
|
|
|
|
hls: yes
|
|
hlsAddress: :8888
|
|
|
|
# Permitir origen cruzado (CORS)
|
|
hlsAlwaysRemux: no
|
|
hlsVariant: lowLatency
|
|
hlsSegmentCount: 7
|
|
hlsSegmentDuration: 1s
|
|
hlsPartDuration: 200ms
|
|
hlsSegmentMaxSize: 50M
|
|
hlsAllowOrigin: '*'
|
|
|
|
# Directorio para segmentos HLS
|
|
hlsDirectory: ''
|
|
|
|
# ========================================
|
|
# WebRTC Server
|
|
# ========================================
|
|
# Streaming de baja latencia en navegadores modernos
|
|
|
|
webrtc: yes
|
|
webrtcAddress: :8889
|
|
|
|
# CORS para WebRTC
|
|
webrtcAllowOrigin: '*'
|
|
|
|
# Configuracion ICE (NAT traversal)
|
|
webrtcICEServers2: []
|
|
# Usar servidores STUN/TURN si hay NAT
|
|
# webrtcICEServers2:
|
|
# - urls: [stun:stun.l.google.com:19302]
|
|
|
|
# Puertos ICE UDP
|
|
webrtcICEUDPMuxAddress: :8189
|
|
webrtcICETCPMuxAddress: :8189
|
|
|
|
# ========================================
|
|
# SRT Server (Secure Reliable Transport)
|
|
# ========================================
|
|
|
|
srt: no
|
|
srtAddress: :8890
|
|
|
|
# ========================================
|
|
# Grabacion
|
|
# ========================================
|
|
# Guardar streams a disco
|
|
|
|
record: no
|
|
recordPath: ./recordings/%path/%Y-%m-%d_%H-%M-%S-%f
|
|
recordFormat: fmp4
|
|
recordPartDuration: 100ms
|
|
recordSegmentDuration: 1h
|
|
recordDeleteAfter: 24h
|
|
|
|
# ========================================
|
|
# Autenticacion
|
|
# ========================================
|
|
# Proteger acceso a streams
|
|
|
|
# Metodos de autenticacion: internal, http, jwt
|
|
authMethod: internal
|
|
|
|
# Usuarios internos (basico)
|
|
authInternalUsers:
|
|
# Usuario admin - acceso total
|
|
- user: admin
|
|
pass: CHANGE_ME_ADMIN_PASSWORD
|
|
permissions:
|
|
- action: publish
|
|
path: ''
|
|
- action: read
|
|
path: ''
|
|
- action: playback
|
|
path: ''
|
|
- action: api
|
|
|
|
# Usuario para publicar (camaras)
|
|
# Las camaras usan este usuario para enviar stream
|
|
- user: camera
|
|
pass: CHANGE_ME_CAMERA_PASSWORD
|
|
permissions:
|
|
- action: publish
|
|
path: ''
|
|
|
|
# Usuario para ver (clientes)
|
|
- user: viewer
|
|
pass: CHANGE_ME_VIEWER_PASSWORD
|
|
permissions:
|
|
- action: read
|
|
path: ''
|
|
- action: playback
|
|
path: ''
|
|
|
|
# Usuario anonimo (solo lectura, opcional)
|
|
# - user: ''
|
|
# pass: ''
|
|
# permissions:
|
|
# - action: read
|
|
# path: ''
|
|
|
|
# ========================================
|
|
# Paths (Streams)
|
|
# ========================================
|
|
# Configuracion de paths/streams individuales
|
|
|
|
paths:
|
|
# Path por defecto - permite cualquier stream
|
|
all_others:
|
|
|
|
# Stream de ejemplo - camara fija
|
|
# camara1:
|
|
# source: rtsp://192.168.1.100:554/stream1
|
|
# sourceOnDemand: yes
|
|
# sourceOnDemandStartTimeout: 10s
|
|
# sourceOnDemandCloseAfter: 10s
|
|
|
|
# Stream desde FFmpeg (si necesitas transcodificar)
|
|
# stream_transcoded:
|
|
# runOnInit: ffmpeg -i rtsp://source -c:v libx264 -preset ultrafast -tune zerolatency -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH
|
|
# runOnInitRestart: yes
|
|
|
|
# Stream de camara vehicular (ejemplo)
|
|
# vehiculo_001:
|
|
# source: rtsp://usuario:password@192.168.1.101:554/h264
|
|
# sourceOnDemand: yes
|
|
# runOnDemand: ''
|
|
# runOnDemandRestart: no
|
|
# runOnDemandStartTimeout: 10s
|
|
# runOnDemandCloseAfter: 10s
|
|
|
|
# ============================================
|
|
# Notas de Integracion
|
|
# ============================================
|
|
#
|
|
# PUBLICAR STREAM (desde camara o FFmpeg):
|
|
# rtsp://camera:password@servidor:8554/nombre_stream
|
|
#
|
|
# VER STREAM:
|
|
# - RTSP: rtsp://viewer:password@servidor:8554/nombre_stream
|
|
# - WebRTC: http://servidor:8889/nombre_stream
|
|
# - HLS: http://servidor:8888/nombre_stream/index.m3u8
|
|
#
|
|
# API REST (ejemplos):
|
|
# - Listar streams: curl http://localhost:9997/v3/paths/list
|
|
# - Info de stream: curl http://localhost:9997/v3/paths/get/nombre_stream
|
|
# - Kick conexion: curl -X POST http://localhost:9997/v3/paths/kick/nombre_stream
|
|
#
|
|
# INTEGRACION CON FRONTEND:
|
|
# Usar libreria como hls.js o adaptador WebRTC para reproducir en navegador
|
|
#
|
|
# SEGURIDAD:
|
|
# 1. Cambiar passwords por defecto
|
|
# 2. En produccion, usar authMethod: http para validar contra tu API
|
|
# 3. Configurar CORS apropiadamente
|
|
# ============================================
|