Camera is not continuously streamed using streaming plugin

The Camera stream is disconnect and connect 17 times in 30 minutes observation.

Note: Janus server is running on remote ubuntu server.

Process structure of streaming:

  1. I have created multistream mountpoint in janus.plugin.streaming.jcfg.
  2. Now i insert RTP stream with FFMPEG using below command. (I setup nodejs server for run FFMPEG in my local system.)
    3.FFMPEG command: “ffmpeg -rtsp_transport tcp -i rtsp://ksjgdhk:lgkjl@abc.com:5540/orchid/live?id=7 -c:v copy -an -f rtp rtp://10.30.50.144”
    4.API call from local and getting MediaStream from Janus.
    5.Attach media stream with the videoelement.
    6.Screenshot of the log

Logs in console:
Removing remote track
(index):131 Removing track: MediaStreamTrack {kind: ‘video’, id: ‘janus1’, label: ‘janus1’, enabled: true, muted: true, …}
janus.js:2029 Remote track flowing again: Event {isTrusted: true, type: ‘unmute’, target: MediaStreamTrack, currentTarget: MediaStreamTrack, eventPhase: 2, …}
(index):127 Adding track: MediaStreamTrack {kind: ‘video’, id: ‘janus1’, label: ‘janus1’, enabled: true, muted: false, …}
janus.js:2006 Remote track muted: Event {isTrusted: true, type: ‘mute’, target: MediaStreamTrack, currentTarget: MediaStreamTrack, eventPhase: 2, …}
janus.js:2009 Removing remote track

Check if the connection to the RTSP server is being lost. Also make sure the RTP packets the camera is sending are not too big, since WebRTC adds overhead which may cause their size to be larger than what the network allows, thus causing packets to be dropped.

Which solution should I implement to resolve this? I cannot make any changes to the RTSP server or the RTSP URL; any modifications must be made to Janus or FFmpeg.

You should first investigate whether the problem is in one of the things I said.

Previously the MTU size is 1500 bytes, now i change it to 9000 bytes.
The maximum size of the incoming rtp packets is 2322 bytes.
But still the remote stream is muted and again started track.

I don’t think you understood what I meant. You want the maximum RTP packet size to be lower, not higher, because somewhere on the network it may be lower and cause packets to be dropped. If the camera sends 1500 bytes of RTP, that will become higher than 1500 on WebRTC (due to SRTP and extensions). This means you have to configure the camera (or the ffmpeg/gstreamer script that mediates the conversation, if you have any) to send smaller RTP packets to Janus. 1200 is a good size, on average, because 1280 is the maximum size of IPv6 packets which makes it a good MTU reference.

I update the ffmpeg command as below, by changing the packet size.

ffmpeg -rtsp_transport tcp -i rtsp://ksjgdhk:lgkjl@abc.com:5540/orchid/live?id=7 -c:v copy -an -f rtp rtp://10.30.50.144:5001?pkt_size=1280

But still the mute event is triggered.

Is that i need to change at Janus side ?

Mountpoint in janus:

Site1: {
type = “rtp”
id = 1
description = “Site 1”
media = (
{
type = “video”
mid = “1”
label = “Site 1 - Camera 1”
port = 5001
pt = 96
codec = “h264”
},
{
type = “video”
mid = “2”
label = “Site 1 - Camera 2”
port = 5002
pt = 96
codec = “h264”
}
)
}

Hi @lorenzo Is there any other solution.

Use Wireshark/tcpdump to capture RTP traffic on both the RTSP and WebRTC side to see what’s wrong. Inspecting the browser internals (e.g., chrome://webrtc-internals) may also help you investigate the problem.

@lorenzo, Can the camera streams remain continuous without disconnecting even once for 1-2 hours when using Janus?
Since the same stream runs continuously for 1-2 hours when using Wowza.