Implemented in PHP
Built on the Workerman event loop. The RTMP handshake, FLV tag parsing and fMP4 muxing are written in PHP, with no FFmpeg transcode process or C++ extension.
PHP 8.2+ · Workerman · MIT
RTMP / HTTP-FLV ingest, RTMP / HTTP-FLV / WS-FLV playback, fMP4 recording with millisecond-precise replay, plus a bilingual admin console. No FFmpeg transcode process or Node runtime required.
$ composer install
$ php start.php start
rtmp server tcp://0.0.0.0:1935 start
http server 127.0.0.1:18080 start
$ ffmpeg -re -i demo.mp4 -c:v libx264 \
-c:a aac -f flv rtmp://127.0.0.1/live/stream
▸ stream attached — open /admin/ to watch
Media path
One stream can be pulled by several protocols at once, recorded while it is being pushed, and reviewed later for any time range.
rtmp://host:1935/app/stream
POST /app/stream
RTMP push, or POST raw FLV data
FLV parsing · GOP cache · frame distribution · muxing
RTMP
HTTP-FLV
WS-FLV
fMP4 segments
SQLite index
Scope
Covers ingest, delivery, fMP4 recording, time-range replay, the admin console and automated tests.
Built on the Workerman event loop. The RTMP handshake, FLV tag parsing and fMP4 muxing are written in PHP, with no FFmpeg transcode process or C++ extension.
The same stream is served over RTMP, HTTP-FLV and WS-FLV, with disableAudio / disableVideo / disableGop query filters.
Handles both Enhanced RTMP (codecId=0 + hvc1) and legacy codecId=12 HEVC framing, with AAC audio.
Fragments and segments are cut on keyframe boundaries. Every .mp4 carries a complete moov, so it plays standalone and parses in ffprobe and browsers.
The /playback endpoint slices across segments and starts at the keyframe at or before start; mdat is streamed in chunks, so memory does not grow with clip length.
Dashboard, live bitrate, detailed stream information, recording replay and settings, with token auth and a Chinese/English switch.
Data-driven cases cover push → record → replay → decode verification. CI runs syntax checks and smoke tests on PHP 8.2 / 8.3 / 8.4.
Scripts, raw data and analysis for five load scenarios ship with the repo and can be reproduced on other machines.
Deployment
Linux / WSL runs Workerman native workers with count + reusePort. Use start.php for deployment and development.
| Process | Port | Responsibility |
|---|---|---|
| control | 18090 | Stream registry, events and stats aggregation |
| ingest | 1935 / 18081 | RTMP and HTTP-FLV ingest |
| play | 1936 / 18080 | RTMP, HTTP-FLV and WS-FLV playback |
| admin | 18099 | Admin console, management API and replay |
| record | — | Independent fMP4 recording |
php start.php startAlso supports stop / restart / status. Scaling uses worker count + reusePort.
curl -N http://127.0.0.1:18080/live/stream.flvHTTP-FLV and RTMP ingest/playback share the same start.php entry point.
PHP 8.2+, ext-json, ext-shmop, workerman/workerman ^5.2, evenement/evenement ^3.0, apix/log ^1.2. ffmpeg / ffprobe are needed for push and E2E tests. The console has no Node build step.
Configure ServerConfig in start.php, or override it with MP_INGEST_COUNT, MP_PLAY_COUNT, MP_*_PORT, MP_REGISTRY_*, MP_SHM_* and MP_MEMORY_LIMIT environment variables.
Live bitrate and detailed stream information are now visible in the console. Stream details are cleaned up on close, play counts are per path, and live preview always uses the play port.
getSettings and listRecordFiles are handled locally by admin; Worker::runAll is wired into the process entry; admin serves static files only, while play serves FLV only.
http://127.0.0.1:18099/admin/. Live preview is fetched from http://127.0.0.1:18080.Console
A plain-JS single page app with no build step, served by the admin process.
Benchmarks
Test setup: AMD Ryzen 9 9900X · Linux / WSL · PHP 8.4 · 1080p30 @ 4096 kb/s · ffmpeg -c copy
play=8, 21–22% CPU per process, 25.69 Gbps, 100% held
ingest=8, grouped shared memory, 60.9% average CPU, 26.99 Gbps, 0 errors
6400 push streams, zero drops and zero errors
6000 pull streams, 100% held
| Direction | Workers | Streams | CPU | Throughput | Result |
|---|---|---|---|---|---|
| Push | ingest=8 | 6400 | 60.9% | 26.99 Gbps | 0 drops / 0 errors |
| Pull | play=8 | 6000 | 21–22% / process | 25.69 Gbps | 100% held |
Quick start
Requires PHP 8.2+ and Composer. ffmpeg is only needed for pushing and for the E2E suite.
composer install
php start.php start
RTMP ingest listens on 1935, playback on 18080, admin console on 18099.
ffmpeg -re -i file.mp4 -c:v libx264 -c:a aac -f flv \
rtmp://127.0.0.1/live/stream
http://127.0.0.1:18080/live/stream.flvws://127.0.0.1:18080/live/stream.flvrtmp://127.0.0.1/live/streamhttp://127.0.0.1:18099/admin/Limitations
Matches the known-limitations section of the README — worth checking before choosing it.
See the full list of limitations