{"id":21235994,"url":"https://github.com/lddl/mjpeg-rs","last_synced_at":"2025-04-14T00:56:22.816Z","repository":{"id":98202932,"uuid":"526346669","full_name":"LdDl/mjpeg-rs","owner":"LdDl","description":"Example of simple MJPEG server in Rust","archived":false,"fork":false,"pushed_at":"2022-08-18T20:36:34.000Z","size":19315,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T15:04:18.366Z","etag":null,"topics":["actix-web","mjpeg","mjpeg-stream","opencv","opencv-rust","rtsp","rust","video-streaming"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LdDl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-08-18T19:24:37.000Z","updated_at":"2024-03-09T02:47:15.000Z","dependencies_parsed_at":"2023-05-18T14:01:32.427Z","dependency_job_id":null,"html_url":"https://github.com/LdDl/mjpeg-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdDl%2Fmjpeg-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdDl%2Fmjpeg-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdDl%2Fmjpeg-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdDl%2Fmjpeg-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LdDl","download_url":"https://codeload.github.com/LdDl/mjpeg-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804784,"owners_count":21164131,"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":["actix-web","mjpeg","mjpeg-stream","opencv","opencv-rust","rtsp","rust","video-streaming"],"created_at":"2024-11-21T00:05:35.965Z","updated_at":"2025-04-14T00:56:22.811Z","avatar_url":"https://github.com/LdDl.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MJPEG server in Rust\n\n## Table of Contents\n\n- [About](#about)\n- [Usage](#usage)\n- [Credits](#credits)\n\n## About\n\nJust a template code for serving MJPEG stream via OpenCV.\n\nYes, this repo code is stolen (*highly inspired* if you want to) from https://github.com/dskkato/mjpeg-rs and in https://github.com/t924417424/mjpeg_rs.\n\nWhat the purpose then? Well, I've change a couple of things:\n\n* Eliminate use of [image](https://crates.io/crates/image) crate for encoding purposes. Is slows down MJPEG streaming for me drastically. I use [imencode](./src/main.rs#L59) instead.\n* Separated thread for MJPEG streaming (proof of concept)\n* Bump to latest [actix-web](https://actix.rs/) web framework\n\n## Usage\n\nJust modify Rust code in [main](src/main.rs) file to adjust your needs:\n\n```rust\n    // ...\n    // Path to video (could be rtsp or local video file)\n    let video_src_path = \"rtsp://rtsp.stream/pattern\".to_string();\n    // let video_src_path = \"./data/sample_960_540.mp4\".to_string();\n    // ...\n    // ...\n    // Change host and port for live streaming if needed\n    start_mjpeg_streaming(\"localhost\".to_string(), 8090, rx_mjpeg, first_frame_cols, first_frame_rows) {\n    // ...\n```\n\nStart:\n\n```\ncargo run\n```\n\nOpen http://localhost:8090/live in browser and enjoy\n\nThere would be opened imshow() object also (don't close it accidenlty since main thread will be terminated).\n\n## Credits\nThanks to:\n * https://github.com/t924417424/mjpeg_rs for inspiring\n * https://github.com/dskkato/mjpeg-rs for actix-web based version\n * https://actix.rs/ for great Web-framework\n * https://github.com/twistedfall/opencv-rust for binding to [OpenCV](https://opencv.org/)\n * https://rtsp.stream/ for RTSP stream example\n * Rust community and not mentioned authors of other dependencies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flddl%2Fmjpeg-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flddl%2Fmjpeg-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flddl%2Fmjpeg-rs/lists"}