╔╦╗┌─┐┌┬┐┬┌─┐╔╦╗═╗ ╦
║║║├┤ │││├─┤ ║ ╔╩╦╝
╩ ╩└─┘─┴┘┴┴ ┴ ╩ ╩ ╚═
High Performance Media Server - RTMP/SRT streaming with low latency.
- 🚀 Low Latency - TCP_NODELAY, optimized buffers
- 📺 RTMP Streaming - Full RTMP protocol support
- 🎯 GOP Cache - Keyframe-aware forwarding
- 🔄 Live Restream - Multiple viewers per stream
- 📊 Real-time Stats - Connection & stream monitoring
- 🏗️ Clean Architecture - Domain-driven design
cd apps/rtmp-server
make build
./rtmp-server# Using FFmpeg
ffmpeg -re -i video.mp4 -c:v libx264 -preset ultrafast -c:a aac \
-f flv rtmp://localhost:1935/live/mystream
# Test pattern with audio
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
-f lavfi -i sine=frequency=440 \
-c:v libx264 -preset ultrafast -c:a aac \
-f flv rtmp://localhost:1935/live/test# FFplay
ffplay rtmp://localhost:1935/live/mystream
# VLC
vlc rtmp://localhost:1935/live/mystreammediatx/
├── main.go # Entry point
├── stream_verticle.go # Server verticle
├── config.go # Configuration
├── domain/ # Domain Layer (Entities & Business Logic)
│ ├── connection.go # RTMPConnection entity
│ ├── stream.go # RTMPStream entity
│ ├── connection_manager.go
│ └── stream_manager.go
├── handlers/ # Protocol Layer (RTMP Protocol)
│ ├── rtmp_connection_handler.go
│ ├── rtmp_command_handler.go
│ ├── media_forwarder.go # Media forwarding with GOP cache
│ ├── chunk_writer.go
│ └── rtmp_amf_parser.go
└── srt/ # SRT Protocol (Optional)
Edit config.json:
{
"tcp_server": ":1935",
"udp_server": ":1936",
"srt_server": ":5000"
}MediaTX is optimized for low latency:
| Setting | Value | Description |
|---|---|---|
| TCP_NODELAY | Enabled | Disable Nagle's algorithm |
| Write Buffer | 512 bytes | Small buffer for quick flush |
| GOP Cache | Enabled | Keyframe-aware forwarding |
| Flush | Immediate | Flush after each media chunk |
| Protocol | Port | Status |
|---|---|---|
| RTMP | 1935 | ✅ Full Support |
| SRT | 5000 | 🚧 In Progress |
# Run with hot reload
make dev
# Build binary
make build
# Run tests
make testIf you find MediaTX useful, please consider giving it a star! ⭐
Contributions are welcome! See CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
MediaTX - Built with ❤️ in Go