{"id":13616353,"url":"https://github.com/apivideo/browserLiveStream","last_synced_at":"2025-04-14T00:32:08.113Z","repository":{"id":37375512,"uuid":"250512911","full_name":"apivideo/browserLiveStream","owner":"apivideo","description":"Use webcam, browser and Node to stream live video. From api.video (https://api.video)","archived":false,"fork":false,"pushed_at":"2023-03-06T09:24:35.000Z","size":786,"stargazers_count":196,"open_issues_count":19,"forks_count":48,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-11-06T13:47:07.676Z","etag":null,"topics":["hls","nodejs","rtmp","streaming","video","video-streaming"],"latest_commit_sha":null,"homepage":"http://livestream.a.video/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apivideo.png","metadata":{"files":{"readme":"README 2.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-27T11:08:47.000Z","updated_at":"2024-09-30T05:48:16.000Z","dependencies_parsed_at":"2024-11-06T13:45:49.617Z","dependency_job_id":null,"html_url":"https://github.com/apivideo/browserLiveStream","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apivideo%2FbrowserLiveStream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apivideo%2FbrowserLiveStream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apivideo%2FbrowserLiveStream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apivideo%2FbrowserLiveStream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apivideo","download_url":"https://codeload.github.com/apivideo/browserLiveStream/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223611942,"owners_count":17173540,"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":["hls","nodejs","rtmp","streaming","video","video-streaming"],"created_at":"2024-08-01T20:01:27.389Z","updated_at":"2024-11-08T00:31:22.898Z","avatar_url":"https://github.com/apivideo.png","language":"JavaScript","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"![image](https://i.imgur.com/1cNMpvg.png)\n\n# HTML5 to RTMP streaming gateway proxy\n\nThis project intends to allow an endpoint user to submit RTMP live video streaming directly using web browser and `getUserMedia`, without installing additional software. Currently, only Firefox with `MediaRecorder` API is supported.\n\n## Usage\n\nStart the server by `npm install` and `node server.js`, then open firefox to http://127.0.0.1:8888/ . The rtmp stream will be submitted to rtmp://127.0.0.1/live by default.\n\nPlease make sure there's an rtmp server up and running; try `nginx-rtmp-module` if you don't have one.\n\nIn production, the server should limit what the client can choose to push stream to.\n\n## How does it work\n\nFrom `getUserMedia`, `MediaRecorder`, via `socket.io` to `nodejs`, then to `ffmpeg` transcoding and publishing to `rtmp`. You can guess what happened in between.\n\n\n## Limitation and To-Dos\n\nThis is still a relatively primitive project, and a lot of work still need to be done.\n\n- Audio support is experimental, YMMV\n\nAudio stream might get corrupted, and we need more test on the set of FFMpeg parameters. Feel free to open an issue to discuss your experience!\n\n- No resolution adjustment on server-side yet\n\nThe server should allow resizing the output video. This can be done by adding output resizing to the list of FFMpeg flags.\n\n- Configurable server with SSL, configurable clients\n\nHack yourself. Pull request welcomed!\n\n- `socket.io` has bad efficiency doing binary websocket\n\n- Rate-limiting\n\nCurrently there's no congestion control of any kind, so this works best in LAN environment.\n\nConsider automatically adjust upstream rate via WebSocket `bufferedAmount` attribute. (Note that locally the rate can only be adjusted by video size...)\n\n##  Create openssl\n```\nopenssl genrsa -out abels-key.pem 2048\nopenssl req -new -sha256 -key  abels-key.pem -out abels-csr.pem\nopenssl x509 -req -in abels-csr.pem -signkey abels-key.pem -out abels-cert.pem\n```\nhttps://www.youtube.com/watch?v=O3iOWRugHbA\n\nand enjoy\n\n## Server\n\nYou can set up your own RTMP server easily via [Nginx-RTMP-module](https://github.com/arut/nginx-rtmp-module), or push to adobe media server / livego server.\n\n## FFMPEG options\nYou may need to tune FFMPEG's options carefully for specific application need. Here are some brief explanation to common parameters, however there are many complex options possible -- please refer to FFMPEG manual. \n\n---\n\t\tvar ops=[\n\t\t\t'-i','-', // Read from STDIN -- corresponding to we're passing raw binary video stream from socket.io to FFMPEG via STDIN pipe\n\t\t\t'-re', // Read input at native frame rate. Mainly used to simulate a grab device. (Reset output frame rate back to normal)\n\t\t\t// Note: you can also set frame rate explicitly by -r 24 or -r 30\n\t\t\t'-fflags', '+igndts', // https://ffmpeg.org/ffmpeg-formats.html\n\t\t\t'-vcodec', 'copy',\n\t\t\t'-acodec', 'copy', // Re-use the codec from browser.\n\t\t\t// Note: you can also choose to re-encode the video here, e,g,:\n\t\t\t// '-vcodec', 'libx264',\n\t\t\t// '-acodec, 'libvorbis', \n\t\t\t'-preset','ultrafast', // Choosing encoding compression profle. Choose 'slow' to make output stream smaller, at the cost of higher CPU utilization.\n\t\t\t// Available options: ultrafast; superfast; veryfast; faster; fast; medium – default preset; slow; slower; veryslow;\n\t\t\t'-crf' ,'22', // Choosing encoding quality (higher bitrate or lower bitrate)\n\t\t\t// You can also use QP value to adjust output stream quality, e.g.: \n\t\t\t// '-qp', '0',\n\t\t\t// You can also specify output target bitrate directly, e.g.:\n\t\t\t//'-b:v','1500K',\n\t\t\t'-b:a','128K', // Audio bitrate\n\t\t\t\n\t\t\tsocket._rtmpDestination   // Send output stream to this RTMP address\n\t\t];\n---\n    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapivideo%2FbrowserLiveStream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapivideo%2FbrowserLiveStream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapivideo%2FbrowserLiveStream/lists"}