From cc31f63247c51db8780492663c392d6a0673dbe0 Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 2 Mar 2024 13:16:53 +0000 Subject: [PATCH] e --- unifi/cams/base.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/unifi/cams/base.py b/unifi/cams/base.py index 4ff3761..dc2a516 100644 --- a/unifi/cams/base.py +++ b/unifi/cams/base.py @@ -901,11 +901,11 @@ class UnifiCamBase(metaclass=ABCMeta): def get_base_ffmpeg_args(self, stream_index: str = "") -> str: base_args = [ - # "-avoid_negative_ts", - # "make_zero", + "-avoid_negative_ts", + "make_zero", "-fflags", - "discardcorrupt", - # "-use_wallclock_as_timestamps 1", + "+genpts+discardcorrupt", + "-use_wallclock_as_timestamps 1", ] try: @@ -927,12 +927,23 @@ class UnifiCamBase(metaclass=ABCMeta): if not has_spawned or is_dead: source = await self.get_stream_source(stream_index) + # cmd = ( + # "ffmpeg -nostdin -loglevel error -y" + # f" {self.get_base_ffmpeg_args(stream_index)} -rtsp_transport" + # f' {self.args.rtsp_transport} -i "{source}"' + # f" {self.get_extra_ffmpeg_args(stream_index)} -metadata" + # f" streamName={stream_name} -f flv - | {sys.executable} -m" + # " unifi.clock_sync" + # f" {'--write-timestamps' if self._needs_flv_timestamps else ''} | nc" + # f" {destination[0]} {destination[1]}" + # ) cmd = ( "ffmpeg -nostdin -loglevel debug -y" # f" {self.get_base_ffmpeg_args(stream_index)}" f' -i "{source}"' - f" {self.get_extra_ffmpeg_args(stream_index)} -f flv -" - f" | nc {destination[0]} {destination[1]}" + f" {self.get_extra_ffmpeg_args(stream_index)} -metadata streamName={stream_name} -f flv -" + f" | {sys.executable} -m unifi.clock_sync" + f" {'--write-timestamps' if self._needs_flv_timestamps else ''} | nc" )