This library is designed to provide control and configuration of Axis cameras using the Onvif and Vapix protocol.
VAPIX® is Axis' own open API (Application Programming Interface) using standard protocols enabling integration into a wide range of solutions on different platforms.
VAPIX® provides functionality for requesting images, controlling Pan Tilt Zoom, controlling Input and Output ports, retrieve and control internal settings, to manage Events, record and retrieve video to/from the SD card, and much, much more. Almost all functionality available in Axis products can be controlled using VAPIX®, some functions are even only supported via VAPIX®, for example, to retrieve Bitmap images.
ONVIF (Open Network Video Interface Forum) is a global and open industry forum with the goal of facilitating the development and use of a global open standard for the interface of physical IP-based security products. ONVIF creates a standard for how IP products within video surveillance and other physical security areas can communicate with each other. ONVIF is an organization started in 2008 by Axis Communications, Bosch Security Systems and Sony.
Install the package through pip:
pip install sensecam-control
Example of use:
from sensecam_control import vapix_control
from sensecam_control import onvif_control
Camera1 = vapix_control.CameraControl(<ip>, <login>, <password>)
Camera2 = onvif_control.CameraControl(<ip>, <login>, <password>)
Camera1.absolute_move(10, 20, 1)
Camera1.absolute_move(10, 20, 1, 50)
Camera2.absolute_move(0.02, 0.60, 0.0)
Camera2.relative_move(0.3, -0.2, 0)
absolute_move(pan, tilt, zoom, speed)
- Operation to move pan, tilt or zoom to a absolute destination.
continuous_move(pan, tilt, zoom)
- Operation for continuous Pan/Tilt and Zoom movements.
relative_move(pan, tilt, zoom, speed)
- Operation for Relative Pan/Tilt and Zoom Move.
stop_move()
- Operation to stop ongoing pan, tilt and zoom movements of absolute relative and continuous type.
center_move(pos_x, pos_y, speed)
- Used to send the coordinates for the point in the image where the user clicked. This information is then used by the server to calculate the pan/tilt move required to (approximately) center the clicked point.
area_zoom(pos_x, pos_y, zoom, speed)
- Centers on positions x,y (like the center command) and zooms by a factor of z/100.
move(position, speed)
- Moves the device 5 degrees in the specified direction.
go_home_position(speed)
- Operation to move the PTZ device to it's "home" position.
get_ptz()
- Operation to request PTZ status.
go_to_server_preset_name(name, speed)
- Move to the position associated with the preset on server.
go_to_server_preset_no(number, speed)
- Move to the position associated with the specified preset position number.
go_to_device_preset(preset_pos, speed)
- Bypasses the presetpos interface and tells the device to go directly to the preset position number stored in the device, where the is a device-specific preset position number.
list_preset_device()
- List the presets positions stored in the device.
list_all_preset()
- List all available presets position.
set_speed(speed)
- Sets the head speed of the device that is connected to the specified camera.
get_speed()
- Requests the camera's speed of movement.
factory_reset_default()
- Reload factory default. All parameters except Network.BootProto, Network.IPAddress, Network. SubnetMask, Network.Broadcast and Network.DefaultRouter are set to their factory default values.
hard_factory_reset_default()
- Reload factory default. All parameters are set to their factory default value.
restart_server()
- Restart server.
get_server_report()
- This CGI request generates and returns a server report. This report is useful as an input when requesting support. The report includes product information, parameter settings and system logs.
get_system_log()
- Retrieve system log information. The level of information included in the log is set in the Log. System parameter group.
get_system_access_log()
- Retrieve client access log information. The level of information included in the log is set in the Log.Access parameter group.
get_date_and_time()
- Get the system date and time.
set_date(year_date, month_date, day_date)
- Change the system date.
set_time(hour, minute, second, timezone)
- Change the system time.
get_image_size()
- Retrieve the actual image size with default image settings or with given parameters.
get_video_status(camera_status)
- Video encoders only. Check the status of one or more video sources.
get_bitmap_request(resolution, camera, square_pixel)
- Request a bitmap image.
get_jpeg_request(resolution, camera, square_pixel, compression, clock, date, text, text_string, text_color, text_background_color, rotation, text_position, overlay_image, overlay_position)
- The requests specified in the JPEG/MJPG section are supported by those video products that use JPEG and MJPG encoding.
get_type_camera()
- Request type camera.
get_dynamic_text_overlay()
- Get dynamic text overlay in the image.
set_dynamic_text_overlay(text, camera)
- Set dynamic text overlay in the image.
check_profile(name)
- Check if the profile exists.
create_profile(name: str, *, resolution, videocodec, fps, compression, h264profile, gop, bitrate, bitratepriority)
- Create stream profile.
create_user(user, password, sgroup, *, group, comment)
- Create user.
update_user(user, password, *, group, sgroup, comment)
- Update user params.
remove_user(user)
- Remove user.
check_user(name)
- Check if user exists.
set_hostname(hostname, *, set_dhcp)
- Configure how the device selects a hostname, with the possibility to set a static hostname and/or enable auto-configuration by DHCP.
set_stabilizer( stabilizer, *, stabilizer_margin)
- Set electronic image stabilization (EIS).
set_capture_mode(capture_mode)
- Set capture mode.
set_wdr(wdr, *, contrast)
- WDR - Forensic Capture - Wide Dynamic Range can improve the exposure when there is a considerable contrast between light and dark areas in an image.
set_appearance(*, brightness, contrast, saturation, sharpness)
- Image Appearance Setting.
set_ir_cut_filter(ir_cut, *, shift_level)
- IR cut filter settings.
ir_cut (str): IR value. (on, off, auto)
set_exposure(*, exposure, exposure_window, max_exposure_time, max_gain, exposure_priority_normal, lock_aperture, exposure_value)
- Exposure Settings.
set_custom_exposure_window(top, bottom, left, right)
- Set custom exposition zone.
set_backlight(backlight)
- Backlight compensation makes the subject appear clearer when the image background is too bright, or the subject is too dark.
set_highlight(highlight)
- The Axis product will detect a bright light from a source such as a torch or car headlights and mask that image area. This setting is useful when the camera operates in a very dark area where a bright light may overexpose part of the image and prevent the operator from seeing other parts of the scene.
set_image_setings(*, defog, noise_reduction, noise_reduction_tuning, image_freeze_ptz)
- Image Settings.
set_ntp_server(ntp_server)
- Configure NTP server.
set_pan_tilt_zoom_enable(*, pan_enable, tilt_enable, zoom_enable)
- Turns PTZ control on and off.
auto_focus(focus)
- Enable or disable automatic focus.
auto_iris(iris)
- Enable or disable automatic iris control.
absolute_move(pan, tilt, zoom)
- Operation to move pan, tilt or zoom to a absolute destination.
continuous_move(pan, tilt, zoom)
- Operation for continuous Pan/Tilt and Zoom movements.
relative_move(pan, tilt, zoom)
- Operation for Relative Pan/Tilt and Zoom Move.
stop_move()
- Operation to stop ongoing pan, tilt and zoom movements of absolute relative and continuous type.
set_home_position()
- Operation to save current position as the home position.
go_home_position()
- Operation to move the PTZ device to it's "home" position.
get_ptz()
- Operation to request PTZ status.
set_preset(preset_name)
- The command saves the current device position parameters.
get_preset()
- Operation to request all PTZ presets.
get_preset_complete()
- Operation to request all PTZ presets.
remove_preset(preset_name)
- Operation to remove a PTZ preset.
go_to_preset(preset_position)
- Operation to go to a saved preset position.
set_user(name, password, user_level)
- This operation updates the settings for one or several users on a device for authentication purposes.
create_user(username, password, user_level)
- This operation creates new device users and corresponding credentials on a device for authentication.
delete_users(username)
- This operation deletes users on a device.
get_users()
- This operation lists the registered users and corresponding credentials on a device.
set_discovery_mode(discovery_mode)
- This operation sets the discovery mode operation of a device.
set_dns(type_dns, ipv4, ipv6)
- This operation sets the DNS settings on a device.
get_hostname()
- This operation is used to get the hostname from a device.
set_hostname(new_hostname)
- This operation sets the hostname on a device.
get_ip_address_filter()
- This operation gets the IP address filter settings from a device.
get_device_information()
- This operation gets basic device information from the device.
get_discovery_mode()
-This operation gets the discovery mode of a device.
get_dns()
- This operation gets the DNS settings from a device.
get_dynamic_dns()
- This operation gets the dynamic DNS settings from a device.
get_network_default_gateway()
- This operation gets the default gateway settings from a device.
get_network_interfaces()
- This operation gets the network interface configuration from a device.
get_network_protocols()
- This operation gets defined network protocols from a device.
get_ntp()
- This operation gets the NTP settings from a device.
get_system_date_and_time()
- This operation gets the device system date and time.
get_wsdl_url()
- Request a URL that can be used to retrieve the complete schema and WSDL definitions of a device.
system_reboot()
- This operation reboots the device.
start_system_restore()
- This operation initiates a system restore from backed up configuration data using the HTTP POST mechanism.
get_profiles()
- This command lists all configured video profiles in a device.
get_audio_decoder_configurations()
- This operation requests decoder configuration.
get_video_analytics_configurations()
- This operation fetches the video analytics configuration.
get_video_encoder_configurations()
- This operation request the encoder configuration.
get_video_source_configurations()
- This operation request the video source configuration.
get_video_sources()
- This operation lists all available physical video inputs of the device.