Contents

RTSP Camera

NOTE:

  • For more information on the RTSP URI please refer the website/tool of the camera software which is used to configure the RTSP camera. For information on RTSP protocol refer https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol

  • In case you want to enable resizing with RTSP camera use the vaapipostproc element and specifiy the height and width parameter in the gstreamer pipeline.

    Example pipeline to enable resizing with RTSP camera:

    "type": "GStreamer",
    "template": [
    "pipeline": "rtspsrc location=\"rtsp://<USERNAME>:<PASSWORD>@<RTSP_CAMERA_IP>:<PORT>/<FEED>\" latency=100 name=source ! rtph264depay ! h264parse ! vaapih264dec ! vaapipostproc format=bgrx height=600 width=600 ! videoconvert ! video/x-raw,format=BGR ! appsink name=destination"
    ]
    
  • 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 simulated RTSP server via cvlc or direct streaming from RTSP camera, we can use the below Gstreamer MediaSDK parsers and decoders based on the input stream type

    Eg: parsers and decoders:

    • h264parse ! vaapih264dec

    • h265parse ! vaapih265dec

    In case RTSP stream ingestion needs to be used on Xeon machine with no GPU then refer the following ingestor config,

    • If a physical RTSP camera is used use the below config:

      ```javascript
      "template": [
        "rtspsrc location=\"rtsp://<USERNAME>:<PASSWORD>@<RTSP_CAMERA_IP>:<PORT>/<FEED>\" latency=100 name=source ! rtph264depay ! h264parse ! vaapih264dec ! vaapipostproc format=bgrx ! videoconvert ! video/x-raw,format=BGR ! appsink name=destination" ]
      ```
      
    • If a simulated RTSP stream needs to be used:

      • Run the following command to create a 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 a RTSP stream refer
        the following link:
        <https://hub.docker.com/r/ullaakut/rtspatt/>
        
      • Use the following config to read from the RTSP stream generated

        from the above command”

        ```javascript
        "template": [
          "rtspsrc location=\"rtsp://<SOURCE_IP>:8554/live.sdp\" latency=100 name=source ! rtph264depay ! h264parse ! vaapih264dec ! vaapipostproc format=bgrx ! videoconvert ! video/x-raw,format=BGR ! appsink name=destination" ]
        ```
        

      NOTE :

      • Some issues are observed with cvlc based camera simulation on a Xeon Machine with no GPU. In that case refer the above commands to generate a RTSP stream.

      • RTSP with Vaapi decoder might throw few errors on start of the pipeline as below.

        ``ERROR vaapi gstvaapidecoder_h264.c:2913:find_short_term_reference: found no short-term reference picture with PicNum

        ERROR vaapi gstvaapidecoder_h264.c:3119:exec_picture_refs_modification_1: list 0 entry 0 is empty``

        Initially it loses some reference frames which causes the above errors.


RTSP Simulated Camera

  • Start cvlc based RTSP stream

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

    • In order 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. But make sure the same RTSP URI given here is
      used in the ingestor pipeline config.
      
  • RTSP cvlc based camera simulation

    • In case you want to enable resizing with RTSP cvlc based camera use the vaapipostproc element and specifiy the height and width parameter in the pipeline.

      Example pipeline to enable resizing with RTSP camera:

      "template": [ "rtspsrc location=\"rtsp://<SOURCE_IP>:<PORT>/<FEED>\" latency=100 name=source ! rtph264depay ! h264parse ! vaapih264dec ! vaapipostproc format=bgrx height=600 width=600 ! videoconvert ! video/x-raw,format=BGR ! appsink name=destination" ]