Contents

RTSP Camera

Note

:

For more information on the RTSP URI, refer to the website or the tool of the camera software which is used to configure the RTSP camera.

For more information on RTSP protocol, refer to Real Time Streaming Protocol.

  • If you want to enable resizing with an RTSP camera, use the vaapipostproc element and specifiy the height and width parameter in the Gstreamer pipeline.

    An example pipeline to enable resizing with an RTSP camera:

    `"pipeline": "rtspsrc location=\"rtsp://<USERNAME>:<PASSWORD>@<RTSP_CAMERA_IP>:<PORT>/<FEED>\" latency=100  ! rtph264depay ! h264parse ! vaapih264dec ! vaapipostproc format=bgrx height=600 width=600 ! videoconvert ! video/x-raw,format=BGR ! appsink"`
    
  • If working behind a proxy, RTSP_CAMERA_IP/simulated SOURCE_IP need to be updated to RTSP_CAMERA_IP in ../../build/.env([WORK_DIR]/IEdgeInsights/build/.env) and ../../build/builder.py([WORK_DIR]/IEdgeInsights/build/builder.py) needs to be executed.

  • For working both with a simulated RTSP server via cvlc or direct streaming from an RTSP camera, we can use the following Gstreamer MediaSDK parsers and decoders based on the input stream type:

    Example: parsers and decoders:

    • h264parse ! vaapih264dec

    • h265parse ! vaapih265dec

      Note: If running on non-gfx systems or older systems where we don’t have hardware media decoders, the previous parsers and decoders may not work. In those cases, one can use the opencv ingestor and refer to the following steps:

      If RTSP stream ingestion needs to be used on a Xeon machine with no GPU, then refer to the following ingestor configuration:

    • If a physical RTSP camera is used, use the following configuration:

      ```javascript
      "pipeline": "rtsp://<USERNAME>:<PASSWORD>@<RTSP_CAMERA_IP>:<PORT>/<FEED>"
      ```
      
    • If a simulated RTSP stream needs to be used,

      • Run the following command to create an RTSP stream:

        ```sh
        docker run --rm -e RTSP_RESOLUTION='1920'x'1080' -e RTSP_FRAMERATE=25 -p 8554:8554 ullaakut/rtspatt:latest
        ```
        
        If more options are required to generate an RTSP stream, refer to the following link:
        <https://hub.docker.com/r/ullaakut/rtspatt/>
        
      • Use the following configuration to read from the RTSP stream generated from the previous command:

        ```javascript
        "pipeline": "rtsp://<SOURCE_IP>:8554/live.sdp"
        ```
        

      Note: Some issues are observed with CVLC-based camera simulation on a Xeon machine with no GPU. In that case, refer to the previous commands to generate an RTSP stream.


RTSP Simulated Camera

Note

It has been observed that VI is unable to read frames from a CVLC RTSP server with an openCV ingestor over long runs.

  • If VI is unable to read frames from a CVLC RTSP server with a gstreamer ingestor, then we need to force appsink to drop the queued buffers. This can be achieved by using the max-buffers and drop properties for appsink.

  • Start a CVLC-based RTSP stream.

    • Install VLC if it is not already installed: sudo apt install vlc

    • To use the RTSP stream from CVLC, the RTSP server must be started using VLC with the following command:

      `cvlc -vvv file://<absolute_path_to_video_file> --sout '#gather:rtp{sdp=rtsp://<SOURCE_IP>:<PORT>/<FEED>}' --loop --sout-keep`
      
      **Note:** `<FEED>` in the CVLC command can be `live.sdp` or it can also be avoided. Ensure the same RTSP URI given here is used in the ingestor pipeline  config.
      
  • RTSP CVLC-based camera simulation

    • If you want to enable resizing with an RTSP-based camera, use the vaapipostproc element in the Gstreamer pipeline and specify the height and width parameters.

      **An example pipeline to enable resizing with an RTSP camera:**
      
      `"pipeline": "rtspsrc location=\"rtsp://<SOURCE_IP>:<PORT>/<FEED>\" latency=100 ! rtph264depay ! h264parse ! vaapih264dec ! vaapipostproc format=bgrx height=600 width=600 ! videoconvert ! video/x-raw,format=BGR ! appsink"`