Python HTTP Streaming in OpenCV via Cloud
In ProgressWhat is the preferred method for Cloud HTTP streaming in Python using OpenCV? We have been able to use the _ticket parameter to stream, but it looks like the web browser utilizes the Bearer token in each request instead.
Is there a known way to pass the bearer token as a header within OpenCVs VideoCapture class? Is there a downside to using the _ticket URL param instead of the Bearer token in the header?
-
Hi Eli Katz,
Likely you like refer to the article of the API document and implement the Cookie-based authentication
Thanks.
-
Hello! Answering:
Is there a downside to using the _ticket URL param instead of the Bearer token in the header?
Tickets were introduced as a solution for scenarios where providing authentication in a header is not an option. If
VideoCapture
cannot be used with a custom header (which I believe is the case, though I could be mistaken), you can use tickets instead.Keep in mind that tickets can only be used once as a security measure. If you need to make another request (e.g., when a session expires or if the connection broke), you will need to generate a new ticket.
Also, when using a cloud relay in a multi-server system, you may need to specify the exact server you’re making the request to by including thex-server-guid
parameter. This is because a ticket is only valid for the server where it was created.Aside from the additional steps mentioned above, I’m not aware of any significant downsides to using tickets.
Let me know if you have further questions or need additional clarification and we would also be happy to hear any feedback from you.
-
Thanks, Nikita. So far adding in x-server-guid has not been needed. Creating a ticket for each camera connection is working and has been stable. We initially glossed over it as an option since we thought it was under the "Deprecated authentication methods (not recommended to use)" section of authentication protocols.
We're specifying which server to get the ticket from by seeing where [cloud_system_id].relay.vmsproxy redirects to before each connection attempt to [cloud_system_id].relay.vmsproxy/rest/v3/devices/{camera_uid}/media
And yes, we've also given up on trying to add a custom header using VideoCapture. Hopefully OpenCV adds that one day.
Please sign in to leave a comment.
Comments
3 comments