Service Usage Instructions

PTZ Microservice 1.0.1

PTZ Microservice allows you to navigate a video through PTZ.

It leverages the RidgeRun Spherical Video PTZ to make possible the selection of your region of interest within the sphere. This is specified through pan (horizontal), tilt (vertical), and zoom controls, which can be updated at any time during execution.

This service receives an RTSP stream, performs the PTZ depending on the user instructions, and then returns the stream using the same protocol, RTSP. By default the service uses the first VST stream available as input and uses rtsp://<IP>:5021/ptz_out as output stream.

API configuration

Take a look at the API Documentation for a list of the available requests.

Running the service

Before running the service, you should make sure you have all the dependencies installed. The intructions to do it can be found here

The project is configured (via setup.py) to install the service with the name ptz. So to install it run:

pip install .

Then you will have the service with the following options:

usage: ptz [-h] [--port PORT] [--host HOST] [--ptz-window-size PTZ_WINDOW_SIZE]

options:
  -h, --help            show this help message and exit
  --port PORT           Port for server
  --host HOST           Server ip address
  --ptz-window-size PTZ_WINDOW_SIZE
                        Size of the PTZ output window in pixels. The final resolution will be (Size x Size)

PTZ Microservice Docker

Before starting with docker support make sure you have nvidia runtime in your system. Follow these instructions to have docker up and runing in your Jetson Board.

Build the container

We can build the ptz microservice container using the Dockerfile in the docker directory. This includes a base NVIDA image and the dependencies to run the ptz microservice application.

First, we need to prepare the context directory for this build, please create a directory and include all the needed repositories (listed below). The Dockerfile will look for all the source code in the context directory and copy them to the container.

ptz-context/
.
├── gst-cuda
├── gst-rr-panoramaptz
├── gst-rtsp-sink
├── libpanorama
├── ptz
└── rrms-utils

Then build the container image running the following command from the folder contaning the Dockerfile and context directory:

sudo docker build \
--network=host \
-f Dockerfile \
-t ridgerun/ptz-service:latest ptz-context/

Change ptz-context to your context’s path and the tag (-t) to the name you want to give to your image.

Launch the container

The container can be launched by running the following command:

sudo docker run --runtime nvidia -it --privileged --net=host --ipc=host --name ptz-service  ridgerun/ptz-service:latest

You can modify the name you want to give to your container with the option –name.

Here we are creating a container called ptz-service that will start the ptz-service application in the default address and port and using the default output resolution. If a different address, port, or output resolution has to be used, you can do it by running:

sudo docker run --runtime nvidia -it --privileged --net=host --ipc=host --name ptz-service  ridgerun/ptz-service:latest --host=HOST --port=PORT --ptz-window-size=PTZ_WINDOW_SIZE