{"id":13908032,"url":"https://github.com/nintha/river","last_synced_at":"2025-07-18T06:32:20.576Z","repository":{"id":44350773,"uuid":"310737052","full_name":"nintha/river","owner":"nintha","description":"Pure Rust Implementation of RTMP Live Streaming Server","archived":false,"fork":false,"pushed_at":"2021-05-29T03:36:45.000Z","size":279,"stargazers_count":126,"open_issues_count":1,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-07T23:55:33.925Z","etag":null,"topics":["flv","live-stream","livestreaming","pure-rust","river","rtmp","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nintha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-07T00:42:51.000Z","updated_at":"2024-08-07T16:04:20.000Z","dependencies_parsed_at":"2022-08-31T21:01:15.014Z","dependency_job_id":null,"html_url":"https://github.com/nintha/river","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nintha%2Friver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nintha%2Friver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nintha%2Friver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nintha%2Friver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nintha","download_url":"https://codeload.github.com/nintha/river/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226361635,"owners_count":17612933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flv","live-stream","livestreaming","pure-rust","river","rtmp","rust"],"created_at":"2024-08-06T23:02:25.490Z","updated_at":"2024-11-25T16:31:21.084Z","avatar_url":"https://github.com/nintha.png","language":"Rust","funding_links":[],"categories":["HarmonyOS","Rust"],"sub_categories":["Windows Manager"],"readme":"# River\r\nPure Rust Implementation of RTMP Live Stream Server\r\n\r\n## Usage\r\n```\r\nUSAGE:\r\n    river.exe [OPTIONS]\r\n\r\nFLAGS:\r\n    -h, --help       Prints help information\r\n    -V, --version    Prints version information\r\n\r\nOPTIONS:\r\n        --http-flv-port \u003chttp-flv-port\u003e          disabled if port is 0 [default: 0]\r\n        --http-player-port \u003chttp-player-port\u003e    disabled if port is 0 [default: 0]\r\n        --rtmp-port \u003crtmp-port\u003e                  [default: 1935]\r\n        --ws-fmp4-port \u003cws-fmp4-port\u003e            disabled if port is 0 [default: 0]\r\n        --ws-h264-port \u003cws-h264-port\u003e            disabled if port is 0 [default: 0]\r\n```\r\n## Push\r\n\r\nOBS, x264, tune=zerolatency, CBR, preset=veryfast, profile=baseline\r\n\r\n## Play\r\n\r\n### ffplay\r\n```shell\r\nffplay -fflags nobuffer -analyzeduration 100000 rtmp://localhost:11935/channel/token\r\n```\r\n `-fflags nobuffer -analyzeduration 100000` could reduce the latency. On my computer, the latency is about 1 second.\r\n\r\n### JMuxer\r\nPlaying in the browser with [Jmuxer](https://github.com/samirkumardas/jmuxer).\r\n\r\nIf pushing stream with x264 codec, recommended profile is baseline \r\n\r\nIf 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.\r\n\r\n**Example:**\r\n\r\n1. Run `River`\r\n```shell\r\ncargo run -- --http-player-port=8080 --ws-h264-port=18000\r\n```\r\n\r\n2. Push with OBS, x264, tune=zerolatency, CBR, preset=veryfast, profile=baseline\r\n   \r\n3. Open your browser http://localhost:8080\r\n\r\n## Completed\r\n- [x] support custom width and height\r\n- [x] support audio\r\n- [x] support HTTP-FLV output\r\n- [x] support raw H264 stream output\r\n- [x] deal with the problem of websocket message backlog\r\n- [x] configurable startup parameters (monitoring server port)\r\n- [x] optional output formats based on the startup parameters\r\n- [x] web video player with `JMuxer` (ws-h264-port required)\r\n\r\n## TODO\r\n- [ ] PUSH/PULL authentication\r\n- [ ] support fragmented MP4 output\r\n\r\n## FAQ\r\n\r\n### The Chrome auto pauses muted video in inactive tabs.\r\n\r\n- Listen to the event `visibilitychange`, and change Video playback progress manually\r\n\r\n```js\r\nvar video = document.getElementById('video');\r\ndocument.addEventListener(\"visibilitychange\", function() {\r\n  video.currentTime = video.buffered.end(0);\r\n});\r\n```\r\n- Timed changing Video playback progress manually\r\n```js\r\nvar video = document.getElementById('video');\r\nsetInterval(()=\u003e{\r\n  var latest = video.buffered.end(0);\r\n  // over 200ms\r\n  if (latest - video.currentTime \u003e 0.2){\r\n    video.currentTime = latest;\r\n  }\r\n}, 1000);\r\n```\r\n\r\n## Reference\r\n- [RTMP推送AAC ADTS音频流](https://www.jianshu.com/p/1a6f195863c7)\r\n- [视音频数据处理入门](https://blog.csdn.net/leixiaohua1020/article/details/50534369)\r\n- [rtmp数据封装](https://blog.csdn.net/Jacob_job/article/details/81880445)\r\n- [视音频编解码学习工程：FLV封装格式分析器](https://blog.csdn.net/leixiaohua1020/article/details/17934487)\r\n\r\nThanks to [Jetbrains](https://www.jetbrains.com/?from=River) for their great IDEs and the free [open source license](https://jb.gg/OpenSource).\r\n\r\n![](doc/jetbrains.webp)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnintha%2Friver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnintha%2Friver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnintha%2Friver/lists"}