This commit is contained in:
za_litvu 2025-06-16 15:37:44 +07:00
parent 779960dcbe
commit 07546aab98
4 changed files with 76 additions and 0 deletions

27
Dockerfile Normal file
View File

@ -0,0 +1,27 @@
# официальный Mediamtx с FFmpeg
FROM bluenviron/mediamtx:latest-ffmpeg
# Установка зависимостей для мониторинга
RUN apk add --no-cache \
htop \
curl
# Создание директорий для конфигов и записей
RUN mkdir -p \
/etc/mediamtx \
/var/lib/mediamtx/recordings \
/var/lib/mediamtx/cache
# Открываем порты:
# - 1935 RTMP
# - 8888 HTTP/API/WebRTC
# - 8554 RTSP
# - 8889 WebRTC (UDP)
EXPOSE 1935 8888 8554 8889/udp
# Healthcheck для мониторинга
HEALTHCHECK --interval=30s --timeout=3s \
CMD curl -f http://localhost:8888/v3/paths/list || exit 1
# Команда запуска с логированием
CMD ["mediamtx"]

10
docker-compose.yml Normal file
View File

@ -0,0 +1,10 @@
services:
mediamtx:
image: bluenviron/mediamtx:latest
container_name: mediamtx
restart: unless-stopped
ports:
- "8554:8554" # RTSP
- "8888:8888" # HLS
volumes:
- ./mediamtx.yml:/mediamtx.yml:ro

23
mediamtx.yml Normal file
View File

@ -0,0 +1,23 @@
rtmp: no
webrtc: no
rtsp: yes
hlsAlwaysRemux: no
paths:
cam:
source: "rtsp_path"
rtspTransport: tcp
authInternalUsers:
- user: any
pass:
ips: []
permissions:
- action: publish
path:
- action: read
path:
- action: playback
path:

16
test.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>WebRTC Stream</title>
</head>
<body>
<h1>hls Камера</h1>
<iframe
src="http://192.168.31.56:8888/cam/"
width="640"
height="480"
frameborder="0"
allow="autoplay"
></iframe>
</body>
</html>