Pure Rust Implementation of RTMP Live Streaming Server
Pure Rust Implementation of RTMP Live Stream Server
USAGE:
river.exe [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--http-flv-port <http-flv-port> disabled if port is 0 [default: 0]
--http-player-port <http-player-port> disabled if port is 0 [default: 0]
--rtmp-port <rtmp-port> [default: 1935]
--ws-fmp4-port <ws-fmp4-port> disabled if port is 0 [default: 0]
--ws-h264-port <ws-h264-port> disabled if port is 0 [default: 0]
OBS, x264, tune=zerolatency, CBR, preset=veryfast, profile=baseline
ffplay -fflags nobuffer -analyzeduration 100000 rtmp://localhost:11935/channel/token
-fflags nobuffer -analyzeduration 100000
could reduce the latency. On my computer, the latency is about 1 second.
Playing in the browser with Jmuxer.
If pushing stream with x264 codec, recommended profile is baseline
If you are using x264 encoding to push the stream, it is recommended that profile=baseline to avoid frequent video jitter. The current local test latency is about 1 second.
Example:
River
cargo run -- --http-player-port=8080 --ws-h264-port=18000
Push with OBS, x264, tune=zerolatency, CBR, preset=veryfast, profile=baseline
Open your browser http://localhost:8080
JMuxer
(ws-h264-port required)visibilitychange
, and change Video playback progress manuallyvar video = document.getElementById('video');
document.addEventListener("visibilitychange", function() {
video.currentTime = video.buffered.end(0);
});
var video = document.getElementById('video');
setInterval(()=>{
var latest = video.buffered.end(0);
// over 200ms
if (latest - video.currentTime > 0.2){
video.currentTime = latest;
}
}, 1000);
Thanks to Jetbrains for their great IDEs and the free open source license.