 MediaMtx: C++ replacement for the MediaMTX parts la_mojo uses
New project Projects/MediaMtx, in MediaMTX's module layout (internal/core, conf,
stream, staticsources/rtsp, servers/webrtc, recorder, api, ...):
- RTSP pull of the cameras with live555 (H264, TCP/UDP), reconnect after errors or
when no data arrives for --readTimeout
- WebRTC WHEP on :8889 with libdatachannel, the MediaMTX URLs
(POST /stream_N/whep, PATCH/DELETE /stream_N/whep/<id>), so the dashboard works as is
- recording as fragmented MP4 segments (no transcoding), playable in browsers,
MediaMTX file names; a fragment is flushed every --recordPartDuration
- no mediamtx.yml: command line options + a paths file (SIGHUP reload) + the
v3 paths API (add / patch / replace / delete, written back to the file)
- log lines in the MediaMTX format that kernelHelperMediaMTX parses
Tested with a GStreamer RTSP camera and Chromium (WHEP, recordings), camera
loss / reconnect, API, SIGHUP; ASan + UBSan clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
1 day ago  MediaMtx: C++ replacement for the MediaMTX parts la_mojo uses
New project Projects/MediaMtx, in MediaMTX's module layout (internal/core, conf,
stream, staticsources/rtsp, servers/webrtc, recorder, api, ...):
- RTSP pull of the cameras with live555 (H264, TCP/UDP), reconnect after errors or
when no data arrives for --readTimeout
- WebRTC WHEP on :8889 with libdatachannel, the MediaMTX URLs
(POST /stream_N/whep, PATCH/DELETE /stream_N/whep/<id>), so the dashboard works as is
- recording as fragmented MP4 segments (no transcoding), playable in browsers,
MediaMTX file names; a fragment is flushed every --recordPartDuration
- no mediamtx.yml: command line options + a paths file (SIGHUP reload) + the
v3 paths API (add / patch / replace / delete, written back to the file)
- log lines in the MediaMTX format that kernelHelperMediaMTX parses
Tested with a GStreamer RTSP camera and Chromium (WHEP, recordings), camera
loss / reconnect, API, SIGHUP; ASan + UBSan clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
1 day ago  MediaMtx: C++ replacement for the MediaMTX parts la_mojo uses
New project Projects/MediaMtx, in MediaMTX's module layout (internal/core, conf,
stream, staticsources/rtsp, servers/webrtc, recorder, api, ...):
- RTSP pull of the cameras with live555 (H264, TCP/UDP), reconnect after errors or
when no data arrives for --readTimeout
- WebRTC WHEP on :8889 with libdatachannel, the MediaMTX URLs
(POST /stream_N/whep, PATCH/DELETE /stream_N/whep/<id>), so the dashboard works as is
- recording as fragmented MP4 segments (no transcoding), playable in browsers,
MediaMTX file names; a fragment is flushed every --recordPartDuration
- no mediamtx.yml: command line options + a paths file (SIGHUP reload) + the
v3 paths API (add / patch / replace / delete, written back to the file)
- log lines in the MediaMTX format that kernelHelperMediaMTX parses
Tested with a GStreamer RTSP camera and Chromium (WHEP, recordings), camera
loss / reconnect, API, SIGHUP; ASan + UBSan clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
1 day ago  MediaMtx: C++ replacement for the MediaMTX parts la_mojo uses
New project Projects/MediaMtx, in MediaMTX's module layout (internal/core, conf,
stream, staticsources/rtsp, servers/webrtc, recorder, api, ...):
- RTSP pull of the cameras with live555 (H264, TCP/UDP), reconnect after errors or
when no data arrives for --readTimeout
- WebRTC WHEP on :8889 with libdatachannel, the MediaMTX URLs
(POST /stream_N/whep, PATCH/DELETE /stream_N/whep/<id>), so the dashboard works as is
- recording as fragmented MP4 segments (no transcoding), playable in browsers,
MediaMTX file names; a fragment is flushed every --recordPartDuration
- no mediamtx.yml: command line options + a paths file (SIGHUP reload) + the
v3 paths API (add / patch / replace / delete, written back to the file)
- log lines in the MediaMTX format that kernelHelperMediaMTX parses
Tested with a GStreamer RTSP camera and Chromium (WHEP, recordings), camera
loss / reconnect, API, SIGHUP; ASan + UBSan clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
1 day ago  MediaMtx: C++ replacement for the MediaMTX parts la_mojo uses
New project Projects/MediaMtx, in MediaMTX's module layout (internal/core, conf,
stream, staticsources/rtsp, servers/webrtc, recorder, api, ...):
- RTSP pull of the cameras with live555 (H264, TCP/UDP), reconnect after errors or
when no data arrives for --readTimeout
- WebRTC WHEP on :8889 with libdatachannel, the MediaMTX URLs
(POST /stream_N/whep, PATCH/DELETE /stream_N/whep/<id>), so the dashboard works as is
- recording as fragmented MP4 segments (no transcoding), playable in browsers,
MediaMTX file names; a fragment is flushed every --recordPartDuration
- no mediamtx.yml: command line options + a paths file (SIGHUP reload) + the
v3 paths API (add / patch / replace / delete, written back to the file)
- log lines in the MediaMTX format that kernelHelperMediaMTX parses
Tested with a GStreamer RTSP camera and Chromium (WHEP, recordings), camera
loss / reconnect, API, SIGHUP; ASan + UBSan clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
1 day ago |
|
# MediaMtx (C++) - make CFG=Release (default) or make CFG=Debug
#
# Needs: live555 (pkg-config live555, as for la_mojo), libdatachannel (>= 0.20, installed in /usr/local),
# OpenSSL. JSON: JsonCpp of dr_frucht (../../lib/include/json, ../../lib/data/json).
# Other locations: make LIVE555_CFLAGS=... LIVE555_LIBS=... DATACHANNEL_CFLAGS=-I... DATACHANNEL_LIBS="-L... -ldatachannel"
CFG ?= Releaseifeq ($(CFG),Debug) OUTDIR = Debug OPT = -O0 -g -DDEBUGelse OUTDIR = Release OPT = -O2endif
LIVE555_CFLAGS ?= $(shell pkg-config --cflags live555 2>/dev/null)LIVE555_LIBS ?= $(shell pkg-config --libs live555 2>/dev/null || echo -lliveMedia -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment)DATACHANNEL_CFLAGS ?=DATACHANNEL_LIBS ?= -ldatachannel
CXX ?= g++DFSL = ../..MTXLIB = $(DFSL)/lib/data/media/mtxCXXFLAGS += -std=c++17 -Wall -Wextra -Wno-unused-parameter $(OPT) $(LIVE555_CFLAGS) $(DATACHANNEL_CFLAGS) -I$(DFSL)/lib/include -I$(MTXLIB)LIBS = $(DATACHANNEL_LIBS) $(LIVE555_LIBS) -lssl -lcrypto -lpthread
TARGET = $(OUTDIR)/mediamtx
SRCS = main.cpp \
internal/conf/conf.cpp \
internal/staticsources/rtsp/rtspSource.cpp \
internal/core/path.cpp \
internal/core/pathManager.cpp \
internal/core/core.cpp \
internal/api/api.cpp
# Shared with la_mojo (kernelModuleEmbedVideo): lib/data/media/mtx
LIB_SRCS = $(MTXLIB)/logger/logger.cpp \
$(MTXLIB)/conf/serverConf.cpp \
$(MTXLIB)/codecs/h264/h264.cpp \
$(MTXLIB)/stream/stream.cpp \
$(MTXLIB)/protocols/httpp/httpServer.cpp \
$(MTXLIB)/core/mediaPath.cpp \
$(MTXLIB)/recorder/fmp4Writer.cpp \
$(MTXLIB)/recorder/recorder.cpp \
$(MTXLIB)/servers/webrtc/session.cpp \
$(MTXLIB)/servers/webrtc/webrtcServer.cpp
# JsonCpp from dr_frucht
JSON_SRCS = $(DFSL)/lib/data/json/json_reader.cpp \
$(DFSL)/lib/data/json/json_value.cpp \
$(DFSL)/lib/data/json/json_writer.cpp
OBJS = $(patsubst %.cpp,$(OUTDIR)/obj/%.o,$(SRCS)) $(patsubst $(MTXLIB)/%.cpp,$(OUTDIR)/obj/mtxlib/%.o,$(LIB_SRCS)) $(patsubst $(DFSL)/lib/data/json/%.cpp,$(OUTDIR)/obj/jsoncpp/%.o,$(JSON_SRCS))DEPS = $(OBJS:.o=.d)
all: $(TARGET)
$(TARGET): $(OBJS) $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
$(OUTDIR)/obj/%.o: %.cpp @mkdir -p $(dir $@) $(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
$(OUTDIR)/obj/mtxlib/%.o: $(MTXLIB)/%.cpp @mkdir -p $(dir $@) $(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
$(OUTDIR)/obj/jsoncpp/%.o: $(DFSL)/lib/data/json/%.cpp @mkdir -p $(dir $@) $(CXX) $(CXXFLAGS) -w -MMD -MP -c $< -o $@
clean: rm -rf $(OUTDIR)
-include $(DEPS)
.PHONY: all clean
|