Skip to content

Commit

Permalink
Speed up snapshots #340
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlt8 committed Apr 20, 2022
1 parent f38ffb7 commit d46d4aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/rtsp_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def pub_start(self) -> None:
+ env_bool(f"RTSP_PATHS_{self.uri.upper()}_READPASS")
+ f"@{rtsp_addr}"
)
ffmpeg_cmd = f"ffmpeg -loglevel fatal -skip_frame nokey -rtsp_transport tcp -i rtsp://{rtsp_addr}/{self.uri} -vframes 1 -y {img_file}"
ffmpeg_cmd = f"ffmpeg -loglevel fatal -threads 1 -analyzeduration 1 -rtsp_transport tcp -i rtsp://{rtsp_addr}/{self.uri} -f:v h264 -an -f image2 -frames:v 1 -y {img_file}"
while True:
self.send_mqtt("state", "online")
if rtsp:
Expand All @@ -84,8 +84,8 @@ def read_start(self) -> None:

def mqtt_connect(self) -> None:
"""Connect to an MQTT if the env option is enabled."""
self.mqtt_connected = False
if not env_bool("MQTT_HOST"):
self.mqtt_connected = False
return
try:
import paho.mqtt.client as mqtt
Expand Down
4 changes: 2 additions & 2 deletions app/wyze_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class WyzeBridge:
def __init__(self) -> None:
print("🚀 STARTING DOCKER-WYZE-BRIDGE v1.3.4 DEV 2\n")
print("🚀 STARTING DOCKER-WYZE-BRIDGE v1.3.4 DEV 3\n")
signal.signal(signal.SIGTERM, lambda n, f: self.clean_up())
self.hass: bool = bool(os.getenv("HASS"))
self.on_demand: bool = bool(os.getenv("ON_DEMAND"))
Expand Down Expand Up @@ -555,7 +555,7 @@ def get_ffmpeg_cmd(uri: str, cam_model: str = None) -> list:
+ env_bool(f"FFMPEG_FLAGS_{uri}", env_bool("FFMPEG_FLAGS", flags))
.strip("'\"\n ")
.split()
+ ["-analyzeduration", "0", "-probesize", "32", "-f", "h264", "-i", "pipe:"]
+ ["-analyzeduration", "1", "-f", "h264", "-i", "pipe:"]
+ (["-f", "lavfi", "-i", "anullsrc=cl=mono"] if livestream else [])
+ ["-c:v"]
+ (["copy"] if not rotate else lib264)
Expand Down

0 comments on commit d46d4aa

Please sign in to comment.