From 58636fb5334824e069c83ffb3e88c259d2564b1e Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Mon, 11 Dec 2023 14:32:29 +0800 Subject: [PATCH] update --- MQTT.py | 8 ++++++-- bash/record.sh | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MQTT.py b/MQTT.py index 539b108..bb8c153 100644 --- a/MQTT.py +++ b/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: diff --git a/bash/record.sh b/bash/record.sh index 732f273..af86607 100755 --- a/bash/record.sh +++ b/bash/record.sh @@ -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}"