General Usage
This document will describe how to execute some of the most important 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
GetProfilescommand: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
GetStreamURIcommand, using a profileToken found in step 1:
In this example,profile_1is 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.
ffplay can be used to stream. The command follows this format: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>"streamURIreturned from the previous step, run ffplay:ffplay -rtsp_transport tcp "rtsp://admin:Password123@192.168.86.34:554/stream1"While the
streamURIreturned 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
Troubleshooting Guide
Axis camera authentication failure
If while using Axis cameras you face authentication failure it might help by disabling its replay attack protection. For doing so please refer to
Axis-replay-attack-protection. For more info on this refer to
Axis-onvif-stackoverflow.