elsampsa / valkka-live

OpenSource Video Surveillance Program
GNU Affero General Public License v3.0
31 stars 12 forks source link

Re-transmit RTSP stream #14

Open hijinkim opened 1 year ago

hijinkim commented 1 year ago

I have modified the code as follows to add RTSP retransmission.

valkka-live/valkka/live/chain/multifork.py

def make_restream_branch(self):
        self.livethread2 = LiveThread(
            name = "live_thread2",
            verbose = False,
            rtsp_server = 8554+self.slot
        )        
        self.live_in_filter = self.livethread2.getFrameFilter()
        self.info_filter = core.InfoFrameFilter("info_filter", self.live_in_filter)
        self.fork_filter_main.connect("restreaming_" + str(self.slot), self.info_filter)

    def restream_client(self, inc = 0):
        if self.restream_client_count < 1 and inc > 0:
            self.out_ctx = core.LiveOutboundContext(core.LiveConnectionType_rtsp, "stream1", self.slot, 0)
            self.livethread2.registerOutbound(self.out_ctx)

        elif self.restream_client_count == 1 and inc < 0:
            self.livethread2.deregisterOutbound(self.out_ctx)

        self.restream_client_count += inc

After executing the code and checking with ffmpeg (ffmpeg -i rtsp://{ip_address}/stream1 -v verbose), I found a log stating that the connection to the address was established, but the stream could not be found. Can you help me identify what went wrong?

[tcp @ 0x5574f6708e40] Starting connection attempt to {ip_address} port 8561
[tcp @ 0x5574f6708e40] Successfully connected to {ip_address} port 8561
[rtsp @ 0x5574f6706b80] method DESCRIBE failed: 404 Stream Not Found
rtsp://{ip_address}:8561/stream1: Server returned 404 Not Found