{"id":20744788,"url":"https://github.com/gaowanlu/openlive","last_synced_at":"2025-04-24T05:47:56.655Z","repository":{"id":160749023,"uuid":"627398239","full_name":"gaowanlu/openlive","owner":"gaowanlu","description":"remote display of live camera images in the web browser","archived":false,"fork":false,"pushed_at":"2025-03-29T21:20:11.000Z","size":987,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T05:47:47.596Z","etag":null,"topics":["cameralive","h264-streamer","live","livestream","opencv"],"latest_commit_sha":null,"homepage":"","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/gaowanlu.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-13T11:41:18.000Z","updated_at":"2025-03-29T21:16:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"49d56e75-d5c3-42cb-b92e-08d047f5c3ce","html_url":"https://github.com/gaowanlu/openlive","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/gaowanlu%2Fopenlive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaowanlu%2Fopenlive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaowanlu%2Fopenlive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaowanlu%2Fopenlive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gaowanlu","download_url":"https://codeload.github.com/gaowanlu/openlive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250573344,"owners_count":21452345,"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":["cameralive","h264-streamer","live","livestream","opencv"],"created_at":"2024-11-17T07:17:12.371Z","updated_at":"2025-04-24T05:47:56.625Z","avatar_url":"https://github.com/gaowanlu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenLive\n\nThe OpenCV camera video stream used is pushed to the browser solution based on Base64 encoding in H264 format and transmitted using websocket. Use POSIX multithreading and C/C++plugins with Node API.\n\nCan be used on Linux development boards such as Raspberry Pi and Linux system personal computers\n\n## Scheme\n\nPlayer : \u003chttps://github.com/mbebenita/Broadway\u003e\n\n```txt\n\n/**************************************************************************/\n*     C++ module             \u003c----\u003e  Node SocketIO \u003c----\u003e  Browser(Player) *\n* capture thread         \u003c----------                       /|\\              *\n*    Take Frame(Loop)      start()                          |               *\n*   |                                                       |               *\n*   | Image(get_mat())                                      |               *\n*   |                                                       |               *\n*  \\|/                                                      |               *\n* encode_thread(Loop)                                       |               *\n*   |-Convert to YUV color                      (H264Stream)|               *\n*   | space                                                 |               *\n*   |                                                       |               *\n*   |-H264 encoder encodi-                                  |               *\n*   | ng                                                    |               *\n*   |                                                       |               *\n*   |-Add H264 stream                                       |               *\n*   | data to buffer                                        |               *\n*   | queue                                                 |               *\n*      |                              (Loop)                |               *\n*      |-------------------------\u003e   io.emit()  ------------|               *\n*       getFrame getMat  callback()                                         *\n*                                                                           *\n/**************************************************************************/\n```\n\n## Environmental Preparation\n\n* [Libx264](https://www.videolan.org/developers/x264.html)\n* [OpenCV](https://github.com/opencv/opencv)\n\n```shell\nsudo apt install libx264-dev\nsudo npm install -g node-gyp\nsudo apt install libopencv-dev pkg-config\nnpm install\n```\n\n## Nodejs API\n\n* `import openlive`\n\n```js\nconst openlive = require('./build/Release/openlive');\n```\n\n* `setConf`\n\nconfiguration parameter\n\n```js\nopenlive.setConf({\n    \"path\": \"0\",\n    \"encodeBufferLen\": 5,\n    \"captureBufferLen\": 5\n});\n```\n\npath(string): The default is \"0\", opencv opens the camera's parameters, camera device number,/dev/video0. Simultaneously supports HTTP streaming, such as using MJPEG Streamer to push streams, which can be filled in ` http://ip:port `.  \nencodeBufferLen(number): Default value is 5 , encoder frame buffer size.\ncaptureBufferLen(number): The default value is 5, and the camera takes the image frame buffer size.  \n\n* `getMat`\n\nRetrieve the encoded H264 bare stream frame data from the encoder, and the returned data is encoded in Base64 format. It needs to be called after the start method is called before it can be called.\n\n```js\nopenlive.getMat((res) =\u003e {\n\n});\n```\n\n* `start`\n\nPlease call after calling the setConf method. The return value is a Boolean value. The range of openlive startup success is true, otherwise it returns false. After starting, the getMat method can be used.\n\n```js\nopenlive.start()\n```\n\n## How to run it\n\n```shell\nnode-gyp configure\nnpm run build\nnode index\n```\n\n![show](./resources/2024-05-04013528.png)\n\n## Examples\n\n* [index.js](./index.js) default function .\n* [local_svr.js](./local_svr.js) default function, to push stream for proxy_svr.js .\n* [proxy_svr.js](./proxy_svr.js) recv stream from local_svr, broadcast chat message to client .\n\n## Local_svr and proxy_svr\n\nYour camera device doesn’t have a public IP, so it can’t be accessed from outside your local network (for example, if the camera is in Beijing, China, and you’re trying to view it from your phone’s browser in Washington, D.C.).\n\nTo fix this, you can set up the proxy_svr service on a cloud server to relay your video feed, making it available as a cloud-based service.\n\n```bash\nnode local_svr.js(20003)  --auth(proxy message)\n                            |--\u003e  node proxy_svr.js(20004)  --chat message--\u003e client1\n                                                                          --\u003e client2\n                                                                          --\u003e client3\n                                                                          --\u003e ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaowanlu%2Fopenlive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaowanlu%2Fopenlive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaowanlu%2Fopenlive/lists"}