update
This commit is contained in:
parent
081312268f
commit
58636fb533
8
MQTT.py
8
MQTT.py
|
@ -7,7 +7,8 @@ from tool import *
|
|||
import configparser
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/home/pi/lot_manager/conf/main/config.conf')
|
||||
# config.read('/home/pi/lot_manager/conf/main/config.conf')
|
||||
config.read('/home/lihai/pythonProjects/lot_manager/conf/main/config.conf')
|
||||
|
||||
|
||||
def valid(msg, client):
|
||||
|
@ -36,7 +37,7 @@ class MQTTClient:
|
|||
|
||||
def on_connect(self, client, userdata, flags, rc):
|
||||
self.client.subscribe(self.topic)
|
||||
self.client.publish('success', payload='成功订阅lot_mqtt' + str(time.time()), qos=0)
|
||||
self.client.publish('success', payload='成功订阅lot_mqtt,time=' + str(time.time()), qos=0)
|
||||
|
||||
def on_message(self, client, userdata, msg):
|
||||
if not valid(msg, client):
|
||||
|
@ -76,14 +77,17 @@ class MQTTClient:
|
|||
def start(self):
|
||||
self.client.username_pw_set(self.username, self.password)
|
||||
self.client.connect(self.broker, self.port)
|
||||
print("连接成功")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(device_name)
|
||||
broker = config.get("broker", "host")
|
||||
port = config.get("broker", "port")
|
||||
topic = config.get("topic", "name")
|
||||
username = config.get("security", "username")
|
||||
password = config.get("security", "password")
|
||||
print(broker, port, topic, username, password)
|
||||
MQTT = MQTTClient(broker, port, topic, username, password)
|
||||
while True:
|
||||
try:
|
||||
|
|
|
@ -8,5 +8,5 @@ CURRENT_TIME=$(date +"%Y-%m-%d_%H-%M-%S")
|
|||
# 构建录像文件名
|
||||
OUTPUT_FILE="${OUTPUT_DIR}/${CURRENT_TIME}.mp4"
|
||||
# 开始录制RTSP流
|
||||
/usr/bin/ffmpeg -rtsp_transport tcp -i "${RTSP_URL}" -c copy -c:a aac -s 1920x1080 -r 15 -crf 35 -t "${RECORD_DURATION}" -f mp4 "${OUTPUT_FILE}"
|
||||
/usr/bin/ffmpeg -rtsp_transport tcp -i "${RTSP_URL}" -c copy -c:a aac -s 1920x1080 -r 15 -crf 35 -b:v 1250k -t "${RECORD_DURATION}" -f mp4 "${OUTPUT_FILE}"
|
||||
|
||||
|
|
Loading…
Reference in New Issue