GithubHelp home page GithubHelp logo

camera_route's Introduction

RTSP Camera RTSP router

This is a RESTful server utilizing the ExpressJS framework to facilitate accessing video streams from an RTSP camera.

This is a Docker container-based solution that requires the host network driver to receive RTSP push from the camera.

The host networking driver only works on Linux hosts, and is not supported on Docker for Mac, Docker for Windows, or Docker EE for Windows Server.
So, we need other installation procedure to run locally

The server provides the following functionality:

List all services

[
    {
        "id":"<service id - assign by system>",
        "name":"<service name>",
        "status":"<service status - 'Setup','Connecting','Active','NoSignal','End'>",
        "url":"<Access detail service info include rtsp>:
    }
]

//example:
[
    {"id":0,"name":"Bunny","status":"Active","url":"http://127.0.0.1:19612/service/0"},
    {"id":1,"name":"Color Bar","status":"Active","url":"http://127.0.0.1:19612/service/1"},
    {"id":2,"name":"Invalid","status":"Connecting","url":"http://127.0.0.1:19612/service/2"}
]

Access service detail

{
    "ServiceID":"<service id>",
    "Status":"<service status - 'Setup','Connecting','Active','NoSignal','End'>","ServiceName":"<service name>",
    "stream":"<rtsp url to access the video forward by service>"
}

//example:
{"ServiceID":"0","Status":"Active","ServiceName":"Bunny","stream":"rtsp://127.0.0.1:6554/0"}

Config

  • By default, the application uses /express-docker/config.json stored in the image as config. Users can pass their configuration by specifying a custom JSON file. By
docker run --rm -it --network host --privileged -v <path of config.json>:/express-docker/config.json camera_route:latest
  • service will use it's default config hardcode for any invalid config or config without services
  • Json for config
  {
    "host": "ip address export for rtsp client to connect",
    "port": 19612, // post for restful
    "rtspPort": 6554,  // rtsp server port for client to connecxt
    "rtpPortStart": 10000,
    "rtpPortCount": 10000,
    "services": 
        [ 
            {
                "name": "<Service name with ASCII>",
                "url": "rtsp://<user>:<password>@<rtsp server>/<video path>"
            },
        ]
    };
    //example:

    {
    "host": "127.0.0.1",
    "port": 19612,
    "rtspPort": 6554,
    "rtpPortStart": 10000,
    "rtpPortCount": 10000,
    "services": 
        [ 
            {
                "name": "Bunny",
                "url": "rtsp://rtspstream:[email protected]/movie"
            },{
                "name": "Color Bar",
                "url": "rtsp://rtspstream:[email protected]/pattern"
            },{
                "name": "Invalid",
                "url": "rtsp://rtspstre111am:[email protected]/pattern"
            }
        ]
    }

Getting Started

Linux

  1. Make sure you have Docker installed.
  2. check out source code
  3. Update config.json
  4. Run docker build -f Dockerfile.dev -t camera_route:latest . to build container.
  5. Run container docker run --rm -it --network host --privileged camera_route:latest

Mac and Windows

  1. Make sure you have Node JS and NPM installed.
  2. check out source code
  3. Install ffmpeg Mac and Win
  4. Update config.json
  5. Run 'npm install' to install all require Package
  6. Run 'node index.js' under source code folder.

Health Check

Go to your browser and access http://127.0.0.1:19612 to confirm the server is running. Use http://127.0.0.1:19612/list to list all available services.

To Do

  1. Add API for Deactivating Service, Adding/Dropping service while running, and using custom paths.
  2. Run without privileged mode.
  3. Run with Docker network host driver.
  4. Add test cases.
  5. Add a page to test RESTful API and play video.
  6. Port to work with https://github.com/bluenviron/mediamtx to support more codec without ffmpeg
  7. Config target codec and bitrate per service. Transcode source video it that's different.

Troubleshooting

  • If you encounter any issues while running the containers, you can check the logs by running docker logs [container-name].
  • If you continue to have trouble, please open an issue on the project's Github page.

Contribute

If you want to contribute to this project, you can create a fork and send a pull request.

License

This project is licensed under the MIT License.

camera_route's People

Contributors

khmak3 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.