Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
cd6487b
added lva sdk package
hivyas Nov 17, 2020
9b01c04
Merge remote-tracking branch 'upstream/master'
hivyas Dec 11, 2020
9297d4f
updating ci file
hivyas Dec 11, 2020
40a1827
Merge remote-tracking branch 'upstream/master'
hivyas Dec 15, 2020
9e71cfe
Merge remote-tracking branch 'upstream/master'
hivyas Jan 6, 2021
dbeed32
Merge remote-tracking branch 'upstream/master'
hivyas Jan 8, 2021
e667530
fixing confict\
hivyas Mar 24, 2021
f102840
deleteing folder
hivyas Mar 24, 2021
d9d30e3
Merge remote-tracking branch 'upstream/master'
hivyas Mar 24, 2021
75e7827
regenerated and renamed to pipeline terminology
hivyas Mar 25, 2021
db5306e
changing package name
hivyas Apr 15, 2021
8c372e5
changed package name
hivyas Apr 16, 2021
bd53b5a
changing name
hivyas Apr 27, 2021
82e6962
Merge branch 'master' into lvaSdkUpdate
hivyas Apr 29, 2021
db59141
restoring old lva sdk
hivyas Apr 29, 2021
5edd22e
Merge branch 'lvaSdkUpdate' of https://github.com/hivyas/azure-sdk-fo…
hivyas Apr 29, 2021
96a47bb
restored old lva sdk autorest.md
hivyas Apr 29, 2021
e6a89f5
ignoring nspkg readme
hivyas Apr 29, 2021
6a85c74
removing nspkg from dev_requirements
hivyas Apr 29, 2021
dba64bc
rebasing
hivyas Apr 29, 2021
eeff79b
rebasing
hivyas Apr 29, 2021
200bc69
adding back deleted file
hivyas Apr 29, 2021
7dc0b69
corectin nspkg
hivyas Apr 29, 2021
d0c54e7
updating readme
hivyas May 7, 2021
ea6f2de
fixing broken link
hivyas May 7, 2021
d6ed32c
removing media-nspkg from ci file
hivyas May 7, 2021
952dc26
removing old terminology
hivyas May 11, 2021
73d6ac9
generated path is 3 parts
hivyas May 12, 2021
c8831a7
rebasing with master
hivyas May 13, 2021
b7c18bd
updating namespace name
hivyas May 13, 2021
62b94e8
reverting old sdk folder'
hivyas May 13, 2021
8c9dc34
removing video-nspkg
hivyas May 13, 2021
45fa708
fixing linting issue
hivyas May 13, 2021
f222b0d
addressing pr comments
hivyas May 13, 2021
6610202
pr comments
hivyas May 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changing name
  • Loading branch information
