Created
October 31, 2024 14:38
-
-
Save gyillikci/b4483c6055a1c2ddb444c38a50bd0d66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from onvif import ONVIFCamera | |
# Replace with your camera's details | |
camera = ONVIFCamera('192.168.1.100', 80, 'username', 'password') | |
# Create media service | |
media_service = camera.create_media_service() | |
# Get the profiles | |
profiles = media_service.GetProfiles() | |
token = profiles[0].token | |
# Create PTZ service | |
ptz_service = camera.create_ptz_service() | |
# Get the current PTZ status | |
status = ptz_service.GetStatus({'ProfileToken': token}) | |
# Print the current focal length | |
print(f"Current focal length: {status.Position.Zoom.x}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment