Giter VIP home page Giter VIP logo

mjpeg-rs's Introduction

MJPEG server in Rust

Table of Contents

About

Just a template code for serving MJPEG stream via OpenCV.

Yes, 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.

What the purpose then? Well, I've change a couple of things:

  • Eliminate use of image crate for encoding purposes. Is slows down MJPEG streaming for me drastically. I use imencode instead.
  • Separated thread for MJPEG streaming (proof of concept)
  • Bump to latest actix-web web framework

Usage

Just modify Rust code in main file to adjust your needs:

    // ...
    // Path to video (could be rtsp or local video file)
    let video_src_path = "rtsp://rtsp.stream/pattern".to_string();
    // let video_src_path = "./data/sample_960_540.mp4".to_string();
    // ...
    // ...
    // Change host and port for live streaming if needed
    start_mjpeg_streaming("localhost".to_string(), 8090, rx_mjpeg, first_frame_cols, first_frame_rows) {
    // ...

Start:

cargo run

Open http://localhost:8090/live in browser and enjoy

There would be opened imshow() object also (don't close it accidenlty since main thread will be terminated).

Credits

Thanks to:

mjpeg-rs's People

Contributors

lddl avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ptkis

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.