General Usage
This document will describe how to execute some of the most important types of commands used with the device service.
Execute GetStreamURI Command through EdgeX
Note
Make sure to replace Camera001
in all the commands below, with the proper deviceName.
-
Get the profile token by executing the
GetProfiles
command:Example Output:curl -s http://0.0.0.0:59882/api/v3/device/name/Camera001/MediaProfiles | jq -r '"profileToken: " + '.event.readings[].objectValue.Profiles[].Token''
profileToken: profile_1 profileToken: profile_2
-
To get the RTSP URI from the ONVIF device, execute the
GetStreamURI
command, using a profileToken found in step 1:
In this example,profile_1
is the profileToken:
Example Output:curl -s "http://0.0.0.0:59882/api/v3/device/name/Camera001/StreamUri?jsonObject=$(base64 -w 0 <<< '{ "StreamSetup" : { "Stream" : "RTP-Unicast", "Transport" : { "Protocol" : "RTSP" } }, "ProfileToken": "profile_1" }')" | jq -r '"streamURI: " + '.event.readings[].objectValue.MediaUri.Uri''
streamURI: rtsp://192.168.86.34:554/stream1
-
Stream the RTSP stream.
Warning
RTSP streams are insecure, as the credentials are included in plaintext. Always keep this in mind when streaming via RTSP.
Using theffplay -rtsp_transport tcp "rtsp://<user>:<password>@<IP address>:<port>/<streamname>"
streamURI
returned from the previous step, run ffplay:ffplay -rtsp_transport tcp "rtsp://admin:Password123@192.168.86.34:554/stream1"
While the
streamURI
returned did not contain the username and password, those credentials are required in order to correctly authenticate the request and play the stream. Therefore, it is included in both the VLC and ffplay streaming examples.
If the password uses special characters, you must use percent-encoding.
-
To shut down ffplay, use the ctrl-c command.
To learn more about the API, see here