Introduction
The Panasonic AW-HE40 is a Pan-Tile-Zoom Remote camera. It support CGI control via IP network. The control commands are in compliance with the HTTP1.1 communication specifications. Their format is given below:
http://[Camera_IP_Address]/cgi-bin/aw_ptz?cmd=[Command]&res=1
This article will cover the following mostly used information and control functions:
- Power On and StandBy
- Pan and Tilt Operations
- Zoom Operations
- Preset Functions
- Wireless Remote Controller Settings
- Camera Information
- Video Stream
- Image Acquisition
Power On and StandBy
# Power on http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23O1&res=1 Return: 200 OK "p1" # Put in standby mode http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23O0&res=1 Return: 200 OK "p0" # Inquiry http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23O&res=1 Return (Standby): 200 OK "p0" Return (Power On): 200 OK "p1" Return (Transferring from Standby to ON): 200 OK "p3"
Pan/Tilt Operations
For Pansonic AW-HE40, Pan range is from -175o (2D09h) to +175 o (D2F5h), and Tilt range is from -30o (5555h) to +90o (8E38h).
1 degree = 121 (decimal) or 79 (hex)
# Pan/tilt position control (Absolute Value) # #APC[Data1][Data2][[Data3][Data4]] # [Data1] - Pan Position 0000h(ccw max)-8000h(home)-FFFF(cw max) # [Data2] - Tilt Position 0000h(up max)-8000h(center)-FFFF(down max) # [Data3] - Pst Spd 00h-1Dh # [Data4] - Spd Tbl 0(SLOW)-2(FAST) http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23APC80008000&res=1 # Return (home): 200 OK "aPC80008000" # Inquiry of current pan and tilt position http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23APC&res=1 # Return (home): 200 OK "aPC80008000" # Stop current pan/tilt operation http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23PTS5050&res=1 # Return: 200 OK "pTS5050" # Pan/tilt position control (Relative Value) # #RPC[Data1][Data2][[Data3][Data4]] http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23RPC80008000&res=1 # Return (home): 200 OK "rPC80008000"
Note: When using the pan-tilt head control commands, send the commands with a gap of 130 ms between each command.
Zoom Operations
These commands control the zooming (between Wide and Tele) of the camera lens and enable the current zoom position and zooming speed to be acquired.
# Zoom control: #AXZ[Data] # [Data] - 555h (Wide) to FFFh (Tele) http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23AXZ555&res=1 # Return: 200 OK "axz555" # Query zoom position (1): #AXZ http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23AXZ&res=1 # Return: 200 OK "axz555" # Query zoom position (2): #GZ http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23GZ&res=1 # Return (if Standby): 200 OK "axz---"
Preset
The camera has functions to register and play back the presets of the camera and enable the preset number last played back to be acquired. They also enable the preset speed to be registered and the current preset speed to be acquired.
# Register a Preset: #M[Data] # [Data] - 00h to 99h (Preset 001 to 100) http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23M00&res=1 # Return: 200 OK "s00" # Recall a Preset: #R[Data] # [Data] - 00h to 99h (Preset 001 to 100) http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23R00&res=1 # Return: 200 OK "s00" # Inquiry last preset number being played back: #S http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23S&res=1 # Return: 200 OK "s00" # Pan/tilt position control (Relative Value) # #RPC[Data1][Data2][[Data3][Data4]] http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23RPC80008000&res=1 # Return (home): 200 OK "rPC80008000"
Wireless Remote Controller
Wireless Remote Controller can be enabled or disabled via the CGI commands. The Wireless Controller ID can be set too.
# Enable/Disable wireless remote controller: #WLC[Data] # [Data] - 0 (Disable) or 1 (Enable) http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23WLC0&res=1 # Return: 200 OK "wLC0" # Query the status: #WLC http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23WLC&res=1 # Return: 200 OK "wLC0" # Set wireless remote controller ID: #RID[Data] # [Data] - 0 to 3 (CAM1 to CAM4) http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23RID0&res=1 # Return: 200 OK "rID0"
Camera Information
There are a number of query strings to obtain the camera information. The following table indicates the query strings and their return values.
General information including camera model, serial number, MAC address, etc. can be obtained using the query string below.
# QUery URL: http://username:password@192.168.10.24/cgi-bin/getinfo?FILE=1 # Return values: MAC=4C-36-4E-28-12-34 SERIAL=F0TQJ1234 VERSION=V1.88 NAME=AW-HE40 SDrec=disable SDrec2=disable sAlarm=off sAUX=off ePort=31004 aEnable=in aEnc=2 aBitrate=128 aBitrate2=64 aInInterval=20 aOutInterval=640 aOutPort=34004 aOutStatus=off aOutUID=0 aInPort_h264=33004 aInPort_h264_2=33014 aInPort_h264_3=33024 aInPort_h264_4=33034 sRtspMode_h264=0 sRtspMode_h264_2=0 sRtspMode_h264_3=0 sRtspMode_h264_4=0 ImageCaptureMode=2m ratio=16_9 Maxfps=25 StreamMode=1 iTransmit_h264=1 sDelivery_h264=uni iBitrate_h264=6144 iResolution_h264=1920 iQuality_h264=low iMultiAuto_h264=0 iTransmit_h264_2=1 sDelivery_h264_2=uni iBitrate_h264_2=8192 iResolution_h264_2=1280 iQuality_h264_2=low iMultiAuto_h264_2=0 iTransmit_h264_3=1 sDelivery_h264_3=uni iBitrate_h264_3=4096 iResolution_h264_3=640 iQuality_h264_3=low iMultiAuto_h264_3=0 iTransmit_h264_4=1 sDelivery_h264_4=uni iBitrate_h264_4=4096 iResolution_h264_4=640 iQuality_h264_4=low iMultiAuto_h264_4=0
Network information including IPv4 and IPv6 addresses, DNS, DHCP and Gateway can be obtained using the query string below.
# Query URL: http://username:password@192.168.10.24/cgi-bin/network # Return values: ip4_dhcp=0 ip4_addr=192.168.10.24 ip4_netmask=255.255.255.1 ip4_gateway=192.168.10.1 ip4_pri_server= ip4_sec_server= port=80 dns=manual ip6_auto=1 ip6_addr= ip6_gateway= ip6_pri_server= ip6_sec_server= ip6_dhcp=0 rtp_packet_max=1500 mss=1460 time=20 bandwidth=0
Camera Live Information including the power status, model name, camera title, video output format, last called preset, pan/tilt/zoom information, etc. can be obtained using the following query string.
# Query URL: http://192.168.0.10/live/camdata.html # Return values: p1 # Power status OID:AW-HE40 # Model number CGI_TIME:0 # CGI send interval OSA:87:0x11 # Video Format: 0x11: 1080/50p TITLE:CAMERA_01 # Camera Title OGU:0x80 # Gain: Auto OTD:0x1E # Pedestal: 0 OAW:0 # AWB Mode: ATW OSH:0x0 # Shutter Mode: Off ODT:1 # Detail: Off OSF:3 # Scene: Full Auto OBR:0 # Camera/ColorBar: Camera sWZ1 # Speed with Zoom Pos: On OSE:71:0 # Preset Mode: Mode A iNS1 # Install Position: Hanging OUS:0 # OSD: Off d11 # Focus Mode: Auto d31 # Iris Mode: Auto s0 # Latest Call Preset No.: 1 OSA:30:89 # Total Detail Level: 9 d20 # ND Filter: 0 d60 # Option SW: Off d40 # Lamp: 0 OSD:4F:F4 # Iris Follow: F4h OER:0 # Error Notice (Not supported for AW-HE40) rt1 # P/T Mode of Preset: 1 (fixed) axz7A4 # Zoom Position: Wide (555h) to Tele (FFFh) rER00 # Error Status Info.: No Error axfDDD # Focus Position: Near (555h) to Far (FFFh) pE000000000007 # Preset Entry 001 to 040 (40-bit): Preset 1, 2 and 3 set pE010000000000 # Preset Entry 041 to 080 (40-bit): pE020000000000 # Preset Entry 081 to 100 (40-bit): uPVS500 # Preset Speed lC10 # Tilt-Up Limitation Set: Release lC20 # Tilt-Down Limitation Set: Release lC30 # Pan-Left Limitation Set: Release lC40 # Pan-Right Limitation Set: Release ORG:0 # R Gain: -30 OBG:0 # B Gain: -30 OSD:B1:0x008 # Color Temperature pST2 # Preset Speed Table: Fast pRF0 # Freezing images during preset playback: Off OIS:0 # Image Stablilization: Off OSE:70:0 # Digital Zoom: Off OSD:B3:1 # iZoom: On ODE:0 # Digital Extender: Off
Video Stream
Stream No. | URL |
---|---|
1 | rtsp://192.168.0.1/mediainput/h264/stream_1 |
2 | rtsp://192.168.0.1/mediainput/h264/stream_2 |
3 | rtsp://192.168.0.1/mediainput/h264/stream_3 |
Image Acquisition
Still Image:
1 |
http://192.168.0.10/cgi-bin/camera |
Sequence of images:
1 |
http://192.168.0.10/cgi-bin/mjpeg?resolution=1920x1080&framerate=5&quality=1 |
Code Snippets
Capture a live image from the camera
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import requests from requests.auth import HTTPBasicAuth import shutil def captureImage(camera, username, password, filename): request_url = f"http://{camera}/cgi-bin/camera" auth = HTTPBasicAuth(username, password) try: response = requests.get(request_url, verify=False, auth=auth, headers={'referer': f"http://{camera}/"}, stream=True) response.raw.decode_content = True with open(filename, "wb") as file: shutil.copyfileobj(response.raw, file) except Exception as e: print(e) def main(): camera = '192.168.0.10' username = 'admin' password = '1234' filename = 'image.jpg' captureImage(camera, username, password, filename) if __name__ == "__main__": main() |
Get Network Information
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import requests from requests.auth import HTTPBasicAuth import urllib def networkInfo(camera, username, password): request_url = f"http://{camera}/cgi-bin/network" auth = HTTPBasicAuth(username, password) try: response = requests.get(request_url, verify=False, auth=auth, headers={'referer': f"http://{camera}/"}, stream=True) d = dict(urllib.parse.parse_qsl( response.content.decode('UTF-8'), separator='\r\n')) print(f"IP Address: {d['ip4_addr']}") print(f"Network Mask: {d['ip4_netmask']}") print(f"Gateway: {d['ip4_gateway']}") print(f"DHCP: {d['ip4_dhcp'] == '1'}") except Exception as e: print(e) def main(): camera = '192.168.0.10' username = 'admin' password = '1234' networkInfo(camera, username, password) if __name__ == "__main__": main() |