Camera RTSP Feed

dgrard
2023-10-17
2024-09-17
  • dgrard - 2023-10-17

    Hello

    Is it possible to view a camera RTSP feed in a visualization? It seems as though the browser element doesn't support this and we are trying to replicate an example using the ActivX element with no luck. We are using the Windows Control Win x64 device with a camera connected via LAN.

    If it is possible, can you provide some instructions please.

    Thank you

     
  • bbm1995 - 2023-11-14

    Hi dgrard, I had the same issue for a long time, but on a WAGO webvisu.
    Now I'm glad that I can share my solution.

    I don't know if you are trying to use the webvisu or the target visu, but this works on webvisu:

    Get "go2rtc" and set it up according to the documentation. I'm running the Windows binary.
    Here's my example of the go2rtc.yaml config file (contains working example streams):

    api:
      listen:       ":1984"     # default ":1984", HTTP API port ("" - disabled)
      origin:       "*"         # default "", allow CORS requests (only * supported)
      static_dir:   "www"       # default "", folder for static files (custom web interface)
      tls_listen:   ":443"      # default "", enable HTTPS server
      tls_cert:     "./SSL/fullchain.pem"
      tls_key:      "./SSL/privatekey.pem"
    
    streams:
    # Streams with multiple links will fall back on the next link.
    
      ABUS TVIP48511:
        - rtsp://<username>:<password>@<hostname>:<port>/ch1/main
        - rtsp://<username>:<password>@<hostname>:<port>/ch1/sub
    
    # Diagnostic connections
      Kirchhoff Institute for Physics - Germany: http://pendelcam.kip.uni-heidelberg.de/mjpg/video.mjpg
      Blanton Bottling, Kentucky - USA: http://camera.buffalotrace.com/mjpg/video.mjpg
      Tokyo - Japan: http://61.211.241.239/nphMotionJpeg?Resolution=320x240&Quality=Standard
      Tampere Hacklab - Finland: http://tamperehacklab.tunk.org:38001/nphMotionJpeg?Resolution=640x480&Quality=Clarity
      Soltorget Pajala - Sweden: http://195.196.36.242/mjpg/video.mjpg
      Kaiskuru Skistadion - Norway: http://77.222.181.11:8080/mjpg/video.mjpg
    
    webrtc:
      listen: ":8555"
      #ice_servers:
      #  - urls: [ "stun:localhost:3478" ]
      #    username: ""
      #    credential: ""
    

    Access the webinterface of go2rtc and get the link of your stream.
    Use the link as for your browser frame in the visualization.

    Depending on your device, you need to be able to access the file /etc/lighttpd/lighttpd.conf or /etc/lighttpd/webvisu.conf and change the contents similar to this one, otherwise you'll get CORS and CSP errors in the browser and you won't be able to view the stream on the webvisu:

    # Webvisu specific settings
    $SERVER["socket"] =~ port_webvisu_used_any {
        url.redirect += (
            "^/webvisu/?$" => "/webvisu/webvisu.htm"
        )
    
        $HTTP["url"] =~ "^/webvisu/?" {
            var.response_header_policy_webvisu = (
                # CSP for WebVisu, allowing inline sources.
                "Content-Security-Policy" => "default-src 'self' 'unsafe-inline'; media-src *; frame-src *",
    
                # CORS for WebVisu, allowing any origin to access.
                "Access-Control-Allow-Origin" => "*",
    
                # Tell older browsers that this page can only be displayed if all ancestor
                # frames are same origin to the page itself.
                "X-Frame-Options" => "SAMEORIGIN"
            )
    
            # Response header policy for WebVisu
            setenv.set-response-header  = var.response_header_policy_webvisu
            setenv.set-response-header += var.response_header_policy_common
        }
    
     
    πŸ‘
    1
  • jinlee - 2024-09-13

    Hi,

    I can see the camera feed in the Codesys software, but not on the webvisu browser.

    Kind regards,
    Jin.

     
    • bbm1995 - 2024-09-16

      Can you provide some infos on what you did?
      What model is your camera and which protocols does it support? Is there a direct link to the feed? Does your camera prevent embedding of the feed (this was my issue.)?

      I had to use additional software (go2rtc) to be able to stream the feed from an ABUS TVIP48511...

       
  • jinlee - 2024-09-17

    Hi,

    I followed your guidance and used go2rtc. There is a link generated from go2rtc I can copy into the web browser element in the visualisation. It somehow only appear within the software when it is running, but not on the webvisu. I want to display the camera feed onto the webvisu.

    My camera is reolink 810a which supports IP protocol.

    My project is pretty simple, just a web browser element with assigned URL.

     

    Last edit: jinlee 2024-09-17

Log in to post a comment.