Live Video Analytics on IoT Edge . Unable to use RSTP stream generated by webcam.

vikash ranjan 21 Reputation points
2021-02-02T00:34:58.977+00:00

I am generating an RSTP stream using a webcam using the following command.

cvlc v4l2:///dev/video0 --sout="#transcode{vcodec=h264}:rtp{mux=ts,sdp=rtsp://0.0.0.0:8080/cam.sdp}"

I have setup IOTEdge on Jetson Nano and running lvaEdge. I am following the example in the link.
https://learn.microsoft.com/en-us/azure/media-services/live-video-analytics-edge/detect-motion-record-video-clips-media-services-quickstart

I created the following Media Graph

{  
    "@apiVersion": "2.0",  
    "name": "EVRtoAssetsOnMotionDetection",  
    "properties": {  
      "description": "Event-based video recording to Assets based on motion events",  
      "parameters": [  
        {  
            "name": "rtspUserName",  
            "type": "String",  
            "description": "rtsp source user name.",  
            "default": "dummyUserName"  
        },  
        {  
            "name": "rtspPassword",  
            "type": "String",  
            "description": "rtsp source password.",  
            "default" : "dummyPassword"  
        },  
        {  
            "name": "rtspUrl",  
            "type": "String",  
            "description": "rtsp Url"  
        },  
        {  
            "name": "motionSensitivity",  
            "type": "String",  
            "description": "motion detection sensitivity",  
            "default" : "medium"  
        },  
        {  
            "name": "hubSinkOutputName",  
            "type": "String",  
            "description": "hub sink output name",  
            "default" : "iothubsinkoutput"  
        }                                
    ],           
  
      "sources": [  
        {  
          "@type": "#Microsoft.Media.MediaGraphRtspSource",  
          "name": "rtspSource",  
          "endpoint": {  
            "@type": "#Microsoft.Media.MediaGraphUnsecuredEndpoint",  
            "url": "${rtspUrl}",  
            "credentials": {  
              "@type": "#Microsoft.Media.MediaGraphUsernamePasswordCredentials",  
              "username": "${rtspUserName}",  
              "password": "${rtspPassword}"  
            }  
          }  
        }  
      ],  
      "processors": [  
        {  
          "@type": "#Microsoft.Media.MediaGraphMotionDetectionProcessor",  
          "name": "motionDetection",  
          "sensitivity": "${motionSensitivity}",  
          "inputs": [  
            {  
              "nodeName": "rtspSource"  
            }  
          ]  
        },  
        {  
          "@type": "#Microsoft.Media.MediaGraphSignalGateProcessor",  
          "name": "signalGateProcessor",  
          "inputs": [  
            {  
              "nodeName": "motionDetection"  
            },  
            {  
              "nodeName": "rtspSource"  
            }  
          ],  
          "activationEvaluationWindow": "PT1S",  
          "activationSignalOffset": "PT0S",  
          "minimumActivationTime": "PT30S",  
          "maximumActivationTime": "PT30S"  
        }  
      ],  
      "sinks": [  
        {  
          "@type": "#Microsoft.Media.MediaGraphAssetSink",  
          "name": "assetSink",  
          "assetNamePattern": "sampleAssetFromEVR-LVAEdge-${System.DateTime}",  
          "segmentLength": "PT0M30S",  
          "localMediaCacheMaximumSizeMiB": "2048",  
          "localMediaCachePath": "/var/lib/azuremediaservices/tmp/",  
          "inputs": [  
            {  
              "nodeName": "signalGateProcessor"  
            }  
          ]  
        },  
        {  
          "@type": "#Microsoft.Media.MediaGraphIoTHubMessageSink",  
          "name": "hubSink",  
          "hubOutputName": "${hubSinkOutputName}",  
          "inputs": [  
            {  
              "nodeName": "motionDetection"  
            }  
          ]  
        }  
      ]  
    }  
}  

and running an instance using the following.

{  
    "@apiVersion" : "2.0",  
    "name" : "Sample-Graph-2",  
    "properties" : {  
        "topologyName" : "EVRtoAssetsOnMotionDetection",  
        "description" : "Sample graph description",  
        "parameters" : [  
            { "name" : "rtspUrl", "value" : "rtsp://IP:8080/cam.sdp" }  
  
        ]  
    }  
}  

I keep getting this error

{  
  "body": {  
    "code": "459",  
    "target": "rtsp://IP:8080/cam.sdp",  
    "protocol": "rtsp"  
  },  
  "properties": {  
    "topic": "/subscriptions/subscription-id/resourceGroups/IOT_Product/providers/microsoft.media/mediaservices/vmedia",  
    "subject": "/graphInstances/Sample-Graph-2/sources/rtspSource",  
    "eventType": "Microsoft.Media.Graph.Diagnostics.ProtocolError",  
    "eventTime": "2021-02-01T23:59:42.887Z",  
    "dataVersion": "1.0"  
  },  
  "systemProperties": {  
    "iothub-connection-device-id": "Nano1",  
    "iothub-connection-module-id": "lvaEdge",  
    "iothub-connection-auth-method": "{\"scope\":\"module\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}",  
    "iothub-connection-auth-generation-id": "auth id",  
    "iothub-enqueuedtime": 1612223982902,  
    "iothub-message-source": "Telemetry",  
    "messageId": "msg id",  
    "contentType": "application/json",  
    "contentEncoding": "utf-8"  
  }  
}  

The stream displays fine in VLC. I am unable to debug the issue.

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
548 questions
0 comments No comments
{count} votes

Accepted answer
  1. António Sérgio Azevedo 7,666 Reputation points Microsoft Employee
    2021-02-02T02:19:47.33+00:00

    @vikash ranjan

    Checking the code of your error for the RTSP Protocol

    459 - Aggregate operation not allowed
    See more info about the error: https://tools.ietf.org/html/rfc2326#page-43

    Based on these related threads in Stack Overflow:
    https://stackoverflow.com/questions/9253721/whats-wrong-with-this-my-rtsp-methods-server-replies-459-always
    https://stackoverflow.com/questions/20278472/rtsp-1-0-459-aggregate-operation-not-allowed

    Please can you follow the suggestion and try setting up the RTP stream accordingly?

    Thanks!


0 additional answers

Sort by: Most helpful