hivyas committed Apr 27, 2021
commit bd53b5a818596f3824aeddbb18d899ca6dab258f
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Use the client library for Live Video Analytics on IoT Edge to:
- Simplify interactions with the [Microsoft Azure IoT SDKs](https://github.com/azure/azure-iot-sdks)
- Programatically construct media graph topologies and instances

[Package (PyPI)][package] | [Product documentation][doc_product] | [Direct methods][doc_direct_methods] | [Media graphs][doc_media_graph] | [Source code][source] | [Samples][samples]
[Package (PyPI)][package] | [Product documentation][doc_product] | [Direct methods][doc_direct_methods] | [Media graphs][doc_media_pipeline] | [Source code][source] | [Samples][samples]

## Getting started

Expand All @@ -28,56 +28,56 @@ pip install azure-media-analytics-edge
| SDK | LVA Edge Module |
|---|---|
| 1.0.0b1 | 2.0 |
### Creating a graph topology and making requests
### Creating a pipline topology and making requests
Please visit the [Examples](#examples) for starter code
## Key concepts

### MediaGraph Topology vs MediaGraph Instance
A _graph topology_ is a blueprint or template of a graph. It defines the parameters of the graph using placeholders as values for them. A _graph instance_ references a graph topology and specifies the parameters. This way you are able to have multiple graph instances referencing the same topology but with different values for parameters. For more information please visit [Media graph topologies and instances][doc_media_graph]
### Pipeline Topology vs Live Pipeline Instance
A _pipeline topology_ is a blueprint or template of a graph. It defines the parameters of the graph using placeholders as values for them. A _live pipeline_ references a pipeline topology and specifies the parameters. This way you are able to have multiple live pipelines referencing the same topology but with different values for parameters. For more information please visit [Live pipeline and pipeline topologies][doc_media_pipeline]

### CloudToDeviceMethod

The `CloudToDeviceMethod` is part of the [azure-iot-hub SDk][iot-hub-sdk]. This method allows you to communicate one way notifications to a device in your IoT hub. In our case, we want to communicate various graph methods such as `MediaGraphTopologySetRequest` and `MediaGraphTopologyGetRequest`. To use `CloudToDeviceMethod` you need to pass in two parameters: `method_name` and `payload`.
The `CloudToDeviceMethod` is part of the [azure-iot-hub SDk][iot-hub-sdk]. This method allows you to communicate one way notifications to a device in your IoT hub. In our case, we want to communicate various graph methods such as `PipelineTopologySetRequest` and `PipelineTopologyGetRequest`. To use `CloudToDeviceMethod` you need to pass in two parameters: `method_name` and `payload`.

The first parameter, `method_name`, is the name of the media graph request you are sending. Make sure to use each method's predefined `method_name` property. For example, `MediaGraphTopologySetRequest.method_name`.
The first parameter, `method_name`, is the name of the pipeline topology request you are sending. Make sure to use each method's predefined `method_name` property. For example, `PipelineTopologySetRequest.method_name`.

The second parameter, `payload`, sends the entire serialization of the media graph request. For example, `MediaGraphTopologySetRequest.serialize()`
The second parameter, `payload`, sends the entire serialization of the pipeline topology request. For example, `PipelineTopologySetRequest.serialize()`

## Examples

### Creating a graph topology
To create a graph topology you need to define parameters, sources, and sinks.
### Creating a pipeline topology
To create a pipeline topology you need to define parameters, sources, and sinks.
```
#Parameters
user_name_param = MediaGraphParameterDeclaration(name="rtspUserName",type="String",default="dummyusername")
password_param = MediaGraphParameterDeclaration(name="rtspPassword",type="String",default="dummypassword")
url_param = MediaGraphParameterDeclaration(name="rtspUrl",type="String",default="rtsp://rtspsim:554/media/camera-300s.mkv")
user_name_param = ParameterDeclaration(name="rtspUserName",type="String",default="dummyusername")
password_param = ParameterDeclaration(name="rtspPassword",type="SecretString",default="dummypassword")
url_param = ParameterDeclaration(name="rtspUrl",type="String",default="rtsp://www.sample.com")

#Source and Sink
source = MediaGraphRtspSource(name="rtspSource", endpoint=MediaGraphUnsecuredEndpoint(url="${rtspUrl}",credentials=MediaGraphUsernamePasswordCredentials(username="${rtspUserName}",password="${rtspPassword}")))
node = MediaGraphNodeInput(node_name="rtspSource")
sink = MediaGraphAssetSink(name="assetsink", inputs=[node],asset_name_pattern='sampleAsset-${System.GraphTopologyName}-${System.GraphInstanceName}', segment_length="PT0H0M30S",local_media_cache_maximum_size_mi_b=2048,local_media_cache_path="/var/lib/azuremediaservices/tmp/")
source = RtspSource(name="rtspSource", endpoint=UnsecuredEndpoint(url="${rtspUrl}",credentials=UsernamePasswordCredentials(username="${rtspUserName}",password="${rtspPassword}")))
node = NodeInput(node_name="rtspSource")
sink = AssetSink(name="assetsink", inputs=[node],asset_container_sas_url='https://sampleAsset-${System.PipelineTopologyName}-${System.LivePipelineName}.com', segment_length="PT0H0M30S",local_media_cache_maximum_size_mi_b=2048,local_media_cache_path="/var/lib/azuremediaservices/tmp/")

graph_properties = MediaGraphTopologyProperties(parameters=[user_name_param, password_param, url_param], sources=[source], sinks=[sink], description="Continuous video recording to an Azure Media Services Asset")

graph_topology = MediaGraphTopology(name=graph_topology_name,properties=graph_properties)
pipeline_topology_properties = PipelineTopologyProperties()
pipeline_topology = PipelineTopology(name=pipeline_topology_name,properties=pipeline_topology_properties)

```

### Creating a graph instance
To create a graph instance, you need to have an existing graph topology.
### Creating a live pipeline
To create a live pipeline, you need to have an existing pipeline topology.
```
url_param = MediaGraphParameterDefinition(name="rtspUrl", value=graph_url)
graph_instance_properties = MediaGraphInstanceProperties(description="Sample graph description", topology_name=graph_topology_name, parameters=[url_param])
url_param = ParameterDefinition(name="rtspUrl", value=graph_url)
pass_param = ParameterDefinition(name="rtspPassword", value='testpass')
live_pipeline_properties = LivePipelineProperties(description="Sample graph description", topology_name=pipeline_topology_name, parameters=[url_param])

graph_instance = MediaGraphInstance(name=graph_instance_name, properties=graph_instance_properties)
live_pipeline = LivePipeline(name=live_pipeline_name, properties=live_pipeline_properties)

```

### Invoking a graph method request
To invoke a graph method on your device you need to first define the request using the lva sdk. Then send that method request using the iot sdk's `CloudToDeviceMethod`
### Invoking a pipeline topology method request
To invoke a pipeline topology method on your device you need to first define the request using the lva sdk. Then send that method request using the iot sdk's `CloudToDeviceMethod`
```
set_method_request = MediaGraphTopologySetRequest(graph=graph_topology)
set_method_request = PipelineTopologySetRequest(pipeline_topology=pipeline_topology)
direct_method = CloudToDeviceMethod(method_name=set_method_request.method_name, payload=set_method_request.serialize())
registry_manager = IoTHubRegistryManager(connection_string)

Expand Down Expand Up @@ -126,11 +126,11 @@ additional questions or comments.
[coc_contact]: mailto:[email protected]

[package]: TODO://link-to-published-package
[source]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/media
[source]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/videoanalyzer
[samples]: https://github.com/Azure-Samples/live-video-analytics-iot-edge-python

[doc_direct_methods]: https://docs.microsoft.com/azure/media-services/live-video-analytics-edge/direct-methods
[doc_media_graph]: https://docs.microsoft.com/azure/media-services/live-video-analytics-edge/media-graph-concept#media-graph-topologies-and-instances
[doc_media_pipeline]: https://docs.microsoft.com/azure/media-services/live-video-analytics-edge/media-graph-concept#media-graph-topologies-and-instances
[doc_product]: https://docs.microsoft.com/azure/media-services/live-video-analytics-edge/

[iot-device-sdk]: https://pypi.org/project/azure-iot-device/
Expand Down
Loading