A high-performance RTMP-to-HLS streaming server written in Go, designed for low-latency live streaming with OBS Studio and other RTMP sources.
- RTMP Ingest: Accepts RTMP streams from OBS Studio, FFmpeg, and other sources
- HLS Output: Converts streams to HLS (HTTP Live Streaming) for web playback
- MPEG-TS Segments: Uses MPEG-TS format for maximum compatibility
- Low Latency: Optimized for live streaming with minimal delay
- Token Authentication: Secure stream publishing with token-based auth
- Auto-Segmentation: Automatic HLS segment creation and playlist management
- H.264 Support: Full H.264 video codec support with SPS/PPS handling
- Web Player: Built-in test player for immediate stream testing
- Go 1.21+
- FFmpeg (for segment muxing)
- OBS Studio (for testing)
git clone https://github.com/yourusername/RapidRTMP.git
cd RapidRTMP
go mod tidy
go build -o rapidrtmp .macOS (Homebrew):
brew install ffmpegUbuntu/Debian:
sudo apt update
sudo apt install ffmpegWindows: Download from FFmpeg.org
./rapidrtmpThe server will start on localhost:8080 by default.
./rapidrtmpcurl -X POST http://localhost:8080/api/v1/publish \
-H "Content-Type: application/json" \
-d '{"streamKey":"mystream"}'Response:
{
"token": "abc123...",
"streamKey": "mystream"
}- Open OBS Studio
- Go to Settings β Stream
- Set Service to "Custom"
- Set Server to:
rtmp://localhost:1935/live - Set Stream Key to:
mystream?token=abc123... - Click "Start Streaming"
Open test-player.html in your browser or visit:
http://localhost:8080/live/mystream/index.m3u8
RTMP_PORT: RTMP server port (default: 1935)HTTP_PORT: HTTP server port (default: 8080)SEGMENT_DURATION: HLS segment duration in seconds (default: 1)MAX_SEGMENTS: Maximum segments to keep (default: 10)
The server automatically handles:
- H.264 video codec with SPS/PPS extraction
- MPEG-TS segment generation
- HLS playlist management
- Token-based authentication
POST /api/v1/publish
{
"streamKey": "mystream"
}Response:
{
"token": "abc123...",
"streamKey": "mystream"
}GET /live/{streamKey}/index.m3u8
- Returns HLS playlist
GET /live/{streamKey}/segment_{n}.ts
- Returns MPEG-TS segment
GET /api/ping
- Returns server status
- Encoder: x264 (recommended)
- Rate Control: CBR or VBR
- Keyframe Interval: 1-2 seconds
- Profile: High
- Tune: zerolatency (optional)
ffmpeg -i input.mp4 -c:v libx264 -preset fast -f flv rtmp://localhost:1935/live/mystream?token=abc123...Any RTMP-compatible streaming software that supports:
- H.264 video codec
- AAC audio codec (optional)
- RTMP protocol
RTMP Source (OBS) β RTMP Server β H.264 Parser β FFmpeg Muxer β HLS Segments β Web Player
- RTMP Server: Handles incoming RTMP connections
- H.264 Parser: Extracts SPS/PPS and converts AVCC to Annex-B
- FFmpeg Muxer: Creates MPEG-TS segments from video frames
- HLS Segmenter: Manages segment lifecycle and playlist generation
- HTTP Server: Serves HLS playlists and segments
1. "Stream not found" error
- Verify the stream key and token are correct
- Check that OBS is actually streaming (not just connected)
- Ensure the server is running
2. Video plays but no audio
- Audio support is currently video-only
- Audio frames are received but not muxed into segments
- This is a known limitation
3. Time bar doesn't work
- This is normal for live streams
- Live content doesn't support seeking/scrubbing
- The time bar shows current position only
4. Buffering issues
- Check network connection
- Verify FFmpeg is installed and working
- Try reducing video quality in OBS
Enable debug logging:
RUST_LOG=debug ./rapidrtmpCheck server logs:
tail -f /tmp/rapidrtmp.log- Latency: ~2-3 seconds end-to-end
- CPU Usage: Low (thanks to FFmpeg's copy codec)
- Memory: ~50MB base + ~10MB per active stream
- Concurrent Streams: Tested up to 10 simultaneous streams
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details.
- go-rtmp - RTMP protocol implementation
- FFmpeg - Media processing
- livego - Inspiration for MPEG-TS approach
- HLS.js - Client-side HLS playback
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Happy Streaming! π¬