RTSP CCTV Streaming Optimization in Ignition Perspective

Hello,

I’m trying to implement streaming for over 100 RTSP CCTV cameras in Ignition Perspective, but I’m encountering several technical challenges and would appreciate your guidance.

  • Initial Attempts and Issues
  1. Using VLC for MJPEG Conversion
    I successfully used VLC commands to convert RTSP streams to MJPEG format and stream them via HTTP.
    However, there were major issues:
    Managing individual ports for each CCTV camera added complexity.
    High resource consumption with MJPEG, which caused significant performance degradation, even with just a few streams.

  2. FastAPI-based WebSocket Server
    I built a FastAPI-based web server that converts RTSP streams into HTTP streams via WebSocket.
    However, this also encountered problems:
    Initial WebSocket connection delay of over 5 seconds.
    Severe performance degradation when more than three streams were connected simultaneously.
    I also tested both FFmpeg and GStreamer, but neither resolved the issues.

  3. Additional Attempt: pturmel’s Video Player Module
    I considered using pturmel’s Video Player Module, which appears to be a great solution.
    Unfortunately, it only supports Ignition Vision, while my project requires implementation in Ignition Perspective.

  • Questions
    Could you recommend a better approach to implement stable RTSP streaming for multiple CCTV cameras in Ignition Perspective?
    Specifically, I’m looking for solutions that address performance optimization and scalability.
    Are there any other modules or methods specifically suited for Ignition Perspective that you could suggest?

Thank you for your assistance.

you can test:

use the last version of the module.
For RTSP h264 the stream can be transported to the perspective client.
For RTSP h265, you need to decode/encode the stream to h264 or webM vp8/vp9 and it can cost a lot from a CPU point of view.
In that case nvidia card can help you (GPU usage).

1 Like

I don't have a "Video Player" Module. I have an Image Streamer Module.

Not true. The MJPEG image streams are consumable by Perspective, too. The OpenCV loading in Vision is moot, as Perspective would use the OpenCV that loads in the gateway.

Anyways, the Perspective Video component plays the Image Streamer MJPEG just fine, with one caveat--you need an event script to restart playing whenever the stream stops.

However:

That's a lot of cameras. My module is a resource hog, even for cameras that have no viewers.

1 Like

The test results show that the speed is incredibly fast! How can I purchase this module?

Thank you for your response. I mistakenly thought your module would only work in Vision. I am trying again, but after registering the device, I cannot connect. What might I be missing? I have installed FFmpeg and OpenCV, and have completed all the settings

Your CAM device probably didn't start, possibly because you tried to use a set of location overrides for the gateway but didn't use the string "Gateway" for the MAC ID. (MAC IDs are for distinguishing designer/Vision instances.)

Look in your wrapper.log file for likely errors loading OpenCV or its dependencies. (They won't show in the java logs.)

INFO | jvm 1 | 2024/11/25 13:51:25 | Couldn't repair and continue parse
INFO | jvm 1 | 2024/11/25 13:51:39 | I [c.a.s.s.DummyImgResource ] [13:51:39.332]: Instantiated Singleton
INFO | jvm 1 | 2024/11/25 13:51:39 | I [c.a.s.s.DummyImgResource ] [13:51:39.332]: Instantiated Generator Thread
INFO | jvm 1 | 2024/11/25 13:51:39 | I [c.a.s.s.StreamerServlet ] [13:51:39.333]: Streamer Servlet Initialized in w/
INFO | jvm 1 | 2024/11/25 13:51:39 |
INFO | jvm 1 | 2024/11/25 13:51:39 | I [c.a.s.s.DummyImgResource ] [13:51:39.333]: Started Generator
INFO | jvm 1 | 2024/11/25 13:51:39 | I [c.a.s.s.StreamerServlet ] [13:51:39.334]: New Stream for streamer/CAM in Thread[webserver-57,5,main] w/ skip=0 & qs=null
INFO | jvm 1 | 2024/11/25 13:51:44 | I [c.a.s.s.StreamerServlet ] [13:51:44.278]: New Stream for streamer/CAM in Thread[webserver-44,5,main] w/ skip=0 & qs=null
INFO | jvm 1 | 2024/11/25 13:51:46 | I [c.a.s.s.StreamerServlet ] [13:51:46.681]: New Stream for streamer/null in Thread[webserver-60,5,main] w/ skip=0 & qs=null
INFO | jvm 1 | 2024/11/25 13:52:02 | I [c.a.s.s.StreamerServlet ] [13:52:02.156]: New Stream for streamer/CAM in Thread[webserver-74,5,main] w/ skip=0 & qs=null
INFO | jvm 1 | 2024/11/25 13:52:02 | I [c.a.s.s.StreamerServlet ] [13:52:02.561]: Client Closed Thread[webserver-60,5,main]
INFO | jvm 1 | 2024/11/25 13:52:05 | I [c.a.s.s.StreamerServlet ] [13:52:05.677]: New Stream for streamer/CAM in Thread[webserver-53,5,main] w/ skip=0 & qs=null
INFO | jvm 1 | 2024/11/25 13:52:05 | I [c.a.s.s.StreamerServlet ] [13:52:05.869]: New Stream for streamer/CAM in Thread[webserver-74,5,main] w/ skip=0 & qs=null
INFO | jvm 1 | 2024/11/25 13:52:06 | I [c.a.s.s.StreamerServlet ] [13:52:06.027]: New Stream for streamer/CAM in Thread[webserver-53,5,main] w/ skip=0 & qs=null
INFO | jvm 1 | 2024/11/25 13:52:06 | I [c.a.s.s.StreamerServlet ] [13:52:06.196]: New Stream for streamer/CAM in Thread[webserver-60,5,main] w/ skip=0 & qs=null
INFO | jvm 1 | 2024/11/25 13:52:06 | I [c.a.s.s.StreamerServlet ] [13:52:06.367]: New Stream for streamer/CAM in Thread[webserver-53,5,main] w/ skip=0 & qs=null
INFO | jvm 1 | 2024/11/25 13:52:06 | I [c.a.s.s.StreamerServlet ] [13:52:06.540]: New Stream for streamer/CAM in Thread[webserver-60,5,main] w/ skip=0 & qs=null
INFO | jvm 1 | 2024/11/25 13:52:06 | I [c.a.s.s.StreamerServlet ] [13:52:06.681]: New Stream for streamer/CAM in Thread[webserver-74,5,main] w/ skip=0 & qs=null

Based on my review of the wrapper.log file, it seems the streaming is working properly. However, accessing stream/CAM still results in a 404 error.

No, that isn't the logging of interest. The part right after the module starts loading where it reports its success/failure loading the JAR and JNI. Then loading details for OpenCV scripting.

I don't think your streaming is starting correctly.