Skip to content

nola-a/mjpeg2http

Repository files navigation

mjpeg2http

A pure C Linux MJPEG over HTTP server

License: MIT

Summary

mjpeg2http is a minimalistic server primarily targeted to run on embedded computers, like routers, raspberry pi, with a Linux OS.

It can be used to stream JPEG files over an IP-based network from a webcam to various types of viewers such as Google Chrome, Mozilla Firefox, VLC, mplayer, and other software capable of receiving MJPG streams.

The implementation uses epoll on non-blocking file descriptors and is not thread-based.

Build using make

Install dependencies:

$ sudo apt install build-essential libv4l-dev

Compile with:

$ make

Build using cmake

Compile with:

$ mkdir build
$ cmake ..
$ make

Usage

Run:

$ ./mjpeg2http 192.168.2.1 8080 /dev/video0 my_secret_token
 

Open browser on http://192.168.2.1:8080/path?my_secret_token

One time token

Run:

$ ./mjpeg2http 192.168.2.1 8080 /dev/video0 my_secret_token /tmp/mjpeg2http_token
 

Book access:

$ echo "12345678901234567890" > /tmp/mjpeg2http_token
 

Open browser on http://192.168.2.1:8080/path?12345678901234567890

The token will be valid exactly for one access after that it gets invalid

Warning

  • mjpeg2http should be used in private network because it does not use TLS connections. If you would like to use it while on a public network it is highly recommended to use TLS, some ideas:
    • you can try stunnel.
    • nginx or apache httpd placed in front of mjpeg2http with a reverse proxy.
    • for encryption between mjpeg2http and server it can be used ssh tunnels or wireguard.
  • token length must be exactly TOKEN_SIZE (see constants.h)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published