Skip to content

Commit 02b9837

Browse files
committed
Add Recording Encode setter
1 parent cf540d1 commit 02b9837

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ GET:
6262

6363
SET:
6464
- [X] Display -> OSD
65-
- [ ] Recording -> Encode (Clear and Fluent Stream)
65+
- [X] Recording -> Encode (Clear and Fluent Stream)
6666
- [ ] Recording -> Advance (Scheduling)
6767
- [X] Network -> General
6868
- [X] Network -> Advanced

api/APIHandler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def logout(self) -> bool:
8080
"""
8181
try:
8282
data = [{"cmd": "Logout", "action": 0}]
83-
ret = self._execute_command('Logout', data)
84-
print(ret)
83+
self._execute_command('Logout', data)
84+
# print(ret)
8585
return True
8686
except Exception as e:
8787
print("Error Logout\n", e)

api/recording.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,48 @@ def get_recording_advanced(self) -> object:
2727
body = [{"cmd": "GetRec", "action": 1, "param": {"channel": 0}}]
2828
return self._execute_command('GetRec', body)
2929

30+
def set_recording_encoding(self,
31+
audio=0,
32+
main_bit_rate=8192,
33+
main_frame_rate=8,
34+
main_profile='High',
35+
main_size="2560*1440",
36+
sub_bit_rate=160,
37+
sub_frame_rate=7,
38+
sub_profile='High',
39+
sub_size='640*480') -> object:
40+
"""
41+
Sets the current camera encoding settings for "Clear" and "Fluent" profiles.
42+
:param audio: int Audio on or off
43+
:param main_bit_rate: int Clear Bit Rate
44+
:param main_frame_rate: int Clear Frame Rate
45+
:param main_profile: string Clear Profile
46+
:param main_size: string Clear Size
47+
:param sub_bit_rate: int Fluent Bit Rate
48+
:param sub_frame_rate: int Fluent Frame Rate
49+
:param sub_profile: string Fluent Profile
50+
:param sub_size: string Fluent Size
51+
:return: response
52+
"""
53+
body = [{"cmd": "SetEnc",
54+
"action": 0,
55+
"param":
56+
{"Enc":
57+
{"audio": audio,
58+
"channel": 0,
59+
"mainStream": {
60+
"bitRate": main_bit_rate,
61+
"frameRate": main_frame_rate,
62+
"profile": main_profile,
63+
"size": main_size},
64+
"subStream": {
65+
"bitRate": sub_bit_rate,
66+
"frameRate": sub_frame_rate,
67+
"profile": sub_profile,
68+
"size": sub_size}}
69+
}}]
70+
return self._execute_command('SetEnc', body)
71+
3072
###########
3173
# RTSP Stream
3274
###########

0 commit comments

Comments
 (0)