Giter Club home page Giter Club logo

rtsphttpgateway's Introduction

RTSP/HTTP Gateway

Simple docker-based gateway to convert RTSP streams to HTTP streams.

Uses cvlc as a backend process to convert multiple (configurable) RTSP stream into HTTP streams. A simple PHP script is used to run a cvlc process for each stream and keep it running/restart it as needed.

The default settings force the output to a specific format, but should be easy to change if needed.

This project was built to solve a specific "I need to use my RTSP camera in a browser" problem, so its scope is fairly limited. But, feel free to fork/contribute!

Installation

  1. Clone the repository
  2. Configure the cameras.json and .env files
  3. Start the container with docker-compose up -d

Usage

There are two things to be configured: the RTSP streams and the port-binding.

The RTSP stream configuration is done by creating a /config/cameras.json file (sample provided). This JSON file contains an array of streams, and each object contains the internal container port on which the HTTP stream will be created (must be unique for each stream) and the RTSP address (stream must be acessible on this address without any interaction needed).

The port-binding is configured by creating a .env file (sample provided). Usually you will set the internal ports configured on the cameras.json file to be publically accessible, but you can map otherwise if needed.

When the container starts, all streams will be initialized. If any stream fails (either or startup or during execution), it will be automatically restarted in a few seconds.

Advanced

No advanced configuration is present at the moment, but if you are up to it:

app/entrypoint.php contains an $options variable that represent the startup params of the cvlc process. It is forcing the output to a specific format/codec. Should be easy to update if necessary.

FAQ

How many streams can I create?

It really depends on what piece of hardware you are using. Video transcoding put a heavy load on CPU, so you should really try and see. The larger the input video, the more CPU will be used. The higher the output framerate/quality, the higher the CPU load will be.

Tests done running ~10 camera streams on low quality in a dedicated Raspberry Pi3 showed about 50% CPU usage on average (fluctuates a lot).

Can the HTTP stream be password-protected?

Yes (although I never tested it personally). You will need to manually update the entrypoint.php file to add some options to the $option variable:

--sout-http-user=<string> --sout-http-pwd=<string>

There is no support for doing this in a "nice" way at the moment, nor is there support for setting different user/pass for different streams (I didn't need this at the time). If you really need it, raise an issue or... even better... contribute ๐Ÿ˜„

rtsphttpgateway's People

Contributors

alesinicio avatar

Watchers

 avatar

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.